Add window option to pass-through pointer events

This commit is contained in:
Kim Woelders 2022-04-16 11:22:23 +02:00
parent edd9216610
commit 34f007d088
6 changed files with 38 additions and 3 deletions

View File

@ -90,6 +90,7 @@ static const WinOp winops[] = {
{"no_button_grabs", 0, 1, 1, EWIN_OP_NO_BUTTON_GRABS},
{"skiplists", 4, 1, 1, EWIN_OP_SKIP_LISTS},
{"autoshade", 0, 1, 1, EWIN_OP_AUTOSHADE},
{"pass_ptr", 0, 1, 1, EWIN_OP_PASS_POINTER},
{"no_app_focus", 0, 1, 1, EWIN_OP_INH_APP_FOCUS},
{"no_app_move", 0, 1, 1, EWIN_OP_INH_APP_MOVE},

View File

@ -35,8 +35,8 @@ typedef enum {
EWIN_OP_ALONE,
EWIN_OP_SHADE,
EWIN_OP_STICK,
EWIN_OP_FOCUS,
EWIN_OP_PIN,
EWIN_OP_FOCUS,
EWIN_OP_DESK,
EWIN_OP_AREA,
@ -66,6 +66,7 @@ typedef enum {
EWIN_OP_NO_BUTTON_GRABS,
EWIN_OP_SKIP_LISTS,
EWIN_OP_AUTOSHADE,
EWIN_OP_PASS_POINTER,
EWIN_OP_INH_APP_FOCUS,
EWIN_OP_INH_APP_MOVE,

View File

@ -155,6 +155,7 @@ struct _ewin {
unsigned no_button_grabs:1;
unsigned autoshade:1; /* Autoshade on mouse in/out */
unsigned no_argb:1; /* Do not use ARGB frame */
unsigned pass_pointer:1; /* Pass thru pointer events */
/* Derived from other properties */
unsigned no_border:1; /* Never apply border (MWM/netwm type) */

View File

@ -856,6 +856,13 @@ IpcWinop(const WinOp * wop, EWin * ewin, const char *prm)
}
goto ewin_update_snap_flags;
case EWIN_OP_PASS_POINTER:
on = ewin->props.pass_pointer;
SetEwinBoolean(wop->name, &on, param1, 1);
ewin->props.pass_pointer = on;
EWindowPassPointer(EoGetWin(ewin), on);
goto ewin_update_snap_flags;
case EWIN_OP_INH_APP_FOCUS:
on = EwinInhGetApp(ewin, focus);
SetEwinBoolean(wop->name, &on, param1, 1);

25
src/x.c
View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2021 Kim Woelders
* Copyright (C) 2004-2022 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -1567,6 +1567,29 @@ EWindowGetShapePixmapInverted(Win win)
return _EWindowGetShapePixmap(win, 0, 1);
}
void
EWindowPassPointer(Win win, int pass)
{
XRectangle r;
if (pass)
{
/* Set input shape to none */
XShapeCombineRectangles(disp, win->xwin, ShapeInput, 0,
0, NULL, 0, ShapeSet, Unsorted);
}
else
{
/* Set input shape to default */
r.x = r.y = 0;
r.width = win->w;
r.height = win->h;
XShapeCombineRectangles(disp, win->xwin, ShapeInput, 0,
0, &r, 1, ShapeSet, Unsorted);
}
}
EX_Pixmap
ECreatePixmap(Win win, unsigned int width, unsigned int height,
unsigned int depth)

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2021 Kim Woelders
* Copyright (C) 2004-2022 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -222,6 +222,8 @@ int EShapeCheck(Win win);
EX_Pixmap EWindowGetShapePixmap(Win win);
EX_Pixmap EWindowGetShapePixmapInverted(Win win);
void EWindowPassPointer(Win win, int pass);
void EWarpPointer(Win win, int x, int y);
int EQueryPointer(Win win, int *px, int *py,
EX_Window * pchild, unsigned int *pmask);