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

FvwmPager: add fpmonitor impls for widths/heights #886

Merged
merged 1 commit into from
Sep 3, 2023
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
10 changes: 10 additions & 0 deletions modules/FvwmPager/FvwmPager.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,17 @@ fpmonitor_by_output(int output)
return (NULL);
}

int
fpmonitor_get_all_widths(void)
{
return (DisplayWidth(dpy, DefaultScreen(dpy)));
}

int
fpmonitor_get_all_heights(void)
{
return (DisplayHeight(dpy, DefaultScreen(dpy)));
}

struct fpmonitor *
fpmonitor_this(void)
Expand Down
2 changes: 2 additions & 0 deletions modules/FvwmPager/FvwmPager.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ struct fpmonitor *fpmonitor_by_name(const char *);
struct fpmonitor *fpmonitor_by_output(int);
struct fpmonitor *fpmonitor_get_current(void);
struct fpmonitor *fpmonitor_this(void);
int fpmonitor_get_all_widths(void);
int fpmonitor_get_all_heights(void);

typedef struct ScreenInfo
{
Expand Down
16 changes: 8 additions & 8 deletions modules/FvwmPager/x_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ fvwmrec_to_pager(rectangle *rec, bool is_icon)
{
struct fpmonitor *mon = fpmonitor_this();

int m_width = monitor_get_all_widths();
int m_height = monitor_get_all_heights();
int m_width = fpmonitor_get_all_widths();
int m_height = fpmonitor_get_all_heights();
if (monitor_to_track != NULL) {
/* Offset window location based on monitor location. */
rec->x -= (m_width - mon->w) * (rec->x / m_width) + mon->x;
Expand Down Expand Up @@ -486,8 +486,8 @@ pagerrec_to_fvwm(rectangle *rec, bool is_icon)
{
struct fpmonitor *mon = fpmonitor_this();

int m_width = monitor_get_all_widths();
int m_height = monitor_get_all_heights();
int m_width = fpmonitor_get_all_widths();
int m_height = fpmonitor_get_all_heights();
int offset_x = 0, offset_y = 0;

int scale_w = desk_w, scale_h = desk_h;
Expand Down Expand Up @@ -667,8 +667,8 @@ void initialize_pager(void)
/* Set window size if not fully set by user to match */
/* aspect ratio of monitor(s) being shown. */
if ( pwindow.width == 0 || pwindow.height == 0 ) {
int vWidth = monitor_get_all_widths();
int vHeight = monitor_get_all_heights();
int vWidth = fpmonitor_get_all_widths();
int vHeight = fpmonitor_get_all_heights();
if (monitor_to_track != NULL) {
vWidth = mon->w;
vHeight = mon->h;
Expand Down Expand Up @@ -716,11 +716,11 @@ void initialize_pager(void)
if (xneg)
{
sizehints.win_gravity = NorthEastGravity;
pwindow.x = monitor_get_all_widths() - pwindow.width + pwindow.x;
pwindow.x = fpmonitor_get_all_widths() - pwindow.width + pwindow.x;
}
if (yneg)
{
pwindow.y = monitor_get_all_heights() - pwindow.height + pwindow.y;
pwindow.y = fpmonitor_get_all_heights() - pwindow.height + pwindow.y;
if(sizehints.win_gravity == NorthEastGravity)
sizehints.win_gravity = SouthEastGravity;
else
Expand Down