Event: Handle xrandr correctly
This commit is contained in:
@@ -638,11 +638,12 @@ motionnotify(XEvent *e)
|
||||
/** XRandr handle event
|
||||
*/
|
||||
#ifdef HAVE_XRANDR
|
||||
static void
|
||||
void
|
||||
xrandrevent(XEvent *e)
|
||||
{
|
||||
/* Update xrandr configuration */
|
||||
XRRUpdateConfiguration(e);
|
||||
if(!XRRUpdateConfiguration(e))
|
||||
return;
|
||||
|
||||
/* Reload WMFS to update the screen(s) geometry changement */
|
||||
quit();
|
||||
@@ -701,10 +702,6 @@ event_make_array(void)
|
||||
event_handle[SelectionClear] = selectionclearevent;
|
||||
event_handle[UnmapNotify] = unmapnotify;
|
||||
|
||||
#ifdef HAVE_XRANDR
|
||||
event_handle[xrandr_event] = xrandrevent;
|
||||
#endif /* HAVE_XRANDR */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ void
|
||||
init(void)
|
||||
{
|
||||
/* First init */
|
||||
event_make_array();
|
||||
ewmh_init_hints();
|
||||
init_conf();
|
||||
init_gc();
|
||||
@@ -214,7 +215,6 @@ init(void)
|
||||
init_status();
|
||||
ewmh_update_current_tag_prop();
|
||||
grabkeys();
|
||||
event_make_array();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -354,7 +354,12 @@ launcher_execute(Launcher *launcher)
|
||||
barwin_draw_text(bw, 1 + textw(launcher->prompt) + textw(" "), FHINFOBAR - 1, buf);
|
||||
barwin_refresh(bw);
|
||||
}
|
||||
else if(ev.type < LASTEvent)
|
||||
else
|
||||
#ifdef HAVE_XRANDR
|
||||
if(ev.type == xrandr_event + RRScreenChangeNotify)
|
||||
xrandrevent(&ev);
|
||||
else
|
||||
#endif /* HAVE_XRANDR */
|
||||
HANDLE_EVENT(&ev);
|
||||
|
||||
XNextEvent(dpy, &ev);
|
||||
|
||||
@@ -221,6 +221,11 @@ 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)
|
||||
HANDLE_EVENT(ev);
|
||||
break;
|
||||
|
||||
10
src/wmfs.c
10
src/wmfs.c
@@ -200,7 +200,12 @@ mainloop(void)
|
||||
|
||||
while(!exiting && !XNextEvent(dpy, &ev))
|
||||
{
|
||||
HANDLE_EVENT(&ev);
|
||||
#ifdef HAVE_XRANDR
|
||||
if(ev.type == xrandr_event + RRScreenChangeNotify)
|
||||
xrandrevent(&ev);
|
||||
else
|
||||
#endif /* HAVE_XRANDR */
|
||||
HANDLE_EVENT(&ev);
|
||||
wait_childs_and_status();
|
||||
}
|
||||
|
||||
@@ -210,7 +215,6 @@ mainloop(void)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/** Set the exiting variable to True
|
||||
* for stop the main loop
|
||||
* \param cmd unused uicb_t
|
||||
@@ -449,7 +453,7 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
char *ol = "csgVS";
|
||||
char *ol = "csVS";
|
||||
extern char *optarg;
|
||||
extern int optind;
|
||||
struct sigaction sa;
|
||||
|
||||
@@ -261,6 +261,10 @@ uint color_shade(uint, double);
|
||||
void grabkeys(void);
|
||||
void event_make_array(void);
|
||||
|
||||
#ifdef HAVE_XRANDR
|
||||
void xrandrevent(XEvent *e);
|
||||
#endif /* HAVE_XRANDR */
|
||||
|
||||
/* menu.c */
|
||||
void menu_init(Menu *menu, char *name, int nitem, uint bg_f, char *fg_f, uint bg_n, char *fg_n);
|
||||
void menu_new_item(MenuItem *mi, char *name, void *func, char *cmd);
|
||||
|
||||
Reference in New Issue
Block a user