diff --git a/src/gtkgui_helpers.py b/src/gtkgui_helpers.py index 7d47dcbac..03c58b951 100644 --- a/src/gtkgui_helpers.py +++ b/src/gtkgui_helpers.py @@ -295,3 +295,9 @@ def get_pixbuf_from_data(file_data): pixbuf = None return pixbuf + +def get_invisible_cursor(): + pixmap = gtk.gdk.Pixmap(None, 1, 1, 1) + color = gtk.gdk.Color() + cursor = gtk.gdk.Cursor(pixmap, pixmap, color, color, 0, 0) + return cursor diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index 0ec4eeab2..61d417b37 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -172,13 +172,35 @@ class TabbedChatWindow(chat.Chat): window.add(image) window.set_position(gtk.WIN_POS_MOUSE) + # we should make the cursor visible + # gtk+ doesn't make use of the motion notify on gtkwindow by default + # so this line adds that + window.set_events(gtk.gdk.POINTER_MOTION_MASK) + window.realize() + + # make the cursor invisible so we can see the image + invisible_cursor = gtkgui_helpers.get_invisible_cursor() + window.window.set_cursor(invisible_cursor) + + # we should hide the window + window.connect('leave_notify_event', + self.on_window_avatar_leave_notify_event) + + + window.connect('motion-notify-event', + self.on_window_motion_notify_event) + window.show_all() - window.connect('leave_notify_event', self.on_window_avatar_leave_notify_event) def on_window_avatar_leave_notify_event(self, widget, event): '''we just left the popup window that holds avatar''' self.bigger_avatar_window.hide() + def on_window_motion_notify_event(self, widget, event): + '''we just moved the mouse so show the cursor''' + cursor = gtk.gdk.Cursor(gtk.gdk.LEFT_PTR) + self.bigger_avatar_window.window.set_cursor(cursor) + def draw_widgets(self, contact): '''draw the widgets in a tab (f.e. gpg togglebutton) according to the the information in the contact variable'''