| 8267 x > gdk_screen_width() || |
8267 x > gdk_screen_width() || |
| 8268 y > gdk_screen_height()) |
8268 y > gdk_screen_height()) |
| 8269 return FALSE; /* carry on normally */ |
8269 return FALSE; /* carry on normally */ |
| 8270 |
8270 |
| 8271 /* store the position */ |
8271 /* store the position */ |
| 8272 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/x", x); |
8272 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/x", x); |
| 8273 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/y", y); |
8273 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/y", y); |
| 8274 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width", event->width); |
8274 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/width", event->width); |
| 8275 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", event->height); |
8275 purple_prefs_set_int(PIDGIN_PREFS_ROOT "/conversations/im/height", event->height); |
| 8276 |
8276 |
| 8277 /* continue to handle event normally */ |
8277 /* continue to handle event normally */ |
| 8278 return FALSE; |
8278 return FALSE; |
| 8279 |
8279 |
| |
8280 } |
| |
8281 |
| |
8282 static void |
| |
8283 pidgin_conv_restore_position(PidginWindow *win) { |
| |
8284 int conv_x, conv_y, conv_width, conv_height; |
| |
8285 |
| |
8286 conv_width = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/width"); |
| |
8287 |
| |
8288 /* if the window exists, is hidden, we're saving positions, and the |
| |
8289 * position is sane... */ |
| |
8290 if (win && win->window && |
| |
8291 !GTK_WIDGET_VISIBLE(win->window) && conv_width != 0) { |
| |
8292 |
| |
8293 conv_x = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/x"); |
| |
8294 conv_y = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/y"); |
| |
8295 conv_height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/height"); |
| |
8296 |
| |
8297 /* ...check position is on screen... */ |
| |
8298 if (conv_x >= gdk_screen_width()) |
| |
8299 conv_x = gdk_screen_width() - 100; |
| |
8300 else if (conv_x + conv_width < 0) |
| |
8301 conv_x = 100; |
| |
8302 |
| |
8303 if (conv_y >= gdk_screen_height()) |
| |
8304 conv_y = gdk_screen_height() - 100; |
| |
8305 else if (conv_y + conv_height < 0) |
| |
8306 conv_y = 100; |
| |
8307 |
| |
8308 /* ...and move it back. */ |
| |
8309 gtk_window_move(GTK_WINDOW(win->window), conv_x, conv_y); |
| |
8310 gtk_window_resize(GTK_WINDOW(win->window), conv_width, conv_height); |
| |
8311 } |
| 8280 } |
8312 } |
| 8281 |
8313 |
| 8282 PidginWindow * |
8314 PidginWindow * |
| 8283 pidgin_conv_window_new() |
8315 pidgin_conv_window_new() |
| 8284 { |
8316 { |
| 8291 |
8323 |
| 8292 window_list = g_list_append(window_list, win); |
8324 window_list = g_list_append(window_list, win); |
| 8293 |
8325 |
| 8294 /* Create the window. */ |
8326 /* Create the window. */ |
| 8295 win->window = pidgin_create_window(NULL, 0, "conversation", TRUE); |
8327 win->window = pidgin_create_window(NULL, 0, "conversation", TRUE); |
| 8296 gtk_window_set_default_size(GTK_WINDOW(win->window), purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/width"), |
8328 pidgin_conv_restore_position(win); |
| 8297 purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/im/height")); |
|
| 8298 |
8329 |
| 8299 if (available_list == NULL) { |
8330 if (available_list == NULL) { |
| 8300 create_icon_lists(win->window); |
8331 create_icon_lists(win->window); |
| 8301 } |
8332 } |
| 8302 |
8333 |