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 4dda379..0b3ec48 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 1061fd3..0336ea4 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 168f9f7..35ef205 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 94b0acc..1b046a8 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 5a4bdf0..ef75f00 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;