From dea0e53dbb0989b1c17c2139fccb3390506b60c6 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sat, 23 Jul 2005 20:48:08 +0000 Subject: [PATCH] we were sending inactive chatstate because focus-out is called when we ask the context menu. now with some pointer and geometry stuff that is fixed --- src/tabbed_chat_window.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index 8a921b196..7704ab98d 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -260,8 +260,20 @@ class TabbedChatWindow(chat.Chat): window_state = widget.window.get_state() if window_state is None: return - - self.send_chatstate('inactive') + + # focus-out is also emitted by showing context menu + # so check to see if we're really not paying attention to window/tab + x, y, width, height, depth = widget.window.get_geometry() + mouse_x, mouse_y, state = widget.window.get_pointer() + # mouse_x, mouse_y are relative to window that is: + # (0, 0) is the left upper corner of the window + # so just check if mouse_x is inside width value to see where the pointer + # is at the time of focus-out + # NOTE: if the user changes tab, (switch-tab send inactive to current tab + # so that's not a problem) + if mouse_x < 0 or mouse_x > width: # it's outside of window + # so no context menu, so sent inactive + self.send_chatstate('inactive') def on_chat_notebook_key_press_event(self, widget, event): chat.Chat.on_chat_notebook_key_press_event(self, widget, event)