The following shows the diffstat and patchsets between
2fa0e60..1031ad8^
----------------------------------------------------------------
commit 1031ad8df9e81e7eceb61bc796a1ed8547ebb8c5
Author: Thomas Adam <[email protected]>
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 34704fd0b8bbf462e286cc5da6af7480ab017ddd
Author: Thomas Adam <[email protected]>
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 | 2 ++
2 files changed, 7 insertions(+)
diff --git a/modules/MvwmIdent/MvwmIdent.c b/modules/MvwmIdent/MvwmIdent.c
index f781c49..93839d3 100644
--- a/modules/MvwmIdent/MvwmIdent.c
+++ b/modules/MvwmIdent/MvwmIdent.c
@@ -387,6 +387,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;
@@ -1134,6 +1138,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..a4c0d23 100644
--- a/modules/MvwmIdent/MvwmIdent.h
+++ b/modules/MvwmIdent/MvwmIdent.h
@@ -9,8 +9,10 @@ struct target_struct
char class[256];
char name[256];
char icon_name[256];
+ char *monitor;
unsigned long id;
unsigned long frame;
+ long monitor_id;
long frame_x;
long frame_y;
long frame_w;
commit 7bc4eb3433304e848aaaacccdcf2044c6663723e
Author: Thomas Adam <[email protected]>
Date: Sun Sep 28 18:20:58 2014 +0100
CONFIGARGS: Include the monitor number
Augment the CONFIGARGS macro to also include the monitor number of the
configured window. This will allow modules to easily ascertain monitor
information without the need to mangle a pointer to some struct montor *.
---
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 16ef1b8..627a7ec 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 4a64584a6e6334d812ce66262291a88e55aab605
Author: Thomas Adam <[email protected]>
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 b4fa767..4722ccb 100644
--- a/libs/FScreen.h
+++ b/libs/FScreen.h
@@ -33,6 +33,7 @@ typedef enum
struct monitor {
char *name;
+ int number;
struct {
int x;
int y;
@@ -76,6 +77,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 81c844bd09c8c3331615d461437cb8a2ac426009
Author: Thomas Adam <[email protected]>
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 c98adfc..16ef1b8 100644
--- a/mvwm/module_interface.c
+++ b/mvwm/module_interface.c
@@ -626,18 +626,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 d53f0c81b5844b21f695dd2448cfb963f69657db
Author: Thomas Adam <[email protected]>
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 80b8330..b4fa767 100644
--- a/libs/FScreen.h
+++ b/libs/FScreen.h
@@ -83,10 +83,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 1ec8cd0..f781c49 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);
}
@@ -557,10 +550,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 6b8ecd9becc3d0de0a07208302a86bf98efb6bd2
Author: Thomas Adam <[email protected]>
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 278e7794aadbf2519fd73c554d19ed57a318110e
Author: Thomas Adam <[email protected]>
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 ff6a56c1c06b7165a6fa945d0ace8bdf121f22a8
Author: Thomas Adam <[email protected]>
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 0b2b09b..80b8330 100644
--- a/libs/FScreen.h
+++ b/libs/FScreen.h
@@ -76,7 +76,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 9c3f657df8862a11ebe1c2ca87e16c9ebf69c860
Author: Thomas Adam <[email protected]>
Date: Sun Dec 21 15:09:45 2014 +0000
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_conf.c | 6 ------
mvwm/ewmh_events.c | 3 ---
mvwm/move_resize.c | 5 -----
mvwm/mvwm.c | 2 --
mvwm/virtual.c | 10 +---------
5 files changed, 1 insertion(+), 25 deletions(-)
diff --git a/mvwm/ewmh_conf.c b/mvwm/ewmh_conf.c
index dc7d8d1..542f77d 100644
--- a/mvwm/ewmh_conf.c
+++ b/mvwm/ewmh_conf.c
@@ -137,9 +137,6 @@ void CMD_EwmhNumberOfDesktops(F_CMD_ARGS)
}
TAILQ_FOREACH(m, &monitor_q, entry) {
- if (monitor_should_ignore_global(m))
- continue;
-
set_ewmhc_desktop_values(m, num, val);
}
@@ -181,9 +178,6 @@ void CMD_EwmhBaseStruts(F_CMD_ARGS)
}
TAILQ_FOREACH(m, &monitor_q, entry) {
- if (monitor_should_ignore_global(m))
- continue;
-
set_ewmhc_strut_values(m, val);
}
}
diff --git a/mvwm/ewmh_events.c b/mvwm/ewmh_events.c
index 000ca8f..6faee9e 100644
--- a/mvwm/ewmh_events.c
+++ b/mvwm/ewmh_events.c
@@ -136,9 +136,6 @@ int ewmh_NumberOfDesktops(EWMH_CMD_ARGS)
/* not a lot of sinification for mvwm */
TAILQ_FOREACH(m, &monitor_q, entry) {
- if (monitor_should_ignore_global(m))
- continue;
-
EWMH_SetNumberOfDesktops(m);
if (d > 0 &&
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 228131d9834d1b4a05e1e0ede3d316524b6282f2
Author: Thomas Adam <[email protected]>
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 2055cce17ae007348e9ecc4ed98188c2b9af0ba3
Author: Thomas Adam <[email protected]>
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 5129b1a..0b2b09b 100644
--- a/libs/FScreen.h
+++ b/libs/FScreen.h
@@ -70,7 +70,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 b90ef74478e39428f67401d340e8a2784525ad59
Author: Thomas Adam <[email protected]>
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
----------------------------------------------------------------
Diffstat:
----------------------------------------------------------------
TODO | 2 +
libs/FScreen.c | 236 ++++++++++++++++----------------------
libs/FScreen.h | 10 +-
libs/vpacket.h | 1 +
modules/MvwmButtons/MvwmButtons.c | 4 -
modules/MvwmButtons/parse.c | 5 -
modules/MvwmIconMan/mvwm.c | 4 -
modules/MvwmIconMan/readconfig.c | 7 --
modules/MvwmIdent/MvwmIdent.c | 16 +--
modules/MvwmIdent/MvwmIdent.h | 2 +
modules/MvwmPager/MvwmPager.c | 8 --
mvwm/ewmh_conf.c | 6 -
mvwm/ewmh_events.c | 3 -
mvwm/modconf.c | 8 --
mvwm/module_interface.c | 16 +--
mvwm/move_resize.c | 5 -
mvwm/mvwm.c | 2 -
mvwm/virtual.c | 43 +++----
18 files changed, 132 insertions(+), 246 deletions(-)
----------------------------------------------------------------