Skip to content

Commit

Permalink
Do XFilterEvent globally.
Browse files Browse the repository at this point in the history
  • Loading branch information
gijsbers committed Jun 16, 2024
1 parent b55b094 commit 93161db
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 19 deletions.
10 changes: 2 additions & 8 deletions src/yinputline.cc
Original file line number Diff line number Diff line change
Expand Up @@ -905,19 +905,13 @@ void YInputLine::gotFocus() {
XNClientWindow, handle(),
XNFocusWindow, handle(),
nullptr);
if (inputContext == nullptr) {
if (ONCE)
warn("Cannot create input context with XCreateIC");
} else {
if (inputContext) {
unsigned long mask = None;
const char* name = XGetICValues(inputContext,
XNFilterEvents, &mask, nullptr);
if (name) {
warn("XGetICValues fails for %s", name);
} else if (mask) {
if (name == nullptr && mask) {
addEventMask(mask);
}
eventFiltering(true);
}
}
if (inputContext) {
Expand Down
4 changes: 0 additions & 4 deletions src/ywindow.cc
Original file line number Diff line number Diff line change
Expand Up @@ -565,10 +565,6 @@ void YWindow::raiseTo(YWindow* inferior) {
}

void YWindow::handleEvent(const XEvent &event) {
if (hasbit(flags, wfFiltering) &&
XFilterEvent(const_cast<XEvent*>(&event), fHandle))
return;

switch (event.type) {
case KeyPress:
case KeyRelease:
Expand Down
5 changes: 0 additions & 5 deletions src/ywindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,6 @@ class YWindow : protected YWindowList, private YWindowNode {

void unmanageWindow() { removeWindow(); }

protected:
void eventFiltering(bool f) { if (f) flags |= wfFiltering;
else flags &= ~wfFiltering; }

private:
enum WindowFlags {
wfVisible = 1 << 0,
Expand All @@ -304,7 +300,6 @@ class YWindow : protected YWindowList, private YWindowNode {
wfToplevel = 1 << 4,
wfNullSize = 1 << 5,
wfFocused = 1 << 6,
wfFiltering = 1 << 7,
};

Window create();
Expand Down
6 changes: 4 additions & 2 deletions src/yxapp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,8 @@ void YXApplication::dispatchEvent(YWindow *win, XEvent &xev) {
if (fGrabTree && w == fXGrabWindow)
break;
}
} else if (win->destroyed() == false) {
} else if (win->destroyed() == false ||
xev.type == DestroyNotify || xev.type == UnmapNotify) {
Window child;

if (xev.type == MotionNotify) {
Expand Down Expand Up @@ -1173,7 +1174,6 @@ bool YXApplication::handleXEvents() {
#ifdef DEBUG
xeventcount++;
#endif
//msg("%d", xev.type);

saveEventTime(xev);

Expand All @@ -1193,6 +1193,8 @@ bool YXApplication::handleXEvents() {
#endif
}
#endif
if (XFilterEvent(&xev, None))
continue;

if (filterEvent(xev)) {
} else {
Expand Down

0 comments on commit 93161db

Please sign in to comment.