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: present overview of all monitors if "Monitor:" is not used #978

Merged
merged 41 commits into from
Mar 29, 2024

Conversation

ThomasAdam
Copy link
Member

This adds per-monitor support to FvwmPager, in that if a pager isn't tracking a single monitor, the pager (and icon pager) will now highlight just the portion of the virtual desktop being viewed by each monitor. When using left click to move to a location in the pager, this will move the appropriate monitor to view the area, allowing one to control the monitors locations independently in a single page. The pager can also be used to move windows between monitors with middle click.

ThomasAdam and others added 21 commits March 25, 2024 21:14
Now that FvwmPager initialises its copy of libfvwm3, we cannot rely
globally on the value of monitor_mode, as this is updated in the parent
process, which modules can only ever be made aware of by asking for it.

Broadcast a change of DesktopConfiguration when this is set via
SendConfig_Info().
  This splits the current view port highlight window from a single
  window per desk, to a single window per monitor per desk. The result
  is that the highlight can follow individual monitors, useful when
  using DesktopConfiguration per-monitor or shared. When using
  DesktopConfiguration global, the view port of all monitors changes,
  resulting in a single view port as before, with one minor difference,
  if the monitors combined do not form a full rectangle, due to
  different sizes, the resulting view port will show the exact space
  the monitors are actually viewing.

  In addition when use FvwmPager with DesktopConfiguration per-montior
  and not showing a single monitor, clicking in the area on the pager
  will move only the monitor that would view the point you clicked.

  Combined this allows FvwmPager in per-monitor mode to be able to
  show what each monitor is viewing and move monitors individually
  around the virtual pages and desks.
When showing the pager, do so only for that monitor of monitor_to_track
is set.
  Update the IconView of FvwmPager to allow independent placement
  of each monitor's active view port. This also updates the
  PagerWindow struct to use rectangles for pager_view and icon_view.
When DesktopConfiguration is per-monitor, do nothing when clicking
on desk titles or dead areas (not covered by any monitor) since it
cannot be determined which monitor to move.

In global mode, clicks on titles and dead area still function.
Now that FvwmPager initialises its copy of libfvwm3, we cannot rely
globally on the value of monitor_mode, as this is updated in the parent
process, which modules can only ever be made aware of by asking for it.

Broadcast a change of DesktopConfiguration when this is set via
SendConfig_Info().
When a new monitor is enabled, refresh the list of monitors from fvwm
and update its view of the monitor's dimensions.
When sending down changes to modules about monitors, do so via a
separate CONFIG_INFO packet, but do this only when we're sending down
all changes, so that any on-going CONFIG_INFo packets are not
interrupted.
Listen for Monitor information coming from fvwm, and update FvwmPager's
understanding.
Factor out some of the logic in initializer_pager() which is common;
should help reduce complexity.
Fvwm will send down the XServer's changes for when resolutions change,
and FvwmPager must now store these values for its internal use.
When sending down the list of monitors, also issue a DesktopSize command
to force M_NEW_PAGE to FvwmPager.

This isn't ideal, but can be changed to DesktopSize being sent as a
M_CONFIG_INFO line, if performance is hit.
When FvwmPager reads new monitor configuration, refresh the list of
windows it knows about.
This ensures that fpmonitors are added and removed properly when
adding/removing monitors via RandR. This also removes fpmonitors
from the TAILQ list if they are disabled.
For consistency, use rename monitor_() for function to use fpmonitor_().
  ReConfigure calls ReConfigureAll and is more meant for geometry
  changes, which changing monitors basically is. Also call ReConfigure
  with any monitor change, just to be safe.
When updating windows as to which desk they're on, don't send out a
change of monitor to modules, as this won't have changed.
When handling new monitors, there's two situations where we need to
remove the MONITOR_NEW flag:

1.  When we're done at init time.
2.  When we're done during runtime.

This change shifts the logic to handle that.
The location of negative x,y coordinates need to be shifted instead of
mirrored (absolute value).
@ThomasAdam ThomasAdam added type:bug Something's broken! type:enhancement Augmenting an existing feature type:breaking Issue is not backwards-compatible and will break configs/build relates:module Issue is in module code labels Mar 29, 2024
@ThomasAdam ThomasAdam added this to the 1.1.0 milestone Mar 29, 2024
somiaj and others added 3 commits March 29, 2024 17:34
Fvwm will send M_NEW_PAGE events on disabled monitors, which
monitor_by_output would then fall back to RB_MIN. This causes
FvwmPager to incorrectly set the virtual screen, so double
check the correct monitor was returned, otherwise bail.

This also fixes an issue where list_new_page would not send
the correct monitor number to list_new_desk.
monitor_by_output() currently never returns NULL, so don't test for it.
When working with a PagerWindow, get the monitor for the window in
question, not some fallback monitor. This fixes a few instances of
windows appearing in the wrong location.

Add a catch in CalcGeom to ensure a monitor is not NULL.
ThomasAdam and others added 15 commits March 29, 2024 17:34
This is already handled elsewhere, and we don't want to keep sending the
same information each time.
A new Move prefix 'v' was added, which allows coordinates to be
specified relative to the virtual screen with (0,0) the top left
corner. This is best used with the 'p' suffix, so you can state
the exact location to move in the virtual screen vs relative
to a specific monitor. This is mostly meant to be used from
FvwmPager.

Update FvwmPager to use the new 'v' prefix when Moving windows.
This makes it so no longer does FvwmPager need to worry about
which monitor the move command is relative too. This fixes
moving windows around the pager on different desks.
When FvwmPager is configured to track a specific monitor, allow
the desk label to switch desks.
The desk title window and window initial position/size should not be
based off the view port size, instead use the desk and label size.
This optimization might not be needed and with the plan to add
monitor labels the logic is a bit to much for any possible gain.

Removing the code for now.
When sending the monitor list to modules, also send down the value of
is_tracking_shared, so that FvwmPager can track this.
FvwmPager can now better deal with DesktopConfiguration shared.
It now understand is_tracking_shared and will show the correct
location of windows and monitors in this mode. In addition clicks
to the pager will be ignored, unless clicking in a desk occupied
by a monitor. In that case the current monitor occupying the desk
will move to the page clicked.

In order to be able to move through desks and pages in shared
mode a new feature MonitorLabels was added. This will print a row
of current monitors under the desk labels. Each monitor label
acts as a button and will move the monitor to the desktop the
button was clicked in. This works in any mode, but when in shared
mode this is the only way to move monitors between desktops
reliably.
This adds two new options DeskLabels and NoDeskLabels to FvwmPager to
allow turning on/off the desk labels. In addition this simplifies the
logic for testing if labels are shown and allows one to configure
showing only desk labels, only monitor labels, no labels, or both desk
and monitor labels.
  When using DesktopConfiguration share, make sure the correct monitor
  is identified when scrolling on a desk that a monitor is currently
  viewing.  When scrolling on the icon view, only scroll a monitor
  in the clicked area if that monitor is currently viewing the same
  desk as the pager (in other words don't scroll a monitor on a
  different desk).
  If *FvwmPager: Monitor is set to a valid monitor, the MonitorLabels
  will now only show the single monitor being tracked.
When calculating the rectangle we want to use, check fp is NULL
otherwise FvwmPager would crash trying to dereference a NULL
value.
The fallback labels are for small buttons, make these smaller.

This makes the fallback label for a monitor its fvwm pager's
monitor number, and the fall back label for a desk "D%d", which
is the desk number prepended with "D" to distinguish desk labels
from monitor labels.
If CalcGeom isn't sent a valid monitor or is sent a monitor
different than the one being tracked, the default rectangle
is returned. Place this default rectangle off the screen like
is done with other windows.
This was never doing anything for "Monitor", as this was being handled
by looking at the module resource lines, instead.
Jaimos Skriletz and others added 2 commits March 29, 2024 21:13
  fpmonitor_from_xy(x, y), will now return NULL if no monitor is found
  (and a single monitor is not being tracked, and global mode isn't used).
Even though "m" will be set, still explicitly set it to NULL upon
initialisation, so that GCC is kept happy.
@ThomasAdam ThomasAdam force-pushed the ta/fvwmpager-monitor-mode branch from b4d1323 to eee3462 Compare March 29, 2024 21:29
@ThomasAdam ThomasAdam merged commit 9e106d7 into main Mar 29, 2024
5 checks passed
@ThomasAdam ThomasAdam deleted the ta/fvwmpager-monitor-mode branch March 29, 2024 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
relates:module Issue is in module code type:breaking Issue is not backwards-compatible and will break configs/build type:bug Something's broken! type:enhancement Augmenting an existing feature
Projects
Status: Done
2 participants