The following shows the diffstat and patchsets between c0c149b..4757413^ ---------------------------------------------------------------- commit 4757413fbbca057f66346161b9304fb227593cab Author: Thomas Adam <tho...@fvwm.org> Date: Sun Nov 2 18:39:34 2014 +0000
WIP; moving monitor information into desk/page, etc. --- modules/MvwmIdent/MvwmIdent.h | 1 + modules/MvwmPager/MvwmPager.c | 18 +++++++++++++++++- modules/MvwmPager/MvwmPager.h | 1 + mvwm/module_interface.c | 9 ++++++--- mvwm/virtual.c | 22 +++++++++++++++------- 5 files changed, 40 insertions(+), 11 deletions(-) diff --git a/modules/MvwmIdent/MvwmIdent.h b/modules/MvwmIdent/MvwmIdent.h index a14fb1d..f3ba698 100644 --- a/modules/MvwmIdent/MvwmIdent.h +++ b/modules/MvwmIdent/MvwmIdent.h @@ -22,6 +22,7 @@ struct target_struct long height_inc; long desktop; long layer; + long monitor_id; unsigned long gravity; window_flags flags; long title_h; diff --git a/modules/MvwmPager/MvwmPager.c b/modules/MvwmPager/MvwmPager.c index aab2353..7d0e077 100644 --- a/modules/MvwmPager/MvwmPager.c +++ b/modules/MvwmPager/MvwmPager.c @@ -853,6 +853,7 @@ void list_new_desk(unsigned long *body) oldDesk = FPScr.CurrentDesk; FPScr.CurrentDesk = (long)body[0]; + FPScr.monitor_name = mvwm_strdup(monitor_by_number(body[1])->name); if (fAlwaysCurrentDesk && oldDesk != FPScr.CurrentDesk) { PagerWindow *t; @@ -1590,10 +1591,11 @@ void ParseOptions(void) FPScr.Hilite = NULL; FPScr.VScale = 32; + fpa.mask = 0; + FPScr.MyDisplayWidth = DisplayWidth(dpy, FPScr.screen); FPScr.MyDisplayHeight = DisplayHeight(dpy, FPScr.screen); - fpa.mask = 0; if (Pdepth <= 8) { fpa.mask |= FPAM_DITHER; @@ -2170,6 +2172,20 @@ void ParseOptions(void) free(BalloonFormatString); CopyString(&BalloonFormatString,arg1); } + else if (StrEquals(resource, "Monitor")) + { + char *mon_name; + struct monitor *mon = NULL; + + mon_name = mvwm_strdup(arg1); + mon = monitor_by_name(mon_name); + + /* XXX FIXME: Need to account for coord.x/coord.y!!! */ + FPScr.MyDisplayWidth = mon->coord.w; + FPScr.MyDisplayHeight = mon->coord.h; + + free(mon_name); + } free(resource); free(arg1); diff --git a/modules/MvwmPager/MvwmPager.h b/modules/MvwmPager/MvwmPager.h index 4abe3f0..33a06c7 100644 --- a/modules/MvwmPager/MvwmPager.h +++ b/modules/MvwmPager/MvwmPager.h @@ -39,6 +39,7 @@ typedef struct MvwmPagerScreenInfo int Vx; /* Current loc for top left of virt desk */ int Vy; int CurrentDesk; + char *monitor_name; Pixmap sticky_gray_pixmap; Pixmap light_gray_pixmap; Pixmap gray_pixmap; diff --git a/mvwm/module_interface.c b/mvwm/module_interface.c index 627a7ec..c6bce42 100644 --- a/mvwm/module_interface.c +++ b/mvwm/module_interface.c @@ -857,15 +857,18 @@ void CMD_Send_WindowList(F_CMD_ARGS) { return; } - SendPacket(mod, M_NEW_DESK, 1, (long)m->virtual_scr.CurrentDesk); + SendPacket(mod, M_NEW_DESK, 2, + (long)m->virtual_scr.CurrentDesk, + (long)m->number); SendPacket( - mod, M_NEW_PAGE, 7, (long)m->virtual_scr.Vx, + mod, M_NEW_PAGE, 8, (long)m->virtual_scr.Vx, (long)m->virtual_scr.Vy, (long)m->virtual_scr.CurrentDesk, (long)m->coord.w, (long)m->coord.h, (long)((m->virtual_scr.VxMax / m->coord.w) + 1), - (long)((m->virtual_scr.VyMax / m->coord.h) + 1)); + (long)((m->virtual_scr.VyMax / m->coord.h) + 1), + (long)m->number); if (Scr.Hilite != NULL) { diff --git a/mvwm/virtual.c b/mvwm/virtual.c index 350de4c..26a8c6a 100644 --- a/mvwm/virtual.c +++ b/mvwm/virtual.c @@ -1282,11 +1282,12 @@ void MoveViewport(struct monitor *m, int newx, int newy, Bool grab) if (deltax || deltay) { BroadcastPacket( - M_NEW_PAGE, 7, (long)m->virtual_scr.Vx, (long)m->virtual_scr.Vy, + M_NEW_PAGE, 8, (long)m->virtual_scr.Vx, (long)m->virtual_scr.Vy, (long)m->virtual_scr.CurrentDesk, (long)m->coord.w, (long)m->coord.h, (long)((m->virtual_scr.VxMax / m->coord.w) + 1), - (long)((m->virtual_scr.VyMax / m->coord.h) + 1)); + (long)((m->virtual_scr.VyMax / m->coord.h) + 1), + (long)m->number); /* * RBW - 11/13/1998 - new: chase the chain @@ -1458,7 +1459,9 @@ void goto_desk(int desk, struct monitor *m) m->virtual_scr.CurrentDesk = desk; MapDesk(m, desk, True); focus_grab_buttons_all(); - BroadcastPacket(M_NEW_DESK, 1, (long)m->virtual_scr.CurrentDesk); + BroadcastPacket(M_NEW_DESK, 2, + (long)m->virtual_scr.CurrentDesk, + (long)m->number); /* FIXME: domivogt (22-Apr-2000): Fake a 'restack' for sticky * window upon desk change. This is a workaround for a * problem in MvwmPager: The pager has a separate 'root' @@ -2102,13 +2105,14 @@ void CMD_DesktopSize(F_CMD_ARGS) m->virtual_scr.VyMax = (val[1] <= 0) ? 0: val[1] * m->coord.h - m->coord.h; BroadcastPacket( - M_NEW_PAGE, 7, (long)m->virtual_scr.Vx, + M_NEW_PAGE, 8, (long)m->virtual_scr.Vx, (long)m->virtual_scr.Vy, (long)m->virtual_scr.CurrentDesk, (long)m->coord.w, (long)m->coord.h, (long)((m->virtual_scr.VxMax / m->coord.w) + 1), - (long)((m->virtual_scr.VyMax / m->coord.h) + 1)); + (long)((m->virtual_scr.VyMax / m->coord.h) + 1), + (long)m->number); checkPanFrames(); EWMH_SetDesktopGeometry(m); @@ -2185,7 +2189,9 @@ void CMD_GotoDeskAndPage(F_CMD_ARGS) m->virtual_scr.CurrentDesk = val[0]; MapDesk(m, val[0], True); focus_grab_buttons_all(); - BroadcastPacket(M_NEW_DESK, 1, (long)m->virtual_scr.CurrentDesk); + BroadcastPacket(M_NEW_DESK, 2, + (long)m->virtual_scr.CurrentDesk, + (long)m->number); /* FIXME: domivogt (22-Apr-2000): Fake a 'restack' for sticky * window upon desk change. This is a workaround for a * problem in MvwmPager: The pager has a separate 'root' @@ -2199,7 +2205,9 @@ void CMD_GotoDeskAndPage(F_CMD_ARGS) } else { - BroadcastPacket(M_NEW_DESK, 1, (long)m->virtual_scr.CurrentDesk); + BroadcastPacket(M_NEW_DESK, 2, + (long)m->virtual_scr.CurrentDesk, + (long)m->number); } EWMH_SetCurrentDesktop(m); commit fc71c3aa3ef5135e201c08bcd1d5b855fa7a61fe Author: Thomas Adam <tho...@fvwm.org> Date: Sat Nov 1 19:46:29 2014 +0000 TODO: Add item about monitor API --- TODO | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO b/TODO index ab5506d..2b818bd 100644 --- a/TODO +++ b/TODO @@ -89,6 +89,8 @@ Here's a very brief list of things on my immediate radar. -- Thomas Adam functionality. * Modules: + - monitor API in libs/FScreen.c to be flattened to use an enum to look for + monitor-specific information instead, rather than lots of small functions? - The module interface (FVWM <-> Module) is a mess; consider DBUS? Or imsg? - Use libevent to replace the hand-rolled (and often broken) select/poll commit 48301a0280e32db836188bd5b7a93c4fb7830c60 Author: Thomas Adam <tho...@fvwm.org> Date: Sat Nov 1 19:44:27 2014 +0000 Introduce monitor_by_number() Rather than internal APIs relying on the name of monitors when looking up various things about them, instead assign each monitor an ID which can be used internally. This will also make things easier in the longer-term when trying to streamline how RandR is going to be used, but for now this will make more sense in terms of communicating monitor information with modules. --- libs/FScreen.c | 23 +++++++++++++++++++++++ libs/FScreen.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/libs/FScreen.c b/libs/FScreen.c index 8ede234..e5b7413 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -126,6 +126,27 @@ monitor_by_name(const char *name) } struct monitor * +monitor_by_number(int number) +{ + struct monitor *m = NULL; + + TAILQ_FOREACH(m, &monitor_q, entry) { + if (m->number == number) + return (m); + } + + /* If 'm' is still NULL here, and the monitor number is -1, return + * the global monitor instead. This check can only succeed if we've + * requested the global screen whilst XRandR is in use, since the global + * monitor isn't stored in the monitor list directly. + */ + if (m == NULL && number == -1) + return (global_monitor); + + return (NULL); +} + +struct monitor * monitor_by_xy(int x, int y) { struct monitor *m; @@ -170,6 +191,7 @@ void FScreenInit(Display *dpy) global_monitor->coord.w = DisplayWidth(disp, DefaultScreen(disp)); global_monitor->coord.h = DisplayHeight(disp, DefaultScreen(disp)); global_monitor->name = mvwm_strdup("global"); + global_monitor->number = -1; if (!is_randr_present) { /* TA: 2014-09-16: We maintain a list of all monitors. If @@ -203,6 +225,7 @@ void FScreenInit(Display *dpy) m->coord.w = crtc->width; m->coord.h = crtc->height; m->name = mvwm_strdup(oinfo->name); + m->number = i; init_monitor_contents(m); diff --git a/libs/FScreen.h b/libs/FScreen.h index 1902554..fd1024e 100644 --- a/libs/FScreen.h +++ b/libs/FScreen.h @@ -29,6 +29,7 @@ typedef enum struct monitor { char *name; + int number; struct { int x; int y; @@ -69,6 +70,7 @@ struct monitor *global_monitor; struct monitor *monitor_get_current(void); struct monitor *monitor_by_name(const char *); struct monitor *monitor_by_xy(int, int); +struct monitor *monitor_by_number(int); #define FSCREEN_MANGLE_USPOS_HINTS_MAGIC ((short)-32109) commit 055b84f84b76f6c2014d6c15d085d3b8b81e5202 Author: Thomas Adam <tho...@fvwm.org> Date: Sat Nov 1 19:36:58 2014 +0000 Officially deprecate Xinerama / XineramaPrimaryScreen These no longer make sense with XRandR; may well be resurrected in some other guise later on. For now the commands exist as stubs only, with a deprecation warning present until such time that we deal with configuration migration properly. --- mvwm/module_interface.c | 12 ------------ mvwm/virtual.c | 33 ++++++++++++--------------------- 2 files changed, 12 insertions(+), 33 deletions(-) diff --git a/mvwm/module_interface.c b/mvwm/module_interface.c index 72cab06..627a7ec 100644 --- a/mvwm/module_interface.c +++ b/mvwm/module_interface.c @@ -628,18 +628,6 @@ void BroadcastConfigInfoString(char *string) return; } - -/* - * Broadcasts the state of Xinerama support to all modules as M_CONFIG_INFO. - */ -void broadcast_xinerama_state(void) -{ - BroadcastConfigInfoString((char *)FScreenGetConfiguration()); - - return; -} - - /* * Broadcasts the ignored modifiers to all modules as M_CONFIG_INFO. */ diff --git a/mvwm/virtual.c b/mvwm/virtual.c index 1d3a767..350de4c 100644 --- a/mvwm/virtual.c +++ b/mvwm/virtual.c @@ -2061,34 +2061,25 @@ void CMD_EdgeResistance(F_CMD_ARGS) return; } +/* TA: Removed; left as stubs so as not to need to worry about config file + * migtation just yet. + */ void CMD_Xinerama(F_CMD_ARGS) { - int toggle; - - toggle = ParseToggleArgument(action, NULL, -1, 0); - if (toggle == -1) - { - toggle = !FScreenIsEnabled(); - } - if (!toggle != !FScreenIsEnabled()) - { - scr_flags.do_need_window_update = True; - scr_flags.has_xinerama_state_changed = True; - broadcast_xinerama_state(); - } - + mvwm_msg(OLD, "CMD_Xinerama", + "The Xinerama command is obsolete and no longer " + "does anything."); return; } +/* TA: Removed; left as stubs so as not to need to worry about config file + * migtation just yet. + */ void CMD_XineramaPrimaryScreen(F_CMD_ARGS) { - if (FScreenIsEnabled()) - { - scr_flags.do_need_window_update = True; - scr_flags.has_xinerama_state_changed = True; - } - broadcast_xinerama_state(); - + mvwm_msg(OLD, "CMD_XineramaPrimaryScreen", + "The XineramaPrimaryScreen command is obsolete and no longer " + "does anything."); return; } commit 648f7a6777395566e724fb07470adc61755044fc Author: Thomas Adam <tho...@fvwm.org> Date: Sat Nov 1 19:35:10 2014 +0000 Remove FScreenConfigureModule / FScreenGetConfiguration Modules relying on monitor-specific information will be configured locally, and module packets sent to modules will instead receive the monitor such events occurred on. --- libs/FScreen.c | 48 --------------------------------------- libs/FScreen.h | 4 ---- modules/MvwmButtons/MvwmButtons.c | 4 ---- modules/MvwmButtons/parse.c | 5 ---- modules/MvwmIconMan/mvwm.c | 4 ---- modules/MvwmIconMan/readconfig.c | 7 ------ modules/MvwmIdent/MvwmIdent.c | 11 --------- modules/MvwmPager/MvwmPager.c | 8 ------- mvwm/modconf.c | 8 ------- 9 files changed, 99 deletions(-) diff --git a/libs/FScreen.c b/libs/FScreen.c index c251dc7..8ede234 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -249,54 +249,6 @@ init_monitor_contents(struct monitor *m) m->virtual_scr.EdgeScrollY = DEFAULT_EDGE_SCROLL * m->coord.h / 100; } -/* Intended to be called by modules. Simply pass in the parameter from the - * config string sent by mvwm. */ -void FScreenConfigureModule(char *args) -{ -#if 0 - int n; - char *next; - - n = GetIntegerArguments(args, &next, val, 4); - if (n != 4) - { - /* ignore broken line */ - return; - } - FScreenSetPrimaryScreen(val[1]); - - if (val[3]) - { - /* SLS screen coordinates follow */ - n = GetIntegerArguments(next, &next, val + 4, 1); - if (n != 1) - { - /* ignore broken line */ - return; - } - } -#endif - return; -} - -/* Here's the function used by mvwm to generate the string which - * FScreenConfigureModule expects to receive back as its argument. - */ -const char *FScreenGetConfiguration(void) -{ - int l; - static char msg[MAX_MODULE_INPUT_TEXT_LEN]; - - sprintf( - msg, XINERAMA_CONFIG_STRING" %d %d %d %d", - FScreenIsEnabled(), 0, - 0, 0); - l = strlen(msg); - sprintf(msg + l, " %d %d", 0, 0); - - return msg; -} - /* Sets the default screen for ...ParseGeometry if no screen spec is given. * Usually this is FSCREEN_SPEC_PRIMARY, but this won't allow modules to appear * under the pointer. */ diff --git a/libs/FScreen.h b/libs/FScreen.h index 8f70167..1902554 100644 --- a/libs/FScreen.h +++ b/libs/FScreen.h @@ -76,10 +76,6 @@ struct monitor *monitor_by_xy(int, int); /* Control */ Bool FScreenIsEnabled(void); void FScreenInit(Display *dpy); -/* Intended to be called by modules. Simply pass in the parameter from the - * config string sent by mvwm. */ -void FScreenConfigureModule(char *args); -const char* FScreenGetConfiguration(void); /* For use by mvwm */ void FScreenSetDefaultModuleScreen(char *scr_spec); void FScreenSetPrimaryScreen(int scr); diff --git a/modules/MvwmButtons/MvwmButtons.c b/modules/MvwmButtons/MvwmButtons.c index d18dd01..6f0b29a 100644 --- a/modules/MvwmButtons/MvwmButtons.c +++ b/modules/MvwmButtons/MvwmButtons.c @@ -2682,10 +2682,6 @@ static void handle_config_info_packet(unsigned long *body) colorset = LoadColorset(tline); change_colorset(colorset, NULL); } - else if (StrEquals(token, XINERAMA_CONFIG_STRING)) - { - FScreenConfigureModule(tline); - } return; } diff --git a/modules/MvwmButtons/parse.c b/modules/MvwmButtons/parse.c index 539b71b..7ae7749 100644 --- a/modules/MvwmButtons/parse.c +++ b/modules/MvwmButtons/parse.c @@ -2057,7 +2057,6 @@ void ParseConfiguration(button_info *ub) NULL, /* filled out below */ "imagepath", "colorset", - XINERAMA_CONFIG_STRING, NULL }; @@ -2091,10 +2090,6 @@ void ParseConfiguration(button_info *ub) /* store colorset sent by mvwm */ LoadColorset(rest); break; - case 3: - /* Xinerama state */ - FScreenConfigureModule(rest); - break; } GetConfigLine(fd,&s); } diff --git a/modules/MvwmIconMan/mvwm.c b/modules/MvwmIconMan/mvwm.c index acc03ad..fd05042 100644 --- a/modules/MvwmIconMan/mvwm.c +++ b/modules/MvwmIconMan/mvwm.c @@ -247,10 +247,6 @@ static void handle_config_info(unsigned long *body) color = LoadColorset(rest); change_colorset(color); } - else if (StrEquals(token, XINERAMA_CONFIG_STRING)) - { - FScreenConfigureModule(rest); - } else if (StrEquals(token, "IgnoreModifiers")) { sscanf(rest, "%d", &mods_unused); diff --git a/modules/MvwmIconMan/readconfig.c b/modules/MvwmIconMan/readconfig.c index 0d07cb1..03be250 100644 --- a/modules/MvwmIconMan/readconfig.c +++ b/modules/MvwmIconMan/readconfig.c @@ -842,13 +842,6 @@ static int GetConfigLineWrapper(int *fd, char **tline) { LoadColorset(&(*tline)[8]); } - else if (strncasecmp( - *tline, XINERAMA_CONFIG_STRING, - sizeof(XINERAMA_CONFIG_STRING) - 1) == 0) - { - FScreenConfigureModule( - (*tline) + sizeof(XINERAMA_CONFIG_STRING) - 1); - } else if (strncasecmp(*tline, "IgnoreModifiers", 15) == 0) { sscanf((*tline) + 16, "%d", &mods_unused); diff --git a/modules/MvwmIdent/MvwmIdent.c b/modules/MvwmIdent/MvwmIdent.c index fbed360..93839d3 100644 --- a/modules/MvwmIdent/MvwmIdent.c +++ b/modules/MvwmIdent/MvwmIdent.c @@ -272,13 +272,6 @@ int main(int argc, char **argv) { LoadColorset(&tline[8]); } - else if (strncasecmp( - tline, XINERAMA_CONFIG_STRING, - sizeof(XINERAMA_CONFIG_STRING) - 1) == 0) - { - FScreenConfigureModule( - tline + sizeof(XINERAMA_CONFIG_STRING) - 1); - } GetConfigLine(fd, &tline); } @@ -561,10 +554,6 @@ void list_config_info(unsigned long *body) &Colorset[colorset], Pdepth, gc, True); } } - else if (StrEquals(token, XINERAMA_CONFIG_STRING)) - { - FScreenConfigureModule(tline); - } if (token) free(token); } diff --git a/modules/MvwmPager/MvwmPager.c b/modules/MvwmPager/MvwmPager.c index d23d6e4..aab2353 100644 --- a/modules/MvwmPager/MvwmPager.c +++ b/modules/MvwmPager/MvwmPager.c @@ -1370,10 +1370,6 @@ void list_config_info(unsigned long *body) color = LoadColorset(tline); change_colorset(color); } - else if (StrEquals(token, XINERAMA_CONFIG_STRING)) - { - FScreenConfigureModule(tline); - } else if (StrEquals(token, "DesktopName")) { int val; @@ -1623,10 +1619,6 @@ void ParseOptions(void) LoadColorset(next); continue; } - else if (StrEquals(token, XINERAMA_CONFIG_STRING)) - { - FScreenConfigureModule(next); - } else if (StrEquals(token, "DesktopSize")) { token = PeekToken(next, &next); diff --git a/mvwm/modconf.c b/mvwm/modconf.c index 10e87e2..61208dc 100644 --- a/mvwm/modconf.c +++ b/mvwm/modconf.c @@ -241,13 +241,6 @@ void CMD_DestroyModuleConfig(F_CMD_ARGS) return; } -static void send_xinerama_state(fmodule *module) -{ - SendName(module, M_CONFIG_INFO, 0, 0, 0, FScreenGetConfiguration()); - - return; -} - static void send_desktop_names(fmodule *module) { struct monitor *m = monitor_get_current(); @@ -374,7 +367,6 @@ void CMD_Send_ConfigInfo(F_CMD_ARGS) /* send ImagePath and ColorLimit first */ send_image_path(mod); send_color_limit(mod); - send_xinerama_state(mod); send_colorsets(mod); send_click_time(mod); send_move_threshold(mod); commit 2f7c98e72cb21c733a9dc80479ad949e3ecafe04 Author: Thomas Adam <tho...@fvwm.org> Date: Fri Oct 17 18:52:30 2014 +0100 FScreen.c: Few style cleanups * Reduce spacing between operators; * Remove unnecessary else blocks by pre-initialising; * Some reindentation, etc. --- libs/FScreen.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/libs/FScreen.c b/libs/FScreen.c index 72059ad..c251dc7 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -74,7 +74,7 @@ monitor_new(void) { struct monitor *m; - m = calloc(1, sizeof *m); + m = mvwm_calloc(1, sizeof *m); return (m); } @@ -162,7 +162,6 @@ void FScreenInit(Display *dpy) fprintf(stderr, "Falling back to single screen...\n"); } - TAILQ_INIT(&monitor_q); global_monitor = monitor_new(); @@ -246,10 +245,8 @@ init_monitor_contents(struct monitor *m) m->virtual_scr.prev_desk_and_page_page_x = 0; m->virtual_scr.prev_desk_and_page_page_y = 0; - m->virtual_scr.EdgeScrollX = - DEFAULT_EDGE_SCROLL * m->coord.w / 100; - m->virtual_scr.EdgeScrollY = - DEFAULT_EDGE_SCROLL * m->coord.h / 100; + m->virtual_scr.EdgeScrollX = DEFAULT_EDGE_SCROLL * m->coord.w / 100; + m->virtual_scr.EdgeScrollY = DEFAULT_EDGE_SCROLL * m->coord.h / 100; } /* Intended to be called by modules. Simply pass in the parameter from the @@ -789,12 +786,12 @@ int FScreenGetGeometry( } if (1 /*flags & GravityValue*/ && grav != DEFAULT_GRAVITY) { - if (hints != NULL && hints->flags & PWinGravity) + if (hints != NULL && hints->flags & PWinGravity) { hints->win_gravity = grav; } } - if (hints != NULL && ret & XValue && ret & YValue) + if (hints != NULL && ret & XValue && ret & YValue) hints->flags |= USPosition; return ret; @@ -812,16 +809,14 @@ int FScreenGetGeometry( */ void FScreenMangleScreenIntoUSPosHints(fscreen_scr_t screen, XSizeHints *hints) { + hints->x = 0; + hints->y = 0; + if (hints->flags & USPosition) { hints->x = FSCREEN_MANGLE_USPOS_HINTS_MAGIC; hints->y = (short)screen; } - else - { - hints->x = 0; - hints->y = 0; - } return; } @@ -838,14 +833,13 @@ void FScreenMangleScreenIntoUSPosHints(fscreen_scr_t screen, XSizeHints *hints) */ int FScreenFetchMangledScreenFromUSPosHints(XSizeHints *hints) { - int screen; + int screen = 0; if ((hints->flags & USPosition) && hints->x == FSCREEN_MANGLE_USPOS_HINTS_MAGIC) { screen = hints->y; - } else - screen = 0; + } return screen; } commit 5beade0b9bc4717eb1985c9433419f0ca1fbf69d Author: Thomas Adam <tho...@fvwm.org> Date: Fri Oct 17 13:30:09 2014 +0100 Deprecate FindScreenOfXY() Move the functionality to monitor_by_xy() instead, and switch over the callers of FindScreenOfXY to it. Reduces the need for a transient function serving no purpose. --- libs/FScreen.c | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/libs/FScreen.c b/libs/FScreen.c index c7c5e13..72059ad 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -47,7 +47,6 @@ static Bool already_initialised; static Display *disp; static int no_of_screens; -static struct monitor *FindScreenOfXY(int x, int y); static struct monitor *monitor_new(void); static void init_monitor_contents(struct monitor *); static int monitor_should_ignore_global(struct monitor *); @@ -90,7 +89,7 @@ monitor_get_current(void) FQueryPointer(disp, DefaultRootWindow(disp), &JunkRoot, &JunkChild, &JunkX, &JunkY, &x, &y, &JunkMask); - return (FindScreenOfXY(x, y)); + return (monitor_by_xy(x, y)); } int @@ -129,7 +128,14 @@ monitor_by_name(const char *name) struct monitor * monitor_by_xy(int x, int y) { - return (FindScreenOfXY(x, y)); + struct monitor *m; + + TAILQ_FOREACH(m, &monitor_q, entry) { + if (x >= m->coord.x && x < m->coord.x + m->coord.w && + y >= m->coord.y && y < m->coord.y + m->coord.h) + break; + } + return (m); } void FScreenInit(Display *dpy) @@ -302,23 +308,6 @@ void FScreenSetDefaultModuleScreen(char *scr_spec) return; } - -static struct monitor * -FindScreenOfXY(int x, int y) -{ - struct monitor *m; - - TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; - if (x >= m->coord.x && x < m->coord.x + m->coord.w && - y >= m->coord.y && y < m->coord.y + m->coord.h) - return (m); - } - - return (NULL); -} - static struct monitor * FindScreen(fscreen_scr_arg *arg, fscreen_scr_t screen) { @@ -351,7 +340,7 @@ FindScreen(fscreen_scr_arg *arg, fscreen_scr_t screen) tmp.xypos.y = 0; arg = &tmp; } - m = FindScreenOfXY(arg->xypos.x, arg->xypos.y); + m = monitor_by_xy(arg->xypos.x, arg->xypos.y); break; case FSCREEN_BY_NAME: if (arg == NULL || arg->name == NULL) { @@ -380,7 +369,7 @@ FScreenOfPointerXY(int x, int y) { struct monitor *m; - m = FindScreenOfXY(x, y); + m = monitor_by_xy(x, y); return (m != NULL) ? m->name : "unknown"; } commit 61b486100eea77028c8fb5d591ffb00100562bf7 Author: Thomas Adam <tho...@fvwm.org> Date: Thu Oct 16 22:13:03 2014 +0100 Make monitor_should_ignore_global() static This function doesn't need to be public anymore; mark is as static. --- libs/FScreen.c | 1 + libs/FScreen.h | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/FScreen.c b/libs/FScreen.c index e3008bd..c7c5e13 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -50,6 +50,7 @@ static int no_of_screens; static struct monitor *FindScreenOfXY(int x, int y); static struct monitor *monitor_new(void); static void init_monitor_contents(struct monitor *); +static int monitor_should_ignore_global(struct monitor *); static void GetMouseXY(XEvent *eventp, int *x, int *y) { diff --git a/libs/FScreen.h b/libs/FScreen.h index 90fdb66..8f70167 100644 --- a/libs/FScreen.h +++ b/libs/FScreen.h @@ -69,7 +69,6 @@ struct monitor *global_monitor; struct monitor *monitor_get_current(void); struct monitor *monitor_by_name(const char *); struct monitor *monitor_by_xy(int, int); -int monitor_should_ignore_global(struct monitor *); #define FSCREEN_MANGLE_USPOS_HINTS_MAGIC ((short)-32109) commit c12782a981b7b40d2625449b3dcdcccd2941a027 Author: Thomas Adam <tho...@fvwm.org> Date: Thu Oct 16 22:10:18 2014 +0100 Remove callers of monitor_should_ignore_global() This is now handled internally, and hence there's no need for callers to understand this. --- mvwm/ewmh.c | 6 ------ mvwm/ewmh_conf.c | 2 -- mvwm/ewmh_events.c | 2 -- mvwm/move_resize.c | 5 ----- mvwm/mvwm.c | 2 -- mvwm/virtual.c | 10 +--------- 6 files changed, 1 insertion(+), 26 deletions(-) diff --git a/mvwm/ewmh.c b/mvwm/ewmh.c index d9e171b..4774018 100644 --- a/mvwm/ewmh.c +++ b/mvwm/ewmh.c @@ -938,9 +938,6 @@ void ewmh_SetWorkArea(void) int i = 0; TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; - if (m->Desktops == NULL) continue; @@ -1054,9 +1051,6 @@ void EWMH_UpdateWorkArea(void) struct monitor *m; TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; - ewmh_ComputeAndSetWorkArea(m); ewmh_HandleDynamicWorkArea(m); } diff --git a/mvwm/ewmh_conf.c b/mvwm/ewmh_conf.c index 170fd90..7555907 100644 --- a/mvwm/ewmh_conf.c +++ b/mvwm/ewmh_conf.c @@ -131,8 +131,6 @@ void CMD_EwmhNumberOfDesktops(F_CMD_ARGS) { ewmhc.NeedsToCheckDesk = True; TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; EWMH_SetNumberOfDesktops(m); } } diff --git a/mvwm/ewmh_events.c b/mvwm/ewmh_events.c index f5f6906..cbf8382 100644 --- a/mvwm/ewmh_events.c +++ b/mvwm/ewmh_events.c @@ -139,8 +139,6 @@ int ewmh_NumberOfDesktops(EWMH_CMD_ARGS) { ewmhc.NumberOfDesktops = d; TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; EWMH_SetNumberOfDesktops(m); } } diff --git a/mvwm/move_resize.c b/mvwm/move_resize.c index 796eeb6..3515032 100644 --- a/mvwm/move_resize.c +++ b/mvwm/move_resize.c @@ -4496,8 +4496,6 @@ static void MaximizeHeight( new_y2 = bottom_border; TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; for (cwin = Scr.MvwmRoot.next; cwin; cwin = cwin->next) { if (win->m != m) @@ -4577,9 +4575,6 @@ static void MaximizeWidth( new_x2 = right_border; TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; - for (cwin = Scr.MvwmRoot.next; cwin; cwin = cwin->next) { if (m != cwin->m) diff --git a/mvwm/mvwm.c b/mvwm/mvwm.c index c6bfc07..59aef61 100644 --- a/mvwm/mvwm.c +++ b/mvwm/mvwm.c @@ -2447,8 +2447,6 @@ int main(int argc, char **argv) struct monitor *mon; TAILQ_FOREACH(mon, &monitor_q, entry) { - if (monitor_should_ignore_global(mon)) - continue; EWMH_Init(mon); } DBUG("main", "Setting up rc file defaults..."); diff --git a/mvwm/virtual.c b/mvwm/virtual.c index 101d3cf..1d3a767 100644 --- a/mvwm/virtual.c +++ b/mvwm/virtual.c @@ -2106,8 +2106,6 @@ void CMD_DesktopSize(F_CMD_ARGS) } TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; m->virtual_scr.VxMax = (val[0] <= 0) ? 0: val[0]*m->coord.w - m->coord.w; m->virtual_scr.VyMax = (val[1] <= 0) ? @@ -2381,9 +2379,6 @@ void CMD_DesktopName(F_CMD_ARGS) /* The same name on all monitors... */ TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; - d = m->Desktops->next; while (d != NULL && d->desk != desk) { @@ -2463,11 +2458,8 @@ void CMD_DesktopName(F_CMD_ARGS) } BroadcastConfigInfoString(msg); free(msg); - TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; + TAILQ_FOREACH(m, &monitor_q, entry) EWMH_SetDesktopNames(m); - } } return; commit 662763e4602a35ae364cc237fe9584bc42088e9e Author: Thomas Adam <tho...@fvwm.org> Date: Thu Oct 16 22:08:40 2014 +0100 monitor_by_name: handle global_monitor Now that the global monitor is separate depending if XRandR is used, when querying for the global monitor, make sure we handle this case. --- libs/FScreen.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/FScreen.c b/libs/FScreen.c index 7339807..e3008bd 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -107,12 +107,21 @@ monitor_should_ignore_global(struct monitor *m) struct monitor * monitor_by_name(const char *name) { - struct monitor *m; + struct monitor *m = NULL; TAILQ_FOREACH(m, &monitor_q, entry) { if (strcmp(m->name, name) == 0) return (m); } + + /* If 'm' is still NULL here, and the monitor name is "global", return + * that monitor instead. This check can only succeed if we've requested + * the global screen whilst XRandR is in use, since the global monitor + * isn't stored in the monitor list directly. + */ + if (m == NULL && strcmp(name, "global") == 0) + return (global_monitor); + return (NULL); } commit 3fcbafe72bf773f202e9df0b604755be4361e481 Author: Thomas Adam <tho...@fvwm.org> Date: Thu Oct 16 22:04:24 2014 +0100 Redefine how the "global" monitor is stored Rather than making the "global" monitor part of the monitor queue in the case where XRandR is in use, instead only add the global monitor to the queue if XRandR isn't in use (and hence there's only ever one monitor). This means the callers don't need to worry, when querying monitors, about the global monitor since contextually, querying monitors is always going to be correct. If the global monitor is required, that can be queried in the same way it is now, and hence those existing callers don't need to change. In making this change, initialise the monitors when required, rather than based on whether they're in the main monitor_q or not; meaning no special-casing of the global monitor is needed to support initialisation. --- libs/FScreen.c | 98 +++++++++++++++++++++++++++++----------------------------- libs/FScreen.h | 3 +- 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/libs/FScreen.c b/libs/FScreen.c index 3e73437..7339807 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -49,7 +49,7 @@ static int no_of_screens; static struct monitor *FindScreenOfXY(int x, int y); static struct monitor *monitor_new(void); -static void init_monitor_contents(void); +static void init_monitor_contents(struct monitor *); static void GetMouseXY(XEvent *eventp, int *x, int *y) { @@ -149,16 +149,22 @@ void FScreenInit(Display *dpy) TAILQ_INIT(&monitor_q); - m = monitor_new(); - m->coord.x = 0; - m->coord.y = 0; - m->coord.w = DisplayWidth(disp, DefaultScreen(disp)); - m->coord.h = DisplayHeight(disp, DefaultScreen(disp)); - m->name = mvwm_strdup("global"); - TAILQ_INSERT_HEAD(&monitor_q, m, entry); - - if (!is_randr_present) + global_monitor = monitor_new(); + global_monitor->coord.x = 0; + global_monitor->coord.y = 0; + global_monitor->coord.w = DisplayWidth(disp, DefaultScreen(disp)); + global_monitor->coord.h = DisplayHeight(disp, DefaultScreen(disp)); + global_monitor->name = mvwm_strdup("global"); + + if (!is_randr_present) { + /* TA: 2014-09-16: We maintain a list of all monitors. If + * XRandR isn't present, then we put the global monitor in the + * list since it's the only screen available. + */ + init_monitor_contents(global_monitor); + TAILQ_INSERT_HEAD(&monitor_q, global_monitor, entry); goto done; + } /* XRandR is present, so query the screens we have. */ res = XRRGetScreenResources(dpy, DefaultRootWindow(dpy)); @@ -183,6 +189,8 @@ void FScreenInit(Display *dpy) m->coord.h = crtc->height; m->name = mvwm_strdup(oinfo->name); + init_monitor_contents(m); + TAILQ_INSERT_TAIL(&monitor_q, m, entry); XRRFreeCrtcInfo(crtc); @@ -191,49 +199,41 @@ void FScreenInit(Display *dpy) } done: already_initialised = 1; - init_monitor_contents(); } static void -init_monitor_contents(void) +init_monitor_contents(struct monitor *m) { - struct monitor *m = NULL; - - TAILQ_FOREACH(m, &monitor_q, entry) { - if (monitor_should_ignore_global(m)) - continue; - - m->Desktops = mvwm_calloc(1, sizeof(DesktopsInfo)); - m->Desktops->name = NULL; - m->Desktops->desk = 0; /* not desk 0 */ - m->Desktops->ewmh_dyn_working_area.x = - m->Desktops->ewmh_working_area.x = 0; - m->Desktops->ewmh_dyn_working_area.y = - m->Desktops->ewmh_working_area.y = 0; - m->Desktops->ewmh_dyn_working_area.width = - m->Desktops->ewmh_working_area.width = m->coord.w; - m->Desktops->ewmh_dyn_working_area.height = - m->Desktops->ewmh_working_area.height = m->coord.h; - m->Desktops->next = NULL; - - m->virtual_scr.CurrentDesk = 0; - m->virtual_scr.Vx = 0; - m->virtual_scr.Vy = 0; - m->virtual_scr.VxMax = 2 * m->coord.w; - m->virtual_scr.VyMax = 2 * m->coord.h; - - m->virtual_scr.prev_page_x = 0; - m->virtual_scr.prev_page_y = 0; - m->virtual_scr.prev_desk = 0; - m->virtual_scr.prev_desk_and_page_desk = 0; - m->virtual_scr.prev_desk_and_page_page_x = 0; - m->virtual_scr.prev_desk_and_page_page_y = 0; - - m->virtual_scr.EdgeScrollX = - DEFAULT_EDGE_SCROLL * m->coord.w / 100; - m->virtual_scr.EdgeScrollY = - DEFAULT_EDGE_SCROLL * m->coord.h / 100; - } + m->Desktops = mvwm_calloc(1, sizeof(DesktopsInfo)); + m->Desktops->name = NULL; + m->Desktops->desk = 0; /* not desk 0 */ + m->Desktops->ewmh_dyn_working_area.x = + m->Desktops->ewmh_working_area.x = 0; + m->Desktops->ewmh_dyn_working_area.y = + m->Desktops->ewmh_working_area.y = 0; + m->Desktops->ewmh_dyn_working_area.width = + m->Desktops->ewmh_working_area.width = m->coord.w; + m->Desktops->ewmh_dyn_working_area.height = + m->Desktops->ewmh_working_area.height = m->coord.h; + m->Desktops->next = NULL; + + m->virtual_scr.CurrentDesk = 0; + m->virtual_scr.Vx = 0; + m->virtual_scr.Vy = 0; + m->virtual_scr.VxMax = 2 * m->coord.w; + m->virtual_scr.VyMax = 2 * m->coord.h; + + m->virtual_scr.prev_page_x = 0; + m->virtual_scr.prev_page_y = 0; + m->virtual_scr.prev_desk = 0; + m->virtual_scr.prev_desk_and_page_desk = 0; + m->virtual_scr.prev_desk_and_page_page_x = 0; + m->virtual_scr.prev_desk_and_page_page_y = 0; + + m->virtual_scr.EdgeScrollX = + DEFAULT_EDGE_SCROLL * m->coord.w / 100; + m->virtual_scr.EdgeScrollY = + DEFAULT_EDGE_SCROLL * m->coord.h / 100; } /* Intended to be called by modules. Simply pass in the parameter from the diff --git a/libs/FScreen.h b/libs/FScreen.h index 624d8ab..90fdb66 100644 --- a/libs/FScreen.h +++ b/libs/FScreen.h @@ -63,7 +63,8 @@ struct monitor { }; TAILQ_HEAD(monitors, monitor); -struct monitors monitor_q; +struct monitors monitor_q; +struct monitor *global_monitor; struct monitor *monitor_get_current(void); struct monitor *monitor_by_name(const char *); commit 3c41d6630be62d7002a18a4cae9f1772dbd31b0b Author: Thomas Adam <tho...@fvwm.org> Date: Thu Oct 16 21:26:51 2014 +0100 Centralise check for global monitor Let montor_should_ignore_global() check for the presence of the global monitor, plus other configured monitors, and shift the check done in FScreenGetScrRect() to use that as well. --- libs/FScreen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/FScreen.c b/libs/FScreen.c index c0e7dbe..3e73437 100644 --- a/libs/FScreen.c +++ b/libs/FScreen.c @@ -99,7 +99,7 @@ monitor_should_ignore_global(struct monitor *m) * on the global screen, as that's separate to XY positioning * which is only concerned with the *specific* screen. */ - if (no_of_screens > 0 && strcmp(m->name, "global") == 0) + if (no_of_screens > 1 && strcmp(m->name, "global") == 0) return 1; return 0; } @@ -409,7 +409,7 @@ Bool FScreenGetScrRect(fscreen_scr_arg *arg, fscreen_scr_t screen, if (h) *h = m->coord.h; - return !((no_of_screens > 1) && (strcmp(m->name, "global") == 0)); + return !monitor_should_ignore_global(m); } /* Translates the coodinates *x *y from the screen specified by arg_src and commit 3eb3277f7f33deec412ab0204d8df7cc36d6a299 Author: Thomas Adam <tho...@fvwm.org> Date: Sun Sep 28 18:25:23 2014 +0100 Ident: Print monitor name selected window is on When using Ident to show information about a window, also print out the name of the monitor. --- modules/MvwmIdent/MvwmIdent.c | 5 +++++ modules/MvwmIdent/MvwmIdent.h | 1 + 2 files changed, 6 insertions(+) diff --git a/modules/MvwmIdent/MvwmIdent.c b/modules/MvwmIdent/MvwmIdent.c index 1ec8cd0..fbed360 100644 --- a/modules/MvwmIdent/MvwmIdent.c +++ b/modules/MvwmIdent/MvwmIdent.c @@ -394,6 +394,10 @@ void list_configure(unsigned long *body) { module->window = cfgpacket->frame; target.id = cfgpacket->w; + target.monitor_id = cfgpacket->monitor_id; + free(target.monitor); + target.monitor = mvwm_strdup(monitor_by_number( + (int)target.monitor_id)->name); target.frame = cfgpacket->frame; target.frame_x = cfgpacket->frame_x; target.frame_y = cfgpacket->frame_y; @@ -1145,6 +1149,7 @@ void MakeList(void) AddToList("Class:", target.class); AddToList("Resource:", target.res); AddToList("Window ID:", id); + AddToList("Monitor:", target.monitor); AddToList("Desk:", desktop); AddToList("Layer:", layer); AddToList("Width:", swidth); diff --git a/modules/MvwmIdent/MvwmIdent.h b/modules/MvwmIdent/MvwmIdent.h index e8cdf0c..a14fb1d 100644 --- a/modules/MvwmIdent/MvwmIdent.h +++ b/modules/MvwmIdent/MvwmIdent.h @@ -9,6 +9,7 @@ struct target_struct char class[256]; char name[256]; char icon_name[256]; + char *monitor; unsigned long id; unsigned long frame; long frame_x; commit 2d4f0d44334116f65a311b802d628e1b1d851cc6 Author: Thomas Adam <tho...@fvwm.org> Date: Sun Sep 28 18:20:58 2014 +0100 CONFIGARGS: Include the monitor name Augment the CONFIGARGS macro to also include the monitor name of the configured window. --- libs/vpacket.h | 1 + mvwm/module_interface.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libs/vpacket.h b/libs/vpacket.h index 0af7fa7..68502c2 100644 --- a/libs/vpacket.h +++ b/libs/vpacket.h @@ -30,6 +30,7 @@ typedef struct ConfigWinPacket unsigned long frame_width; unsigned long frame_height; unsigned long desk; + unsigned long monitor_id; /* Temp word for alignment - old flags used to be here. - remove before next release. diff --git a/mvwm/module_interface.c b/mvwm/module_interface.c index c98adfc..72cab06 100644 --- a/mvwm/module_interface.c +++ b/mvwm/module_interface.c @@ -300,7 +300,7 @@ action_flags *__get_allowed_actions(const MvwmWindow *fw) as a dummy to preserve alignment of the other fields in the old packet: we should drop this before the next release. */ -#define CONFIGARGS(_fw) 33, \ +#define CONFIGARGS(_fw) 34, \ (unsigned long)(-sizeof(Window)), \ &FW_W(*(_fw)), \ (unsigned long)(-sizeof(Window)), \ @@ -318,6 +318,8 @@ action_flags *__get_allowed_actions(const MvwmWindow *fw) (unsigned long)(0), \ &(*(_fw))->Desk, \ (unsigned long)(0), \ + &(*(_fw))->m->number, \ + (unsigned long)(0), \ &(*(_fw))->layer, \ (unsigned long)(0), \ &(*(_fw))->hints.base_width, \ commit 5c5fbdc2c0c512465f45d97aa4eaa2de0830380a Author: Thomas Adam <tho...@fvwm.org> Date: Thu Dec 4 01:04:47 2014 +0000 GetWorkAreaIntersection - fix for XRandR Don't cull the width/height of the intersection when the coords approach 0, as this is a legitimate offset for the boundaries of the next rectangle. --- mvwm/ewmh.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mvwm/ewmh.c b/mvwm/ewmh.c index 8efac3b..d9e171b 100644 --- a/mvwm/ewmh.c +++ b/mvwm/ewmh.c @@ -1094,13 +1094,18 @@ void EWMH_GetWorkAreaIntersection( } nx = max(*x, area_x); ny = max(*y, area_y); - nw = min(*x + *w, area_x + area_w) - nx; - nh = min(*y + *h, area_y + area_h) - ny; + nw = min(*x + *w, area_x + area_w); + nh = min(*y + *h, area_y + area_h); *x = nx; *y = ny; *w = nw; *h = nh; + if ((nw - nx) > 0) + *w = nw - nx; + if ((nh - ny) > 0) + *h = nh - ny; + return; } commit ef8a167c060dd5e11796d8cede948500b9bad9c0 Author: Thomas Adam <tho...@fvwm.org> Date: Thu Dec 4 00:18:17 2014 +0000 Sticky windows: Use global screen for repositioning When working out when to (re)position sticky windows, IsRectangleOnThisPage() currently assumes the coordinates to be Xinerama-like in the geometry translation. For now, assume this to be the global screen; rework of this to take place at a later date. --- mvwm/misc.c | 4 ++-- mvwm/move_resize.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mvwm/misc.c b/mvwm/misc.c index b6423ee..28703d9 100644 --- a/mvwm/misc.c +++ b/mvwm/misc.c @@ -527,9 +527,9 @@ Bool IsRectangleOnThisPage(struct monitor *m, const rectangle *rec, int desk) return (desk == m->virtual_scr.CurrentDesk && rec->x + (signed int)rec->width > 0 && - (rec->x > m->coord.x || rec->x < m->coord.w) && + (rec->x < 0 || rec->x < m->coord.w) && rec->y + (signed int)rec->height > 0 && - (rec->y > m->coord.y || rec->y < m->coord.h)) ? + (rec->y < 0 || rec->y < m->coord.h)) ? True : False; } diff --git a/mvwm/move_resize.c b/mvwm/move_resize.c index c12d043..796eeb6 100644 --- a/mvwm/move_resize.c +++ b/mvwm/move_resize.c @@ -5103,7 +5103,8 @@ int stick_across_pages(F_CMD_ARGS, int toggle) } else { - if (!IsRectangleOnThisPage(fw->m, &fw->g.frame, fw->m->virtual_scr.CurrentDesk)) + if (!IsRectangleOnThisPage(monitor_by_name("global"), + &fw->g.frame, fw->m->virtual_scr.CurrentDesk)) { action = ""; __move_window(F_PASS_ARGS, False, MOVE_PAGE); commit fb4e67175c495b95bc0d7efb02167839abd2a00b Author: Thomas Adam <tho...@fvwm.org> Date: Sun Nov 2 23:14:27 2014 +0000 IsRectangleOnThisPage(): Fix coord calcs When checking that a given rectagle is on a given page, ensure the monitor's x/y offets are taken into account. --- mvwm/misc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mvwm/misc.c b/mvwm/misc.c index 28703d9..b6423ee 100644 --- a/mvwm/misc.c +++ b/mvwm/misc.c @@ -527,9 +527,9 @@ Bool IsRectangleOnThisPage(struct monitor *m, const rectangle *rec, int desk) return (desk == m->virtual_scr.CurrentDesk && rec->x + (signed int)rec->width > 0 && - (rec->x < 0 || rec->x < m->coord.w) && + (rec->x > m->coord.x || rec->x < m->coord.w) && rec->y + (signed int)rec->height > 0 && - (rec->y < 0 || rec->y < m->coord.h)) ? + (rec->y > m->coord.y || rec->y < m->coord.h)) ? True : False; } ---------------------------------------------------------------- Diffstat: ---------------------------------------------------------------- libs/vpacket.h | 2 +- modules/MvwmIdent/MvwmIdent.c | 4 +++- mvwm/ewmh.c | 9 +++++++-- mvwm/module_interface.c | 4 ++-- mvwm/move_resize.c | 3 ++- 5 files changed, 15 insertions(+), 7 deletions(-) ----------------------------------------------------------------