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

Add a screen option to the Scroll command. #531

Merged
merged 1 commit into from
Jun 13, 2021
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
7 changes: 6 additions & 1 deletion doc/fvwm3/fvwm3.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7705,7 +7705,7 @@ GotoPage prev
GotoPage +2p -1p
....

*Scroll* [_horizonal_[p] _vertical_[p] | reverse]::
*Scroll* [screen RANDRNAME] [_horizonal_[p] _vertical_[p] | reverse]::
Scrolls the virtual desktop's viewport by _horizontal_ pages in the
x-direction and _vertical_ pages in the y-direction or starts
interactive scrolling of the viewport. Either or both entries may be
Expand Down Expand Up @@ -7763,6 +7763,11 @@ Mouse 1 A CM Scroll reverse
+
gives an effect of grabbing and dragging the viewport with button 1 if Control
and Meta is pressed.
+
If _screen_ is given, followed by the RANDRNAME of a given display, then
the specified screen is scrolled. This is only useful if using per-monitor
or shared _DesktopConfiguration_ and wanting to scroll a monitor other than
the current monitor. Interactive scrolling always scrolls the current monitor.

=== User Functions and Shell Commands

Expand Down
17 changes: 16 additions & 1 deletion fvwm/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -2706,13 +2706,28 @@ void CMD_Scroll(F_CMD_ARGS)
{
int x,y;
int val1, val2, val1_unit, val2_unit;
char *option;
struct monitor *m = monitor_get_current();

option = PeekToken(action, NULL);
if (StrEquals(option, "screen")) {
/* Skip literal 'screen' */
option = PeekToken(action, &action);
/* Actually get the screen value. */
option = PeekToken(action, &action);

m = monitor_resolve_name(option);
if (strcmp(m->si->name, option) != 0) {
fvwm_debug(__func__,
"Invalid screen: %s", option);
return;
}
}

if (GetTwoArguments(action, &val1, &val2, &val1_unit, &val2_unit) != 2)
{
/* less then two integer parameters implies interactive
* scroll check if we are scrolling in reverse direction */
char *option;
int scroll_speed = 1;

option = PeekToken(action, NULL);
Expand Down
8 changes: 5 additions & 3 deletions modules/FvwmPager/x_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static void do_scroll(int sx, int sy, Bool do_send_message,
static int psx = 0;
static int psy = 0;
static int messages_sent = 0;
char command[256];
char command[256], screen[32] = "";
psx+=sx;
psy+=sy;
if (is_message_recieved)
Expand All @@ -160,7 +160,9 @@ static void do_scroll(int sx, int sy, Bool do_send_message,
if ((do_send_message || messages_sent < MAX_UNPROCESSED_MESSAGES) &&
( psx != 0 || psy != 0 ))
{
sprintf(command, "Scroll %dp %dp", psx, psy);
if (monitor_to_track != NULL)
sprintf(screen, "screen %s", monitor_to_track);
sprintf(command, "Scroll %s %dp %dp", screen, psx, psy);
SendText(fd, command, 0);
messages_sent++;
SendText(fd, "Send_Reply ScrollDone", 0);
Expand Down Expand Up @@ -2411,7 +2413,7 @@ void Scroll(int window_w, int window_h, int x, int y, int Desk,
}
if (Wait == 0 || last_sx != sx || last_sy != sy)
{
do_scroll(sx, sy, False, False);
do_scroll(sx, sy, True, False);

/* Here we need to track the view offset on the desk. */
/* sx/y are are pixels on the screen to scroll. */
Expand Down