From: Matthias Clasen Date: Tue, 3 Dec 2002 21:49:39 +0000 (+0000) Subject: RTL flipping for statusbars. X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;ds=sidebyside;h=31ef3456c8fc81b643cfafb895d27a34faf63f0f;p=~andy%2Fgtk RTL flipping for statusbars. --- diff --git a/ChangeLog b/ChangeLog index d94044495..b3373fbac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +2002-12-03 Matthias Clasen + + RTL flipping for statusbars. (#96832) + + * gtk/gtkstatusbar.c (get_grip_edge): New function returning the + appropriate grip edge for a statusbar. + (get_grip_rect): Do the right thing in RTL mode. + (gtk_statusbar_button_press): Initiate a resize drag on the + appropriate edge. + (gtk_statusbar_expose_event): Paint the resize grip for the + appropriate edge. + 2002-12-03 Anders Carlsson * gtk/gtkstyle.c: Fix doc comment. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index d94044495..b3373fbac 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,15 @@ +2002-12-03 Matthias Clasen + + RTL flipping for statusbars. (#96832) + + * gtk/gtkstatusbar.c (get_grip_edge): New function returning the + appropriate grip edge for a statusbar. + (get_grip_rect): Do the right thing in RTL mode. + (gtk_statusbar_button_press): Initiate a resize drag on the + appropriate edge. + (gtk_statusbar_expose_event): Paint the resize grip for the + appropriate edge. + 2002-12-03 Anders Carlsson * gtk/gtkstyle.c: Fix doc comment. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index d94044495..b3373fbac 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,15 @@ +2002-12-03 Matthias Clasen + + RTL flipping for statusbars. (#96832) + + * gtk/gtkstatusbar.c (get_grip_edge): New function returning the + appropriate grip edge for a statusbar. + (get_grip_rect): Do the right thing in RTL mode. + (gtk_statusbar_button_press): Initiate a resize drag on the + appropriate edge. + (gtk_statusbar_expose_event): Paint the resize grip for the + appropriate edge. + 2002-12-03 Anders Carlsson * gtk/gtkstyle.c: Fix doc comment. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index d94044495..b3373fbac 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,15 @@ +2002-12-03 Matthias Clasen + + RTL flipping for statusbars. (#96832) + + * gtk/gtkstatusbar.c (get_grip_edge): New function returning the + appropriate grip edge for a statusbar. + (get_grip_rect): Do the right thing in RTL mode. + (gtk_statusbar_button_press): Initiate a resize drag on the + appropriate edge. + (gtk_statusbar_expose_event): Paint the resize grip for the + appropriate edge. + 2002-12-03 Anders Carlsson * gtk/gtkstyle.c: Fix doc comment. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index d94044495..b3373fbac 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,15 @@ +2002-12-03 Matthias Clasen + + RTL flipping for statusbars. (#96832) + + * gtk/gtkstatusbar.c (get_grip_edge): New function returning the + appropriate grip edge for a statusbar. + (get_grip_rect): Do the right thing in RTL mode. + (gtk_statusbar_button_press): Initiate a resize drag on the + appropriate edge. + (gtk_statusbar_expose_event): Paint the resize grip for the + appropriate edge. + 2002-12-03 Anders Carlsson * gtk/gtkstyle.c: Fix doc comment. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index d94044495..b3373fbac 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,15 @@ +2002-12-03 Matthias Clasen + + RTL flipping for statusbars. (#96832) + + * gtk/gtkstatusbar.c (get_grip_edge): New function returning the + appropriate grip edge for a statusbar. + (get_grip_rect): Do the right thing in RTL mode. + (gtk_statusbar_button_press): Initiate a resize drag on the + appropriate edge. + (gtk_statusbar_expose_event): Paint the resize grip for the + appropriate edge. + 2002-12-03 Anders Carlsson * gtk/gtkstyle.c: Fix doc comment. diff --git a/gtk/gtkstatusbar.c b/gtk/gtkstatusbar.c index 023072d36..a118fe9bc 100644 --- a/gtk/gtkstatusbar.c +++ b/gtk/gtkstatusbar.c @@ -421,6 +421,17 @@ gtk_statusbar_destroy (GtkObject *object) GTK_OBJECT_CLASS (parent_class)->destroy (object); } +static GdkWindowEdge +get_grip_edge (GtkStatusbar *statusbar) +{ + GtkWidget *widget = GTK_WIDGET (statusbar); + + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) + return GDK_WINDOW_EDGE_SOUTH_EAST; + else + return GDK_WINDOW_EDGE_SOUTH_WEST; +} + static void get_grip_rect (GtkStatusbar *statusbar, GdkRectangle *rect) @@ -440,10 +451,14 @@ get_grip_rect (GtkStatusbar *statusbar, if (h > (widget->allocation.height - widget->style->ythickness)) h = widget->allocation.height - widget->style->ythickness; - rect->x = widget->allocation.x + widget->allocation.width - w; - rect->y = widget->allocation.y + widget->allocation.height - h; rect->width = w; rect->height = h; + rect->y = widget->allocation.y + widget->allocation.height - h; + + if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) + rect->x = widget->allocation.x + widget->allocation.width - w; + else + rect->x = widget->allocation.x + widget->style->xthickness; } static void @@ -543,6 +558,7 @@ gtk_statusbar_button_press (GtkWidget *widget, { GtkStatusbar *statusbar; GtkWidget *ancestor; + GdkWindowEdge edge; statusbar = GTK_STATUSBAR (widget); @@ -555,9 +571,11 @@ gtk_statusbar_button_press (GtkWidget *widget, if (!GTK_IS_WINDOW (ancestor)) return FALSE; + edge = get_grip_edge (statusbar); + if (event->button == 1) gtk_window_begin_resize_drag (GTK_WINDOW (ancestor), - GDK_WINDOW_EDGE_SOUTH_EAST, + edge, event->button, event->x_root, event->y_root, event->time); @@ -585,6 +603,10 @@ gtk_statusbar_expose_event (GtkWidget *widget, if (statusbar->has_resize_grip) { + GdkWindowEdge edge; + + edge = get_grip_edge (statusbar); + get_grip_rect (statusbar, &rect); gtk_paint_resize_grip (widget->style, @@ -593,7 +615,7 @@ gtk_statusbar_expose_event (GtkWidget *widget, NULL, widget, "statusbar", - GDK_WINDOW_EDGE_SOUTH_EAST, + edge, rect.x, rect.y, /* don't draw grip over the frame, though you * can click on the frame.