kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=34f007d0880322a25bff8313987fbae16e6bab72

commit 34f007d0880322a25bff8313987fbae16e6bab72
Author: Kim Woelders <[email protected]>
Date:   Sat Apr 16 11:22:23 2022 +0200

    Add window option to pass-through pointer events
---
 src/ewin-ops.c |  1 +
 src/ewin-ops.h |  3 ++-
 src/ewins.h    |  1 +
 src/ipc.c      |  7 +++++++
 src/x.c        | 25 ++++++++++++++++++++++++-
 src/xwin.h     |  4 +++-
 6 files changed, 38 insertions(+), 3 deletions(-)

diff --git a/src/ewin-ops.c b/src/ewin-ops.c
index bdd63c93..ee07e2c8 100644
--- a/src/ewin-ops.c
+++ b/src/ewin-ops.c
@@ -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},
diff --git a/src/ewin-ops.h b/src/ewin-ops.h
index e8d85c39..8f9991f4 100644
--- a/src/ewin-ops.h
+++ b/src/ewin-ops.h
@@ -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,
diff --git a/src/ewins.h b/src/ewins.h
index 548b5e6b..156e5407 100644
--- a/src/ewins.h
+++ b/src/ewins.h
@@ -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) 
*/
diff --git a/src/ipc.c b/src/ipc.c
index 85afd8f0..be5dfb7f 100644
--- a/src/ipc.c
+++ b/src/ipc.c
@@ -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);
diff --git a/src/x.c b/src/x.c
index c16555fe..51db8e67 100644
--- a/src/x.c
+++ b/src/x.c
@@ -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)
diff --git a/src/xwin.h b/src/xwin.h
index d4763dcf..22e454ac 100644
--- a/src/xwin.h
+++ b/src/xwin.h
@@ -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);

-- 


Reply via email to