From 54a1cd0d17c431e53fd2a8e3356637b4162e1633 Mon Sep 17 00:00:00 2001 From: Tim Felgentreff Date: Thu, 23 Oct 2008 20:27:32 +0200 Subject: [PATCH] Another shot at focus stuff (as feature requested) --- efl_launcher/src/ruby/Edjewin.rb | 1 - xlib_ruby/x11_wrap.c | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/efl_launcher/src/ruby/Edjewin.rb b/efl_launcher/src/ruby/Edjewin.rb index 92e8b4c..a93279e 100644 --- a/efl_launcher/src/ruby/Edjewin.rb +++ b/efl_launcher/src/ruby/Edjewin.rb @@ -32,4 +32,3 @@ def show attr_accessor :ee, :edje end - diff --git a/xlib_ruby/x11_wrap.c b/xlib_ruby/x11_wrap.c index 29d71b7..60b91cd 100644 --- a/xlib_ruby/x11_wrap.c +++ b/xlib_ruby/x11_wrap.c @@ -107,14 +107,19 @@ static VALUE wm_num_clients(VALUE self) { static VALUE wm_selected(VALUE self) { WM *newwm; - Window focus_return; + XEvent event_return, event_saviour; int i; Data_Get_Struct(self, WM, newwm); - XGetInputFocus(newwm->dpy, &focus_return, &i); + // Cycle through focus events and get the most recent + XCheckTypedEvent(newwm->dpy, FocusIn, &event_return); + /* + while (XCheckTypedEvent(newwm->dpy, FocusIn, &event_return)) + */ + event_saviour = event_return; for (i=0; iclients_num; i++) - if (&newwm->clients[i].win == &focus_return) + if (&newwm->clients[i].win == &event_saviour.xany.window) newwm->selected = &newwm->clients[i]; return client_make(cClient, newwm->selected); }