bug fix: rewrite handler allocation dynamicly to correctly add shape and xrandr events
This commit is contained in:
parent
7cb62508da
commit
92e8fb4cfb
36
awesome.c
36
awesome.c
|
@ -268,6 +268,7 @@ xerror(Display * edpy, XErrorEvent * ee)
|
||||||
* \param argv who knows
|
* \param argv who knows
|
||||||
* \return EXIT_SUCCESS I hope
|
* \return EXIT_SUCCESS I hope
|
||||||
*/
|
*/
|
||||||
|
typedef void event_handler (XEvent *, awesome_config *);
|
||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
@ -281,6 +282,7 @@ main(int argc, char *argv[])
|
||||||
int screen;
|
int screen;
|
||||||
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||||
Atom netatom[NetLast];
|
Atom netatom[NetLast];
|
||||||
|
event_handler **handler;
|
||||||
|
|
||||||
if(argc == 2 && !strcmp("-v", argv[1]))
|
if(argc == 2 && !strcmp("-v", argv[1]))
|
||||||
{
|
{
|
||||||
|
@ -325,29 +327,33 @@ main(int argc, char *argv[])
|
||||||
drawstatusbar(dpy, screen, &dc[screen], &awesomeconf[screen]);
|
drawstatusbar(dpy, screen, &dc[screen], &awesomeconf[screen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void (*handler[LASTEvent]) (XEvent *, awesome_config *) =
|
handler = p_new(event_handler *, LASTEvent);
|
||||||
{
|
handler[ButtonPress] = handle_event_buttonpress;
|
||||||
[ButtonPress] = handle_event_buttonpress,
|
handler[ConfigureRequest] = handle_event_configurerequest;
|
||||||
[ConfigureRequest] = handle_event_configurerequest,
|
handler[ConfigureNotify] = handle_event_configurenotify;
|
||||||
[ConfigureNotify] = handle_event_configurenotify,
|
handler[DestroyNotify] = handle_event_destroynotify;
|
||||||
[DestroyNotify] = handle_event_destroynotify,
|
handler[EnterNotify] = handle_event_enternotify;
|
||||||
[EnterNotify] = handle_event_enternotify,
|
handler[LeaveNotify] = handle_event_leavenotify;
|
||||||
[LeaveNotify] = handle_event_leavenotify,
|
handler[Expose] = handle_event_expose;
|
||||||
[Expose] = handle_event_expose,
|
handler[KeyPress] = handle_event_keypress;
|
||||||
[KeyPress] = handle_event_keypress,
|
handler[MappingNotify] = handle_event_mappingnotify;
|
||||||
[MappingNotify] = handle_event_mappingnotify,
|
handler[MapRequest] = handle_event_maprequest;
|
||||||
[MapRequest] = handle_event_maprequest,
|
handler[PropertyNotify] = handle_event_propertynotify;
|
||||||
[PropertyNotify] = handle_event_propertynotify,
|
handler[UnmapNotify] = handle_event_unmapnotify;
|
||||||
[UnmapNotify] = handle_event_unmapnotify,
|
|
||||||
};
|
|
||||||
|
|
||||||
/* check for shape extension */
|
/* check for shape extension */
|
||||||
if((awesomeconf[0].have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
if((awesomeconf[0].have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||||
|
{
|
||||||
|
p_realloc(&handler, shape_event + 1);
|
||||||
handler[shape_event] = handle_event_shape;
|
handler[shape_event] = handle_event_shape;
|
||||||
|
}
|
||||||
|
|
||||||
/* check for randr extension */
|
/* check for randr extension */
|
||||||
if((awesomeconf[0].have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
if((awesomeconf[0].have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||||
|
{
|
||||||
|
p_realloc(&handler, randr_event_base + RRScreenChangeNotify + 1);
|
||||||
handler[randr_event_base + RRScreenChangeNotify] = handle_event_randr_screen_change_notify;
|
handler[randr_event_base + RRScreenChangeNotify] = handle_event_randr_screen_change_notify;
|
||||||
|
}
|
||||||
|
|
||||||
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue