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