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

1.10 - mouse transparency not work #158

Closed
akorop opened this issue Oct 24, 2015 · 3 comments
Closed

1.10 - mouse transparency not work #158

akorop opened this issue Oct 24, 2015 · 3 comments
Assignees

Comments

@akorop
Copy link
Contributor

akorop commented Oct 24, 2015

x11.cc contains very important innovation in the init_window function: setting the null input shape for the typical conky window. This code seems the sane, but it has no effect on the my computer on the reasons unknown to me. A similar code, placed just before the main event loop (conky.cc) work fine. Also the windows other then 'normal' type must have null input shape.
Thus I propose the patch following

From d8d034f24154d08dfe558feccddfbed312d727d4 Mon Sep 17 00:00:00 2001
From: Alexey Korop <avkorop@i.ua>
Date: Sat, 24 Oct 2015 11:55:30 +0300
Subject: Mouse transparency fix


diff --git a/src/conky.cc b/src/conky.cc
index b48fd7c..025ed20 100644
--- a/src/conky.cc
+++ b/src/conky.cc
@@ -60,6 +60,9 @@
 #ifdef BUILD_IMLIB2
 #include "imlib2.h"
 #endif /* BUILD_IMLIB2 */
+#ifdef BUILD_XSHAPE
+#include <X11/extensions/shape.h>
+#endif /* BUILD_XSHAPE */
 #endif /* BUILD_X11 */
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -2042,6 +2045,21 @@ static void main_loop(void)
    sigaddset(&newmask, SIGUSR1);
 #endif

+#ifdef BUILD_XSHAPE
+   /* allow only decorated windows to be given mouse input */
+   int major_version, minor_version;
+   if (!XShapeQueryVersion(display, &major_version, &minor_version)) {
+       NORM_ERR("Input shapes are not supported");
+   } else {
+       if (own_window.get(*state) &&
+           (own_window_type.get(*state) != TYPE_NORMAL ||
+            (TEST_HINT(own_window_hints.get(*state), HINT_UNDECORATED)))) {
+           XShapeCombineRectangles(display, window.window, ShapeInput, 0, 0,
+              NULL, 0, ShapeSet, Unsorted);
+       }
+   }
+#endif /* BUILD_XSHAPE */
+
    last_update_time = 0.0;
    next_update_time = get_time();
    info.looped = 0;
diff --git a/src/x11.cc b/src/x11.cc
index 48f5197..15db872 100644
--- a/src/x11.cc
+++ b/src/x11.cc
@@ -47,10 +47,6 @@
 #ifdef BUILD_XFT
 #include <X11/Xft/Xft.h>
 #endif
-#ifdef BUILD_XSHAPE
-#include <X11/extensions/shape.h>
-#include <X11/extensions/shapeconst.h>
-#endif

 #ifdef BUILD_ARGB
 bool have_argb_visual;
@@ -716,26 +712,6 @@ static void init_window(lua::state &l __attribute__((unused)), bool own)

            wmHint.flags = InputHint | StateHint;
            /* allow decorated windows to be given input focus by WM */
-           wmHint.input =
-               TEST_HINT(hints, HINT_UNDECORATED) ? False : True;
-#ifdef BUILD_XSHAPE
-           if (!wmHint.input) {
-               int event_base, error_base;
-               if (XShapeQueryExtension(display, &event_base, &error_base)) {
-                   int major_version = 0, minor_version = 0;
-                   XShapeQueryVersion(display, &major_version, &minor_version);
-                   if ((major_version > 1) || ((major_version == 1) && (minor_version >=1))) {
-                       Region empty_region = XCreateRegion();
-                       XShapeCombineRegion(display, window.window, ShapeInput, 0, 0, empty_region, ShapeSet);
-                       XDestroyRegion(empty_region);
-                   } else {
-                       NORM_ERR("Input shapes are not supported");
-                   }
-               } else {
-                   NORM_ERR("No shape extension found");
-               }
-           }
-#endif
            if (own_window_type.get(l) == TYPE_DOCK || own_window_type.get(l) == TYPE_PANEL) {
                wmHint.initial_state = WithdrawnState;
            } else {
@akorop akorop changed the title Mouse transparency not work 1.10 - mouse transparency not work Oct 24, 2015
@lasers
Copy link
Contributor

lasers commented Aug 6, 2018

2 years, 10 months passed. Do you still need this feature? Let us know. Thanks.

@su8
Copy link
Collaborator

su8 commented Aug 30, 2018

@lasers The code has been added:

conky/src/conky.cc

Lines 2026 to 2041 in ebc624c

#ifdef BUILD_XSHAPE
if (out_to_x.get(*state)) {
/* allow only decorated windows to be given mouse input */
int major_version, minor_version;
if (XShapeQueryVersion(display, &major_version, &minor_version) == 0) {
NORM_ERR("Input shapes are not supported");
} else {
if (own_window.get(*state) &&
(own_window_type.get(*state) != TYPE_NORMAL ||
((TEST_HINT(own_window_hints.get(*state), HINT_UNDECORATED)) !=
0))) {
XShapeCombineRectangles(display, window.window, ShapeInput, 0, 0,
nullptr, 0, ShapeSet, Unsorted);
}
}
}

@lasers
Copy link
Contributor

lasers commented Aug 30, 2018

Closed via #213.

@lasers lasers closed this as completed Aug 30, 2018
@lasers lasers assigned su8 and unassigned su8 Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants