show emoticon menu with alt+E above entry if window is near the bottom of the screen
This commit is contained in:
parent
1cd68a6364
commit
f9780e156f
14
src/chat.py
14
src/chat.py
|
@ -402,6 +402,7 @@ class Chat:
|
||||||
# now move the menu above the button
|
# now move the menu above the button
|
||||||
y -= menu_height
|
y -= menu_height
|
||||||
|
|
||||||
|
|
||||||
# push_in is True so all the menuitems are always inside screen
|
# push_in is True so all the menuitems are always inside screen
|
||||||
push_in = True
|
push_in = True
|
||||||
return (x, y, push_in)
|
return (x, y, push_in)
|
||||||
|
@ -836,9 +837,16 @@ class Chat:
|
||||||
size = window.get_size()
|
size = window.get_size()
|
||||||
buf = parent.get_buffer()
|
buf = parent.get_buffer()
|
||||||
# get the cursor position
|
# get the cursor position
|
||||||
cursor = parent.get_iter_location(buf.get_iter_at_mark(buf.get_insert()))
|
cursor = parent.get_iter_location(buf.get_iter_at_mark(
|
||||||
cursor = parent.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT, cursor.x, cursor.y)
|
buf.get_insert()))
|
||||||
return (origin[0] + cursor[0], origin[1] + size[1], True) # push_in True
|
cursor = parent.buffer_to_window_coords(gtk.TEXT_WINDOW_TEXT,
|
||||||
|
cursor.x, cursor.y)
|
||||||
|
x = origin[0] + cursor[0]
|
||||||
|
y = origin[1] + size[1]
|
||||||
|
menu_width, menu_height = self.emoticons_menu.size_request()
|
||||||
|
if y + menu_height > gtk.gdk.screen_height():
|
||||||
|
y -= menu_height
|
||||||
|
return (x, y, True) # push_in True
|
||||||
self.emoticons_menu.popup(None, None, set_emoticons_menu_position, 1, 0)
|
self.emoticons_menu.popup(None, None, set_emoticons_menu_position, 1, 0)
|
||||||
elif event.keyval == gtk.keysyms.Page_Down:
|
elif event.keyval == gtk.keysyms.Page_Down:
|
||||||
if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE DOWN
|
if event.state & gtk.gdk.SHIFT_MASK: # SHIFT + PAGE DOWN
|
||||||
|
|
Loading…
Reference in New Issue