Conky: 1.10 - 마우슀 투λͺ…도가 μž‘λ™ν•˜μ§€ μ•ŠμŒ

에 λ§Œλ“  2015λ…„ 10μ›” 24일  Β·  3μ½”λ©˜νŠΈ  Β·  좜처: brndnmtthws/conky

x11.cc μ—λŠ” init_window κΈ°λŠ₯μ—μ„œ 맀우 μ€‘μš”ν•œ ν˜μ‹ μ΄ ν¬ν•¨λ˜μ–΄ μžˆμŠ΅λ‹ˆλ‹€. 즉, 일반적인 conky 창에 λŒ€ν•΄ null μž…λ ₯ λͺ¨μ–‘을 μ„€μ •ν•©λ‹ˆλ‹€. 이 μ½”λ“œλŠ” μ œμ •μ‹ μ΄ μ•„λ‹Œ κ²ƒμ²˜λŸΌ λ³΄μ΄μ§€λ§Œ λ‚΄κ°€ μ•Œμ§€ λͺ»ν•˜λŠ” 이유둜 λ‚΄ μ»΄ν“¨ν„°μ—λŠ” 영ν–₯을 λ―ΈμΉ˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. 메인 이벀트 루프(conky.cc) λ°”λ‘œ μ•žμ— 배치된 μœ μ‚¬ν•œ μ½”λ“œλŠ” 잘 μž‘λ™ν•©λ‹ˆλ‹€. λ˜ν•œ '일반' μœ ν˜•μ΄ μ•„λ‹Œ λ‹€λ₯Έ 창은 null μž…λ ₯ λͺ¨μ–‘을 κ°€μ Έμ•Ό ν•©λ‹ˆλ‹€.
λ”°λΌμ„œ λ‹€μŒ 패치λ₯Ό μ œμ•ˆν•©λ‹ˆλ‹€.

From d8d034f24154d08dfe558feccddfbed312d727d4 Mon Sep 17 00:00:00 2001
From: Alexey Korop <[email protected]>
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 {

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

@lasers μ½”λ“œκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€:

https://github.com/brndnmtthws/conky/blob/ebc624c855c030ad0dd2075a9db7a03e7612bc38/src/conky.cc#L2026 -L2041

λͺ¨λ“  3 λŒ“κΈ€

2λ…„ 10κ°œμ›”μ΄ 지났닀. 이 κΈ°λŠ₯이 μ—¬μ „νžˆ ν•„μš”ν•©λ‹ˆκΉŒ? μ•Œλ €μ£Όμ‹­μ‹œμ˜€. 감사 ν•΄μš”.

@lasers μ½”λ“œκ°€ μΆ”κ°€λ˜μ—ˆμŠ΅λ‹ˆλ‹€:

https://github.com/brndnmtthws/conky/blob/ebc624c855c030ad0dd2075a9db7a03e7612bc38/src/conky.cc#L2026 -L2041

#213을 톡해 νμ‡„λ˜μ—ˆμŠ΅λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰