Skip to content

Commit

Permalink
EWMH: Update SetWorkArea() to use global screen
Browse files Browse the repository at this point in the history
When computing the NET_WORKAREA, do so from the global screen (total
area), and let that repeat for all desktops defined.

Fixes #779
  • Loading branch information
ThomasAdam committed Apr 1, 2023
1 parent d61963f commit 35c6933
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
26 changes: 6 additions & 20 deletions fvwm/ewmh.c
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ void EWMH_SetClientListStacking(struct monitor *m)

void ewmh_SetWorkArea(struct monitor *m)
{
struct monitor *m_global = monitor_get_global();
long val[256][4]; /* no more than 256 desktops */
int i = 0;

Expand All @@ -991,17 +992,15 @@ void ewmh_SetWorkArea(struct monitor *m)

while(i < m->ewmhc.NumberOfDesktops && i < 256)
{
val[i][0] = m->Desktops->ewmh_working_area.x;
val[i][1] = m->Desktops->ewmh_working_area.y;
val[i][2] = m->Desktops->ewmh_working_area.width;
val[i][3] = m->Desktops->ewmh_working_area.height;
val[i][0] = m_global->si->x;
val[i][1] = m_global->si->y;
val[i][2] = m_global->si->w;
val[i][3] = m_global->si->h;
i++;
}
ewmh_ChangeProperty(
Scr.Root, "_NET_WORKAREA", EWMH_ATOM_LIST_FVWM_ROOT,
(unsigned char *)&val, i*4);

return;
}

void ewmh_ComputeAndSetWorkArea(struct monitor *m)
Expand All @@ -1013,8 +1012,6 @@ void ewmh_ComputeAndSetWorkArea(struct monitor *m)
int x,y,width,height;
FvwmWindow *fw;

/* FIXME: needs broadcast if global monitor in use. */

for (fw = Scr.FvwmRoot.next; fw != NULL; fw = fw->next)
{
if (fw->m != m)
Expand Down Expand Up @@ -1060,8 +1057,6 @@ void ewmh_ComputeAndSetWorkArea(struct monitor *m)
{
fvwm_debug(__func__, "differ, so setting work area\n");
}

ewmh_SetWorkArea(m);
}

return;
Expand All @@ -1076,8 +1071,6 @@ void ewmh_HandleDynamicWorkArea(struct monitor *m)
int x,y,width,height;
FvwmWindow *fw;

/* FIXME: needs broadcast if global monitor in use. */

for (fw = Scr.FvwmRoot.next; fw != NULL; fw = fw->next)
{
if (fw->m != m)
Expand Down Expand Up @@ -1146,8 +1139,6 @@ void EWMH_GetWorkAreaIntersection(
m->si->name, *x, *y, *w, *h);
}

/* FIXME: needs broadcast if global monitor in use. */

switch(type)
{
case EWMH_IGNORE_WORKING_AREA:
Expand Down Expand Up @@ -1223,8 +1214,6 @@ float ewmh_GetStrutIntersection(struct monitor *m,
float ret = 0;
int x21, y21, x22, y22;

/* FIXME: possibly need to consider using m->si->x/y/w/h */

/* left */
x21 = 0;
y21 = 0;
Expand Down Expand Up @@ -1271,8 +1260,6 @@ float EWMH_GetStrutIntersection(struct monitor *m,
{
int left, right, top, bottom;

/* FIXME: needs broadcast if global monitor in use. */

left = m->Desktops->ewmh_working_area.x;
right = monitor_get_all_widths() -
(m->Desktops->ewmh_working_area.x
Expand Down Expand Up @@ -1983,7 +1970,6 @@ void EWMH_Init(struct monitor *m)
EWMH_SetDesktopGeometry(m);
EWMH_SetClientList(m);
EWMH_SetClientListStacking(m);
ewmh_ComputeAndSetWorkArea(m);

return;
}
Expand Down Expand Up @@ -2085,4 +2071,4 @@ void EWMH_fullscreen(FvwmWindow *fw)
}

return;
}
}
2 changes: 2 additions & 0 deletions fvwm/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "module_list.h"
#include "focus.h"
#include "ewmh.h"
#include "ewmh_intern.h"
#include "move_resize.h"
#include "borders.h"
#include "frame.h"
Expand Down Expand Up @@ -2434,6 +2435,7 @@ void CMD_DesktopConfiguration(F_CMD_ARGS)
update:
initPanFrames();
raisePanFrames();
ewmh_SetWorkArea(m);

for (t = Scr.FvwmRoot.next; t; t = t->next)
update_fvwm_monitor(t);
Expand Down
2 changes: 2 additions & 0 deletions libs/FScreen.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ void FScreenInit(Display *dpy)
is_tracking_shared = false;

TAILQ_FOREACH(m, &monitor_q, entry) {
memset(&m->ewmhc, 0, sizeof(m->ewmhc));

m->Desktops = fxcalloc(1, sizeof *m->Desktops);
m->Desktops->name = NULL;
m->Desktops->next = NULL;
Expand Down

0 comments on commit 35c6933

Please sign in to comment.