Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FvwmRearrange overhaul #1081

Merged
merged 4 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
388 changes: 281 additions & 107 deletions doc/FvwmRearrange.adoc

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions fvwm/ewmh.c
Original file line number Diff line number Diff line change
Expand Up @@ -2064,3 +2064,26 @@ void EWMH_fullscreen(FvwmWindow *fw)

return;
}

boundingbox
get_ewmhc_boundingbox(struct monitor *m)
{
boundingbox r = {0};
int left = 0, right = 0, top = 0, bottom = 0;

EWMH_UpdateWorkArea(m);

left = m->Desktops->ewmh_working_area.x;
right = m->si->w - left -
m->Desktops->ewmh_working_area.width;
top = m->Desktops->ewmh_working_area.y;
bottom = m->si->h - top -
m->Desktops->ewmh_working_area.height;

r.left = left;
r.right = right;
r.top = top;
r.bottom = bottom;

return r;
}
3 changes: 2 additions & 1 deletion fvwm/ewmh.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ void EWMH_ExitStuff(void);

/* ewmh_conf.c */
void set_ewmhc_strut_values(struct monitor *, int *);
boundingbox get_ewmhc_boundingbox(struct monitor *);

/* ewmh_events.c */
Bool EWMH_ProcessClientMessage(const exec_context_t *exc);
Expand All @@ -79,4 +80,4 @@ int EWMH_WMIconName(
void EWMH_SetDesktopNames(struct monitor *);
void EWMH_fullscreen(FvwmWindow *fw);

#endif /* FVWM_EWMH_H */
#endif /* FVWM_EWMH_H */
8 changes: 1 addition & 7 deletions fvwm/modconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,7 @@ void CMD_Send_ConfigInfo(F_CMD_ARGS)
int match_len = 0;
fmodule *mod = exc->m.module;

/* Don't send the monitor list when a module asks for its
* configuration... in this case, fvwm -> module could get in an
* infinite loop, continually telling that module the same
* information over and over.
*
* send_monitor_list(mod);
*/
send_monitor_list(mod);
/* send ImagePath and ColorLimit first */
send_image_path(mod);
send_color_limit(mod);
Expand Down
9 changes: 7 additions & 2 deletions fvwm/module_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "geometry.h"
#include "libs/fvwmsignal.h"
#include "decorations.h"
#include "ewmh.h"
#include "commands.h"

/* A queue of commands from the modules */
Expand Down Expand Up @@ -480,17 +481,21 @@ static
void send_monitor_info(fmodule *send)
{
struct monitor *m;
boundingbox r;
const char *m_info;
char *name;

m_info = "Monitor %s %d %d %d %d %d %d %d %d %d %d";
m_info = "Monitor %s %d %d %d %d %d %d %d %d %d %d %d %d %d %d";

RB_FOREACH(m, monitors, &monitor_q) {
r = get_ewmhc_boundingbox(m);
xasprintf(&name, m_info, m->si->name, m->flags,
m->dx, m->dy, m->virtual_scr.Vx,
m->virtual_scr.Vy, m->virtual_scr.VxMax,
m->virtual_scr.VyMax, m->virtual_scr.CurrentDesk,
monitor_get_all_widths(), monitor_get_all_heights());
monitor_get_all_widths(), monitor_get_all_heights(),
r.left, r.right, r.top, r.bottom
);

SendName(send, M_CONFIG_INFO, 0, 0, 0, name);
free(name);
Expand Down
29 changes: 11 additions & 18 deletions fvwm/move_resize.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ static void move_to_next_monitor(
FvwmWindow *fw, rectangle *win_r, bool ewmh, direction_t dir)
{
position page;
boundingbox r = {0};
struct monitor *m;
int x1, x2, y1, y2; /* Working area bounds */
int left = 0, right = 0, top = 0, bottom = 0;
int check_vert = 0, check_hor = 0;

get_page_offset_check_visible(&page.x, &page.y, fw);
Expand All @@ -298,49 +298,42 @@ static void move_to_next_monitor(
if (fw->m == m)
continue;

if (ewmh) {
EWMH_UpdateWorkArea(m);
left = m->Desktops->ewmh_working_area.x;
right = m->si->w - left -
m->Desktops->ewmh_working_area.width;
top = m->Desktops->ewmh_working_area.y;
bottom = m->si->h - top -
m->Desktops->ewmh_working_area.height;
}
if (ewmh)
r = get_ewmhc_boundingbox(m);

if (dir == DIR_N && m->si->y + m->si->h == fw->m->si->y &&
win_r->x < m->si->x + m->si->w &&
win_r->x + win_r->width > m->si->x)
{
check_hor = 1;
win_r->y = m->si->y + m->si->h - win_r->height - bottom;
win_r->y = m->si->y + m->si->h - win_r->height - r.bottom;
}
else if (dir == DIR_E && m->si->x == fw->m->si->x +
fw->m->si->w && win_r->y < m->si->y + m->si->h &&
win_r->y + win_r->height > m->si->y)
{
check_vert = 1;
win_r->x = m->si->x + left;
win_r->x = m->si->x + r.left;
}
else if (dir == DIR_S && m->si->y == fw->m->si->y +
fw->m->si->h && win_r->x < m->si->x + m->si->w &&
win_r->x + win_r->width > m->si->x)
{
check_hor = 1;
win_r->y = m->si->y + top;
win_r->y = m->si->y + r.top;
}
else if (dir == DIR_W && m->si->x + m->si->w == fw->m->si->x &&
win_r->y < m->si->y + m->si->h &&
win_r->y + win_r->height > m->si->y)
{
check_vert = 1;
win_r->x = m->si->x + m->si->w - win_r->width - right;
win_r->x = m->si->x + m->si->w - win_r->width - r.right;
}
if (check_hor || check_vert) {
x1 = m->si->x + left;
y1 = m->si->y + top;
x2 = x1 + m->si->w - right;
y2 = y1 + m->si->h - bottom;
x1 = m->si->x + r.left;
y1 = m->si->y + r.top;
x2 = x1 + m->si->w - r.right;
y2 = y1 + m->si->h - r.bottom;
break;
}
}
Expand Down
10 changes: 9 additions & 1 deletion libs/fvwmrect.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ typedef struct
int height;
} rectangle;

typedef struct
{
int top;
int bottom;
int left;
int right;
} boundingbox;

typedef struct
{
int x;
Expand Down Expand Up @@ -58,4 +66,4 @@ int fvwmrect_move_into_rectangle(
int fvwmrect_intersect_xrectangles(
XRectangle *r1, XRectangle *r2);

#endif /* FVWMLIB_FVWMRECT_H */
#endif /* FVWMLIB_FVWMRECT_H */
5 changes: 3 additions & 2 deletions modules/FvwmPager/messages.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ void set_desk_label(int desk, const char *label)
void parse_monitor_line(char *tline)
{
int dx, dy, Vx, Vy, VxMax, VyMax, CurrentDesk;
int bs_top, bs_bottom, bs_left, bs_right;
int scr_width, scr_height;
int flags;
char *mname;
Expand All @@ -763,9 +764,9 @@ void parse_monitor_line(char *tline)

tline = GetNextToken(tline, &mname);

sscanf(tline, "%d %d %d %d %d %d %d %d %d %d", &flags,
sscanf(tline, "%d %d %d %d %d %d %d %d %d %d %d %d %d %d", &flags,
&dx, &dy, &Vx, &Vy, &VxMax, &VyMax, &CurrentDesk,
&scr_width, &scr_height);
&scr_width, &scr_height, &bs_left, &bs_right, &bs_top, &bs_bottom);

monitor_refresh_module(dpy);

Expand Down
Loading
Loading