Skip to content

Commit

Permalink
Make FQueryPointer a void function.
Browse files Browse the repository at this point in the history
  There should be no reason this function should ever return false,
  now that fvwm will always occupy all screens. Remove the extra logic
  checking around this function and make it a void function.
  • Loading branch information
somiaj authored and ThomasAdam committed Mar 29, 2024
1 parent 3a79be9 commit e421d6c
Show file tree
Hide file tree
Showing 19 changed files with 156 additions and 418 deletions.
28 changes: 7 additions & 21 deletions fvwm/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -2250,12 +2250,8 @@ void CMD_CursorMove(F_CMD_ARGS)
fvwm_debug(__func__, "CursorMove needs 2 arguments");
return;
}
if (FQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild,
&x, &y, &JunkX, &JunkY, &JunkMask) == False)
{
/* pointer is on a different screen */
return;
}
FQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild,
&x, &y, &JunkX, &JunkY, &JunkMask);

m = monitor_get_current();

Expand Down Expand Up @@ -3808,14 +3804,9 @@ static void _fake_event(F_CMD_ARGS, FakeEventType type)
depth++)
{
w = child_w;
if (FQueryPointer(
FQueryPointer(
dpy, w, &root, &child_w,
&rx, &ry, &x, &y,
&JunkMask) == False)
{
/* pointer is on a different
* screen - that's okay here */
}
&rx, &ry, &x, &y, &JunkMask);
}

if (type == FakeMouseEvent)
Expand Down Expand Up @@ -3900,14 +3891,9 @@ static void _fake_event(F_CMD_ARGS, FakeEventType type)
}

usleep(1000 * val);
if (FQueryPointer(
dpy, Scr.Root, &root, &JunkRoot,
&JunkX, &JunkY, &JunkX, &JunkY,
&mask) == False)
{
/* pointer is on a different screen -
* that's okay here */
}
FQueryPointer(
dpy, Scr.Root, &root, &JunkRoot,
&JunkX, &JunkY, &JunkX, &JunkY, &mask);
break;
case 6:
case 7:
Expand Down
20 changes: 5 additions & 15 deletions fvwm/conditional.c
Original file line number Diff line number Diff line change
Expand Up @@ -1272,14 +1272,9 @@ static void direction_cmd(F_CMD_ARGS, Bool is_scan)
}
else
{
if (FQueryPointer(
FQueryPointer(
dpy, Scr.Root, &JunkRoot, &JunkChild, &my_g.x,
&my_g.y, &JunkX, &JunkY, &JunkMask) == False)
{
/* pointer is on a different screen */
my_g.x = 0;
my_g.y = 0;
}
&my_g.y, &JunkX, &JunkY, &JunkMask);
my_g.width = 1;
my_g.height = 1;
my_cx = my_g.x;
Expand Down Expand Up @@ -2249,15 +2244,10 @@ void CMD_Test(F_CMD_ARGS)

if (!error)
{
if (FQueryPointer(
FQueryPointer(
dpy, Scr.Root, &JunkRoot, &win,
&JunkX, &JunkY, &x, &y, &JunkMask)
== False)
{
/* pointer is on a different screen */
match = 0;
}
else if (is_pan_frame(win))
&JunkX, &JunkY, &x, &y, &JunkMask);
if (is_pan_frame(win))
{
if (dir == DIR_NONE ||
(dir == DIR_N &&
Expand Down
39 changes: 15 additions & 24 deletions fvwm/events.c
Original file line number Diff line number Diff line change
Expand Up @@ -1372,18 +1372,18 @@ static Bool _test_for_motion(int x0, int y0)
/* However, some special mouse (e.g., a touchpad with the
* synaptic driver) may handle a double click in a special way
* (for dragging through short touching and holding down the
* finger on the touchpad). Bascially, when you execute a
* finger on the touchpad). Basically, when you execute a
* double click the first button release is queued after the
* second _physical_ mouse release happen. It seems that
* FQueryPointer may not work as expected: it does not see
* that the button is released on a double click. So, we need
* to check for a button press in the future to avoid a fvwm
* second _physical_ mouse release happen. So, we need to
* check for a button press in the future to avoid a fvwm
* lockup! (olicha 2004-01-31) */

for (x = x0, y = y0; FQueryPointer(
dpy, Scr.Root, &JunkRoot, &JunkChild, &JunkX, &JunkY,
&x, &y, &mask) == True; usleep(20000))
for (x = x0, y = y0; True; usleep(20000))
{
FQueryPointer(
dpy, Scr.Root, &JunkRoot, &JunkChild, &JunkX, &JunkY,
&x, &y, &mask);

if ((mask & DEFAULT_ALL_BUTTONS_MASK) == 0)
{
/* all buttons are released */
Expand All @@ -1408,7 +1408,7 @@ static Bool _test_for_motion(int x0, int y0)
}
}

/* pointer has moved off screen */
/* This won't happen */
return True;
}

Expand Down Expand Up @@ -4591,17 +4591,16 @@ void CoerceEnterNotifyOnCurrentWindow(void)
{
Window child;
Window root;
Bool f;
evh_args_t ea;
exec_context_changes_t ecc;
XEvent e;
FvwmWindow *fw;

f = FQueryPointer(
FQueryPointer(
dpy, Scr.Root, &root, &child, &e.xcrossing.x_root,
&e.xcrossing.y_root, &e.xcrossing.x, &e.xcrossing.y,
&JunkMask);
if (f == False || child == None)
if (child == None)
{
return;
}
Expand Down Expand Up @@ -4691,11 +4690,8 @@ void WaitForButtonsUp(Bool do_handle_expose)
int use_wait_cursor;
XEvent e;

if (FQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild, &JunkX, &JunkY,
&JunkX, &JunkY, &mask) == False)
{
/* pointer is on a different screen - that's okay here */
}
FQueryPointer(dpy, Scr.Root, &JunkRoot, &JunkChild, &JunkX, &JunkY,
&JunkX, &JunkY, &mask);
mask &= DEFAULT_ALL_BUTTONS_MASK;
if (mask == 0)
{
Expand Down Expand Up @@ -4732,14 +4728,9 @@ void WaitForButtonsUp(Bool do_handle_expose)
}
else
{
if (FQueryPointer(
FQueryPointer(
dpy, Scr.Root, &JunkRoot, &JunkChild,
&JunkX, &JunkY, &JunkX, &JunkY, &mask) ==
False)
{
/* pointer is on a different screen - that's
* okay here */
}
&JunkX, &JunkY, &JunkX, &JunkY, &mask);
mask &= DEFAULT_ALL_BUTTONS_MASK;
usleep(1);
}
Expand Down
8 changes: 2 additions & 6 deletions fvwm/expand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,12 +1164,8 @@ static signed int expand_vars_extended(
case VAR_POINTER_CX:
is_x = True;
}
if (FQueryPointer(dpy, context_w, &JunkRoot, &JunkChild,
&JunkX, &JunkY, &x, &y, &JunkMask) == False)
{
/* pointer is on a different screen, don't expand */
return -1;
}
FQueryPointer(dpy, context_w, &JunkRoot, &JunkChild,
&JunkX, &JunkY, &x, &y, &JunkMask);
val = (is_x) ? x : y;
break;
case VAR_POINTER_SCREEN:
Expand Down
8 changes: 2 additions & 6 deletions fvwm/focus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1041,13 +1041,9 @@ void focus_grab_buttons_on_pointer_window(void)
Window w;
FvwmWindow *fw;

if (!FQueryPointer(
FQueryPointer(
dpy, Scr.Root, &JunkRoot, &w, &JunkX, &JunkY, &JunkX,
&JunkY, &JunkMask))
{
/* pointer is not on this screen */
return;
}
&JunkY, &JunkMask);
if (XFindContext(dpy, w, FvwmContext, (caddr_t *) &fw) == XCNOENT)
{
/* pointer is not over a window */
Expand Down
9 changes: 2 additions & 7 deletions fvwm/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1120,14 +1120,9 @@ static void execute_complex_function(
FCheckMaskEvent(dpy, ButtonPressMask, &d);
break;
default:
if (FQueryPointer(
FQueryPointer(
dpy, Scr.Root, &JunkRoot, &JunkChild, &x, &y,
&JunkX, &JunkY, &JunkMask) == False)
{
/* pointer is on a different screen */
x = 0;
y = 0;
}
&JunkX, &JunkY, &JunkMask);
button = 0;
break;
}
Expand Down
26 changes: 6 additions & 20 deletions fvwm/menubindings.c
Original file line number Diff line number Diff line change
Expand Up @@ -530,17 +530,10 @@ void menu_shortcuts(
&menu_height, &JunkBW, &JunkDepth))
{
is_geometry_known = 1;
if (
FQueryPointer(
FQueryPointer(
dpy, Scr.Root, &JunkRoot, &JunkChild,
&mx, &my, &JunkX, &JunkY, &JunkMask) ==
0)
{
/* pointer is on a different screen */
mx = 0;
my = 0;
}
else if (
&mx, &my, &JunkX, &JunkY, &JunkMask);
if (
mx >= menu_x && mx < menu_x + menu_width &&
my >= menu_y && my < menu_y + menu_height)
{
Expand Down Expand Up @@ -1024,16 +1017,9 @@ void menu_shortcuts(
pmret->rc = MENU_NEWITEM;
/* Have to work with relative positions or tear off
* menus will be hard to reposition */
if (
FQueryPointer(
dpy, MR_WINDOW(mr), &JunkRoot,
&JunkChild, &JunkX, &JunkY, &mx, &my,
&JunkMask) == 0)
{
/* This should not happen */
mx = 0;
my = 0;
}
FQueryPointer(
dpy, MR_WINDOW(mr), &JunkRoot,
&JunkChild, &JunkX, &JunkY, &mx, &my, &JunkMask);

if (MST_MOUSE_WHEEL(mr) == MMW_POINTER)
{
Expand Down
Loading

0 comments on commit e421d6c

Please sign in to comment.