Event: Handle xrandr with event_handle
This commit is contained in:
parent
860a1a2c11
commit
a06e0daa5a
10
src/event.c
10
src/event.c
@ -681,6 +681,12 @@ event_make_array(void)
|
||||
{
|
||||
int i = LASTEvent;
|
||||
|
||||
#ifdef HAVE_XRANDR
|
||||
i = xrandr_event + RRScreenChangeNotify;
|
||||
#endif /* HAVE_XRANDR */
|
||||
|
||||
event_handle = xcalloc((nevent = i + 1), sizeof(event_handle));
|
||||
|
||||
/* Fill array with non-used function (do nothing) */
|
||||
while(i--)
|
||||
event_handle[i] = reparentnotify;
|
||||
@ -702,6 +708,10 @@ event_make_array(void)
|
||||
event_handle[SelectionClear] = selectionclearevent;
|
||||
event_handle[UnmapNotify] = unmapnotify;
|
||||
|
||||
#ifdef HAVE_XRANDR
|
||||
event_handle[xrandr_event + RRScreenChangeNotify] = xrandrevent;
|
||||
#endif /* HAVE_XRANDR */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -201,7 +201,6 @@ void
|
||||
init(void)
|
||||
{
|
||||
/* First init */
|
||||
event_make_array();
|
||||
ewmh_init_hints();
|
||||
init_conf();
|
||||
init_gc();
|
||||
@ -210,6 +209,7 @@ init(void)
|
||||
init_key();
|
||||
init_root();
|
||||
screen_init_geo();
|
||||
event_make_array();
|
||||
infobar_init();
|
||||
systray_acquire();
|
||||
init_status();
|
||||
|
||||
@ -354,12 +354,7 @@ launcher_execute(Launcher *launcher)
|
||||
barwin_draw_text(bw, 1 + textw(launcher->prompt) + textw(" "), FHINFOBAR - 1, buf);
|
||||
barwin_refresh(bw);
|
||||
}
|
||||
else
|
||||
#ifdef HAVE_XRANDR
|
||||
if(ev.type == xrandr_event + RRScreenChangeNotify)
|
||||
xrandrevent(&ev);
|
||||
else
|
||||
#endif /* HAVE_XRANDR */
|
||||
else if(ev.type < nevent)
|
||||
HANDLE_EVENT(&ev);
|
||||
|
||||
XNextEvent(dpy, &ev);
|
||||
|
||||
@ -221,12 +221,7 @@ menu_manage_event(XEvent *ev, Menu *menu, BarWindow *winitem[])
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef HAVE_XRANDR
|
||||
if(ev->type == xrandr_event + RRScreenChangeNotify)
|
||||
xrandrevent(ev);
|
||||
else
|
||||
#endif /* HAVE_XRANDR */
|
||||
if(ev->type < LASTEvent)
|
||||
if(ev->type < nevent)
|
||||
HANDLE_EVENT(ev);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -184,7 +184,7 @@ mouse_move(Client *c)
|
||||
mouse_dragborder(geo, gci);
|
||||
}
|
||||
}
|
||||
else if((ev.type == MapRequest || ev.type == ConfigureRequest) && ev.type < LASTEvent)
|
||||
else if((ev.type == MapRequest || ev.type == ConfigureRequest))
|
||||
HANDLE_EVENT(&ev);
|
||||
}
|
||||
while(ev.type != ButtonRelease);
|
||||
|
||||
@ -135,6 +135,8 @@ quit(void)
|
||||
XSync(dpy, False);
|
||||
XCloseDisplay(dpy);
|
||||
|
||||
free(event_handle);
|
||||
|
||||
/* kill status script */
|
||||
if (conf.status_pid != (pid_t)-1)
|
||||
kill(conf.status_pid, SIGTERM);
|
||||
@ -200,12 +202,7 @@ mainloop(void)
|
||||
|
||||
while(!exiting && !XNextEvent(dpy, &ev))
|
||||
{
|
||||
#ifdef HAVE_XRANDR
|
||||
if(ev.type == xrandr_event + RRScreenChangeNotify)
|
||||
xrandrevent(&ev);
|
||||
else
|
||||
#endif /* HAVE_XRANDR */
|
||||
HANDLE_EVENT(&ev);
|
||||
HANDLE_EVENT(&ev);
|
||||
wait_childs_and_status();
|
||||
}
|
||||
|
||||
|
||||
@ -476,7 +476,8 @@ Client *clients;
|
||||
Client *sel;
|
||||
|
||||
/* Other */
|
||||
void (*event_handle[LASTEvent])(XEvent*);
|
||||
int nevent;
|
||||
void (**event_handle)(XEvent*);
|
||||
extern const func_name_list_t func_list[];
|
||||
extern const func_name_list_t layout_list[];
|
||||
uint numlockmask;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user