From: Mike Lowis Date: Tue, 6 Aug 2024 17:20:23 +0000 (-0400) Subject: added dynamic monitor reconfiguration using xinerama instead of xrandr X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=0ce92a51891bcecfc02b14f1fa21413079b9b34e;p=proto%2Fanvil.git added dynamic monitor reconfiguration using xinerama instead of xrandr --- diff --git a/anvil.c b/anvil.c index c7b1c41..b5ab345 100644 --- a/anvil.c +++ b/anvil.c @@ -96,7 +96,6 @@ static void check_for_wm(void) { error_default = XSetErrorHandler(error_init); XSelectInput(X.disp, X.root, SubstructureRedirectMask|SubstructureNotifyMask); - XRRSelectInput(X.disp, X.root, RRScreenChangeNotifyMask); XSync(X.disp, False); XSetErrorHandler(error_panic); XSync(X.disp, False); @@ -164,6 +163,14 @@ static void xconfigrequest(XEvent* e) } } +static void xconfignotify(XEvent* e) +{ + XConfigureEvent* ev = &(e->xconfigure); + if (ev->window == X.root) + { + Monitors_Init(); + } +} static void xclientmsg(XEvent* e) { @@ -229,13 +236,6 @@ static void xkeypress(XEvent* e) Keys_Process(ev); } -static void xscreenchangenotify(XEvent* e) -{ - (void)e; - Monitors_Init(); -} - - static void init_cursors(void) { XColor csr_bdr, csr_fill; @@ -317,12 +317,11 @@ int main(void) X.eventfns[MotionNotify] = xbtnmotion; X.eventfns[KeyPress] = xkeypress; X.eventfns[ConfigureRequest] = xconfigrequest; + X.eventfns[ConfigureNotify] = xconfignotify; X.eventfns[ClientMessage] = xclientmsg; X.eventfns[PropertyNotify] = xpropnotify; X.eventfns[EnterNotify] = xenternotify; X.eventfns[Expose] = xexpose; - X.eventfns[RRScreenChangeNotify] = xscreenchangenotify; - /* main event loop */ XSync(X.disp, False); diff --git a/anvil.h b/anvil.h index 3f08f62..37c2641 100644 --- a/anvil.h +++ b/anvil.h @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include diff --git a/build.sh b/build.sh index 57e3872..85cab23 100755 --- a/build.sh +++ b/build.sh @@ -2,7 +2,7 @@ cflags="-g -Wall -Wextra -Werror" incpath="-I/usr/X11R6/include -Itest/" libpath="-L/usr/X11R6/lib" -libs="-lX11 -lXinerama -lm -lXrandr" +libs="-lX11 -lXinerama -lm" cc $cflags $incpath $libpath -o anvil ./*.c $libs \ # && ./atf $incpath test/*.c