Fixed the problem of changing the window position when Sylpheed was
authorSergey Vlasov <vsu@users.sourceforge.net>
Tue, 3 Dec 2002 18:11:19 +0000 (18:11 +0000)
committerSergey Vlasov <vsu@users.sourceforge.net>
Tue, 3 Dec 2002 18:11:19 +0000 (18:11 +0000)
launched a second time (see sylpheed-main ML message [sylpheed:17247]).

ChangeLog.claws
configure.in
src/gtkutils.c
src/gtkutils.h
src/mainwindow.c

index 4dda379ec6348e9f8da925118ae15bcf97150f92..0b3ec487c8dc2f1642ece9911f6897b41e08232b 100644 (file)
@@ -1,3 +1,13 @@
+2002-12-03 [sergey]    0.8.6claws55
+
+       * src/gtkutils.c
+       * src/gtkutils.h
+               gtkut_window_popup(): new function.
+       * src/mainwindow.c
+               main_window_popup(): use gtkut_window_popup() to raise
+               window without changing its position.
+               (see sylpheed-main ML message [sylpheed:17247])
+
 2002-12-03 [sergey]    0.8.6claws54
 
        * src/send.c
index 1061fd32a9b5780e116b188be40514348d74f7f4..0336ea4a5f2b6e7bf22cb633722e1057bfe0117e 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=6
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws54
+EXTRA_VERSION=claws55
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 168f9f7f033914caa79a7e86859b5e1d65bf479a..35ef205e245d7ece41c7600f73917a7b863976bf 100644 (file)
@@ -504,6 +504,26 @@ void gtkut_widget_get_uposition(GtkWidget *widget, gint *px, gint *py)
        *py = y;
 }
 
+void gtkut_window_popup(GtkWidget *window)
+{
+       gint x, y, sx, sy, new_x, new_y;
+
+       g_return_if_fail(window != NULL);
+       g_return_if_fail(window->window != NULL);
+
+       gdk_window_get_origin(window->window, &x, &y);
+       sx = gdk_screen_width();
+       sy = gdk_screen_height();
+       new_x = x % sx; if (new_x < 0) new_x = 0;
+       new_y = y % sy; if (new_y < 0) new_y = 0;
+       if (new_x != x || new_y != y)
+               gdk_window_move(window->window, new_x, new_y);
+
+       gdk_window_raise(window->window);
+       gdk_window_show(window->window);
+}
+
+
 static void gtkut_clist_bindings_add(GtkWidget *clist)
 {
        GtkBindingSet *binding_set;
index 94b0acceb40f44e28ec929390264127d280fa418..1b046a8ef7ff53402f0a78369d5e7c710cf67c2d 100644 (file)
@@ -146,6 +146,9 @@ void gtkut_widget_wait_for_draw             (GtkWidget      *widget);
 void gtkut_widget_get_uposition                (GtkWidget      *widget,
                                         gint           *px,
                                         gint           *py);
+
+void gtkut_window_popup                        (GtkWidget      *window);
+
 void gtkut_widget_init                 (void);
 
 void gtkut_widget_set_app_icon         (GtkWidget      *widget);
index 5a4bdf05a8363658bc7142571a09b5f1f17369b5..ef75f004eb5a7941434c263c049905b61fc7ae06 100644 (file)
@@ -1776,51 +1776,18 @@ void main_window_set_menu_sensitive(MainWindow *mainwin)
 
 void main_window_popup(MainWindow *mainwin)
 {
-       gint x, y;
-       gint sx, sy;
-       GtkWidget *widget;
-
-       gdk_window_get_origin(mainwin->window->window, &x, &y);
-       sx = gdk_screen_width();
-       sy = gdk_screen_height();
-       x %= sx; if (x < 0) x = 0;
-       y %= sy; if (y < 0) y = 0;
-       gdk_window_move(mainwin->window->window, x, y);
-       gdk_window_raise(mainwin->window->window);
-       gdk_window_show(mainwin->window->window);
-
-       debug_print("window position: x = %d, y = %d\n", x, y);
+       gtkut_window_popup(mainwin->window);
 
        switch (mainwin->type) {
        case SEPARATE_FOLDER:
-               widget = mainwin->win.sep_folder.folderwin;
-               gdk_window_get_origin(widget->window, &x, &y);
-               x %= sx; if (x < 0) x = 0;
-               y %= sy; if (y < 0) y = 0;
-               gdk_window_move(widget->window, x, y);
-               gdk_window_raise(widget->window);
+               gtkut_window_popup(mainwin->win.sep_folder.folderwin);
                break;
        case SEPARATE_MESSAGE:
-               widget = mainwin->win.sep_message.messagewin;
-               gdk_window_get_origin(widget->window, &x, &y);
-               x %= sx; if (x < 0) x = 0;
-               y %= sy; if (y < 0) y = 0;
-               gdk_window_move(widget->window, x, y);
-               gdk_window_raise(widget->window);
+               gtkut_window_popup(mainwin->win.sep_message.messagewin);
                break;
        case SEPARATE_BOTH:
-               widget = mainwin->win.sep_both.folderwin;
-               gdk_window_get_origin(widget->window, &x, &y);
-               x %= sx; if (x < 0) x = 0;
-               y %= sy; if (y < 0) y = 0;
-               gdk_window_move(widget->window, x, y);
-               gdk_window_raise(widget->window);
-               widget = mainwin->win.sep_both.messagewin;
-               gdk_window_get_origin(widget->window, &x, &y);
-               x %= sx; if (x < 0) x = 0;
-               y %= sy; if (y < 0) y = 0;
-               gdk_window_move(widget->window, x, y);
-               gdk_window_raise(widget->window);
+               gtkut_window_popup(mainwin->win.sep_both.folderwin);
+               gtkut_window_popup(mainwin->win.sep_both.messagewin);
                break;
        default:
                break;