make human logic safe resizements, moves of windows
This commit is contained in:
parent
83c63e85de
commit
ac05887b43
4 changed files with 29 additions and 14 deletions
|
@ -90,9 +90,9 @@ class GroupchatWindow(chat.Chat):
|
||||||
|
|
||||||
# get size and position from config
|
# get size and position from config
|
||||||
if gajim.config.get('saveposition'):
|
if gajim.config.get('saveposition'):
|
||||||
self.window.move(gajim.config.get('gc-x-position'),
|
gtkgui_helpers.move_window(self.window, gajim.config.get('gc-x-position'),
|
||||||
gajim.config.get('gc-y-position'))
|
gajim.config.get('gc-y-position'))
|
||||||
self.window.resize(gajim.config.get('gc-width'),
|
gtkgui_helpers.resize(self.window, gajim.config.get('gc-width'),
|
||||||
gajim.config.get('gc-height'))
|
gajim.config.get('gc-height'))
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,10 @@ _ = i18n._
|
||||||
from common import gajim
|
from common import gajim
|
||||||
from common import helpers
|
from common import helpers
|
||||||
|
|
||||||
|
screen = gtk.gdk.Screen()
|
||||||
|
screen_w, screen_h = screen.get_width(), screen.get_height()
|
||||||
|
del screen
|
||||||
|
|
||||||
def get_default_font():
|
def get_default_font():
|
||||||
''' Get the desktop setting for application font
|
''' Get the desktop setting for application font
|
||||||
first check for GNOME, then XFCE and last KDE
|
first check for GNOME, then XFCE and last KDE
|
||||||
|
@ -161,3 +165,19 @@ def autodetect_browser_mailer():
|
||||||
gajim.config.set('openwith', 'kfmclient exec')
|
gajim.config.set('openwith', 'kfmclient exec')
|
||||||
else:
|
else:
|
||||||
gajim.config.set('openwith', 'custom')
|
gajim.config.set('openwith', 'custom')
|
||||||
|
|
||||||
|
def move_window(window, x, y):
|
||||||
|
''' moves the window but also checks if out of screen '''
|
||||||
|
if x < 0:
|
||||||
|
x = 0
|
||||||
|
if y < 0:
|
||||||
|
y = 0
|
||||||
|
window.move(x, y)
|
||||||
|
|
||||||
|
def resize_window(window, w, h):
|
||||||
|
''' resizes window but also checks if huge window or negative values '''
|
||||||
|
if w > screen_w:
|
||||||
|
w = screen_w
|
||||||
|
if h > screen_h:
|
||||||
|
h = screen_h
|
||||||
|
window.resize(abs(w), abs(h))
|
|
@ -2040,14 +2040,9 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
||||||
# no need of this variable
|
# no need of this variable
|
||||||
self.have_new_message_accel = False # Is the "Ctrl+N" shown ?
|
self.have_new_message_accel = False # Is the "Ctrl+N" shown ?
|
||||||
if gajim.config.get('saveposition'):
|
if gajim.config.get('saveposition'):
|
||||||
x = gajim.config.get('roster_x-position')
|
gtkgui_helpers.move_window(self.window, gajim.config.get('roster_x-position'),
|
||||||
y = gajim.config.get('roster_y-position')
|
gajim.config.get('roster_y-position'))
|
||||||
if x < 0:
|
gtkgui_helpers.resize_window(self.window, gajim.config.get('roster_width'),
|
||||||
x = 0
|
|
||||||
if y < 0:
|
|
||||||
y = 0
|
|
||||||
self.window.move(x, y)
|
|
||||||
self.window.resize(gajim.config.get('roster_width'),
|
|
||||||
gajim.config.get('roster_height'))
|
gajim.config.get('roster_height'))
|
||||||
|
|
||||||
self.popups_notification_height = 0
|
self.popups_notification_height = 0
|
||||||
|
|
|
@ -72,9 +72,9 @@ class TabbedChatWindow(chat.Chat):
|
||||||
|
|
||||||
if gajim.config.get('saveposition'):
|
if gajim.config.get('saveposition'):
|
||||||
# get window position and size from config
|
# get window position and size from config
|
||||||
self.window.move(gajim.config.get('chat-x-position'),
|
gtkgui_helpers.move_window(self.window, gajim.config.get('chat-x-position'),
|
||||||
gajim.config.get('chat-y-position'))
|
gajim.config.get('chat-y-position'))
|
||||||
self.window.resize(gajim.config.get('chat-width'),
|
gtkgui_helpers.resize(self.window, gajim.config.get('chat-width'),
|
||||||
gajim.config.get('chat-height'))
|
gajim.config.get('chat-height'))
|
||||||
|
|
||||||
# gtk+ doesn't make use of the motion notify on gtkwindow by default
|
# gtk+ doesn't make use of the motion notify on gtkwindow by default
|
||||||
|
|
Loading…
Add table
Reference in a new issue