mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-16 10:05:22 +00:00
Debug X11 enter & leave events
Fix import derps Signed-off-by: Tin <tin.svagelj@live.com>
This commit is contained in:
parent
5d5e235467
commit
bf900545c0
@ -27,9 +27,7 @@
|
|||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
#include <x11.h>
|
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
#include "display-x11.hh"
|
|
||||||
#pragma GCC diagnostic push
|
#pragma GCC diagnostic push
|
||||||
#pragma GCC diagnostic ignored "-Wvariadic-macros"
|
#pragma GCC diagnostic ignored "-Wvariadic-macros"
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
@ -42,7 +40,7 @@
|
|||||||
#endif /* BUILD_XDAMAGE */
|
#endif /* BUILD_XDAMAGE */
|
||||||
#include "fonts.h"
|
#include "fonts.h"
|
||||||
#ifdef BUILD_IMLIB2
|
#ifdef BUILD_IMLIB2
|
||||||
#include <imlib2.h>
|
#include "imlib2.h"
|
||||||
#endif /* BUILD_IMLIB2 */
|
#endif /* BUILD_IMLIB2 */
|
||||||
#ifdef BUILD_MOUSE_EVENTS
|
#ifdef BUILD_MOUSE_EVENTS
|
||||||
#include "mouse-events.h"
|
#include "mouse-events.h"
|
||||||
@ -56,13 +54,16 @@
|
|||||||
|
|
||||||
#include "colours.h"
|
#include "colours.h"
|
||||||
#include "conky.h"
|
#include "conky.h"
|
||||||
|
#include "display-x11.hh"
|
||||||
#include "gui.h"
|
#include "gui.h"
|
||||||
#include "llua.h"
|
#include "llua.h"
|
||||||
#include "logging.h"
|
|
||||||
|
|
||||||
/* TODO: cleanup global namespace */
|
/* TODO: cleanup global namespace */
|
||||||
#ifdef BUILD_X11
|
#ifdef BUILD_X11
|
||||||
|
|
||||||
|
#include "x11.h"
|
||||||
|
#include "logging.h"
|
||||||
|
|
||||||
// TODO: cleanup externs (move to conky.h ?)
|
// TODO: cleanup externs (move to conky.h ?)
|
||||||
#ifdef OWN_WINDOW
|
#ifdef OWN_WINDOW
|
||||||
extern int fixed_size, fixed_pos;
|
extern int fixed_size, fixed_pos;
|
||||||
@ -234,19 +235,17 @@ inline void propagate_unconsumed_event(XEvent &ev, bool is_consumed) {
|
|||||||
// SAFETY: XEvent is a union and all event types this function gets called for
|
// SAFETY: XEvent is a union and all event types this function gets called for
|
||||||
// share same alignment and accessed fields share same offsets.
|
// share same alignment and accessed fields share same offsets.
|
||||||
if (!is_consumed) {
|
if (!is_consumed) {
|
||||||
XUngrabPointer(display, ev.xmotion.time);
|
|
||||||
|
|
||||||
/* forward the event to the desktop window */
|
/* forward the event to the desktop window */
|
||||||
ev.xmotion.window = window.desktop;
|
ev.xmotion.window = window.desktop;
|
||||||
ev.xmotion.x = ev.xmotion.x_root;
|
ev.xmotion.x = ev.xmotion.x_root;
|
||||||
ev.xmotion.y = ev.xmotion.y_root;
|
ev.xmotion.y = ev.xmotion.y_root;
|
||||||
XSendEvent(display, window.desktop, False, capture_mask, &ev);
|
XSendEvent(display, window.desktop, False, capture_mask, &ev);
|
||||||
if (ev.type == ButtonPress) {
|
if (false && ev.type == ButtonPress) {
|
||||||
XSetInputFocus(display, window.desktop, RevertToNone, ev.xmotion.time);
|
XSetInputFocus(display, window.desktop, RevertToNone, ev.xmotion.time);
|
||||||
|
} else if (false && ev.type == MotionNotify) {
|
||||||
|
XSetInputFocus(display, window.window, RevertToParent, ev.xmotion.time);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
XGrabPointer(display, window.window, TRUE, capture_mask,
|
|
||||||
GrabModeAsync, GrabModeAsync, window.window, None, ev.xbutton.time);
|
|
||||||
XSetInputFocus(display, window.window, RevertToParent, ev.xmotion.time);
|
XSetInputFocus(display, window.window, RevertToParent, ev.xmotion.time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -572,15 +571,17 @@ bool display_output_x11::main_loop_wait(double t) {
|
|||||||
XUngrabPointer(display, ev.xcrossing.time);
|
XUngrabPointer(display, ev.xcrossing.time);
|
||||||
case EnterNotify:
|
case EnterNotify:
|
||||||
{
|
{
|
||||||
bool not_over_conky = ev.xcrossing.x_root < window.x || ev.xcrossing.y_root < window.y ||
|
bool not_over_conky = ev.xcrossing.x_root <= window.x || ev.xcrossing.y_root <= window.y ||
|
||||||
ev.xcrossing.x_root > window.x + window.width || ev.xcrossing.y_root > window.y + window.height;
|
ev.xcrossing.x_root >= window.x + window.width || ev.xcrossing.y_root >= window.y + window.height;
|
||||||
|
static bool pointer_inside = false;
|
||||||
|
|
||||||
if ((not_over_conky && ev.xcrossing.type == LeaveNotify) ||
|
if ((not_over_conky && ev.xcrossing.type == LeaveNotify) ||
|
||||||
(!not_over_conky && ev.xcrossing.type == EnterNotify)) {
|
(!pointer_inside && ev.xcrossing.type == EnterNotify)) {
|
||||||
llua_mouse_hook(mouse_crossing_event(
|
llua_mouse_hook(mouse_crossing_event(
|
||||||
ev.xcrossing.type == EnterNotify ? mouse_event_t::AREA_ENTER: mouse_event_t::AREA_LEAVE,
|
ev.xcrossing.type == EnterNotify ? mouse_event_t::AREA_ENTER: mouse_event_t::AREA_LEAVE,
|
||||||
ev.xcrossing.x, ev.xcrossing.y, ev.xcrossing.x_root, ev.xcrossing.y_root
|
ev.xcrossing.x, ev.xcrossing.y, ev.xcrossing.x_root, ev.xcrossing.y_root
|
||||||
));
|
));
|
||||||
|
pointer_inside = ev.xcrossing.type == EnterNotify;
|
||||||
// can't propagate these events in a way that makes sense
|
// can't propagate these events in a way that makes sense
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user