From c4ad077b13232c870c8d2c921f446e5ed6175277 Mon Sep 17 00:00:00 2001 From: Travis Shirk Date: Sat, 14 Jan 2006 20:46:20 +0000 Subject: [PATCH] No negative size or positions for windows; closes #1389 --- src/message_window.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/message_window.py b/src/message_window.py index 77586c3d4..432a585b4 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -612,7 +612,8 @@ class MessageWindowMgr: opt_height = type + '-msgwin-height' size = (gajim.config.get(opt_width), gajim.config.get(opt_height)) - gtkgui_helpers.resize_window(win.window, size[0], size[1]) + if size[0] > 0 and size[1] > 0: + gtkgui_helpers.resize_window(win.window, size[0], size[1]) def _position_window(self, win, acct, type): '''Returns the position tuple: (x, y)''' @@ -630,7 +631,7 @@ class MessageWindowMgr: pos = (gajim.config.get(type + '-msgwin-x-position'), gajim.config.get(type + '-msgwin-y-position')) - if pos[0] != -1 and pos[1] != -1: + if pos[0] > 0 and pos[1] > 0: gtkgui_helpers.move_window(win.window, pos[0], pos[1]) def _mode_to_key(self, contact, acct, type): @@ -708,7 +709,7 @@ class MessageWindowMgr: def save_state(self, msg_win): if not gajim.config.get('saveposition'): - return False + return # Save window size and postion pos_x_key = 'msgwin-x-position' @@ -720,6 +721,10 @@ class MessageWindowMgr: x, y = msg_win.window.get_position() width, height = msg_win.window.get_size() + # If any of these values seem bogus don't update. + if x < 0 or y < 0 or width < 0 or height < 0: + return + if self.mode == self.CONFIG_NEVER: x = y = -1 elif self.mode == self.CONFIG_PERACCT: