[gimp] Some more changes to build with GSEAL_ENABLE
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Some more changes to build with GSEAL_ENABLE
- Date: Fri, 15 Jan 2010 14:35:14 +0000 (UTC)
commit 7175f3e883d8cdf43d12276f5bd5f592f6e82c14
Author: Michael Natterer <mitch gimp org>
Date: Fri Jan 15 15:33:08 2010 +0100
Some more changes to build with GSEAL_ENABLE
- use more GTK+ accessors instead of struct members
- remove quite some #undef GSEAL_ENABLE from completely ported files
app/display/gimpdisplayshell-callbacks.c | 2 +-
app/display/gimpdisplayshell.c | 2 -
app/widgets/gimpcurveview.c | 24 ++++++++++++-------
app/widgets/gimpdasheditor.c | 20 ++++++++++------
app/widgets/gimpdockable.c | 24 ++++++++++++-------
app/widgets/gimpdockbook.c | 9 ++++---
app/widgets/gimpfgbgeditor.c | 23 ++++++++++++------
app/widgets/gimpfgbgview.c | 13 ++++++-----
app/widgets/gimpgradienteditor.c | 16 ++++++++++---
app/widgets/gimphandlebar.c | 35 ++++++++++++++++++++---------
app/widgets/gimphistogrameditor.c | 2 -
app/widgets/gimphistogramview.c | 25 +++++++++++++-------
app/widgets/gimpmessagebox.c | 4 +--
app/widgets/gimpnavigationview.c | 11 +++++----
app/widgets/gimppaletteview.c | 16 ++++++++-----
app/widgets/gimpprogressbox.c | 7 +++--
app/widgets/gimpscalebutton.c | 15 ++++++------
app/widgets/gimpstrokeeditor.c | 14 ++++++-----
app/widgets/gimptoolbox.c | 9 +++++--
app/widgets/gimpview-popup.c | 8 +++++-
app/widgets/gimpview.c | 19 +++++++++++-----
app/widgets/gimpwidgets-utils.c | 15 +++++++-----
plug-ins/script-fu/script-fu-console.c | 17 +++++++++-----
23 files changed, 204 insertions(+), 126 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index 05003b1..270d7e9 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -624,7 +624,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
*/
if (event->type != GDK_KEY_PRESS &&
event->type != GDK_KEY_RELEASE &&
- ((GdkEventAny *) event)->window != canvas->window)
+ ((GdkEventAny *) event)->window != gtk_widget_get_window (canvas))
{
return FALSE;
}
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index ea14a33..a2df6f4 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -17,8 +17,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <string.h>
#include <gegl.h>
diff --git a/app/widgets/gimpcurveview.c b/app/widgets/gimpcurveview.c
index 11dface..0fdb967 100644
--- a/app/widgets/gimpcurveview.c
+++ b/app/widgets/gimpcurveview.c
@@ -17,8 +17,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <string.h>
#include <gtk/gtk.h>
@@ -340,6 +338,7 @@ gimp_curve_view_expose (GtkWidget *widget,
{
GimpCurveView *view = GIMP_CURVE_VIEW (widget);
GtkStyle *style = gtk_widget_get_style (widget);
+ GtkAllocation allocation;
cairo_t *cr;
gint border;
gint width;
@@ -352,10 +351,11 @@ gimp_curve_view_expose (GtkWidget *widget,
if (! view->curve)
return FALSE;
- border = GIMP_HISTOGRAM_VIEW (view)->border_width;
+ gtk_widget_get_allocation (widget, &allocation);
- width = widget->allocation.width - 2 * border - 1;
- height = widget->allocation.height - 2 * border - 1;
+ border = GIMP_HISTOGRAM_VIEW (view)->border_width;
+ width = allocation.width - 2 * border - 1;
+ height = allocation.height - 2 * border - 1;
cr = gdk_cairo_create (gtk_widget_get_window (widget));
@@ -522,6 +522,7 @@ gimp_curve_view_button_press (GtkWidget *widget,
{
GimpCurveView *view = GIMP_CURVE_VIEW (widget);
GimpCurve *curve = view->curve;
+ GtkAllocation allocation;
gint border;
gint width, height;
gdouble x;
@@ -532,9 +533,11 @@ gimp_curve_view_button_press (GtkWidget *widget,
if (! curve || bevent->button != 1)
return TRUE;
+ gtk_widget_get_allocation (widget, &allocation);
+
border = GIMP_HISTOGRAM_VIEW (view)->border_width;
- width = widget->allocation.width - 2 * border;
- height = widget->allocation.height - 2 * border;
+ width = allocation.width - 2 * border;
+ height = allocation.height - 2 * border;
x = (gdouble) (bevent->x - border) / (gdouble) width;
y = (gdouble) (bevent->y - border) / (gdouble) height;
@@ -621,6 +624,7 @@ gimp_curve_view_motion_notify (GtkWidget *widget,
{
GimpCurveView *view = GIMP_CURVE_VIEW (widget);
GimpCurve *curve = view->curve;
+ GtkAllocation allocation;
GimpCursorType new_cursor = GDK_X_CURSOR;
gint border;
gint width, height;
@@ -632,9 +636,11 @@ gimp_curve_view_motion_notify (GtkWidget *widget,
if (! curve)
return TRUE;
+ gtk_widget_get_allocation (widget, &allocation);
+
border = GIMP_HISTOGRAM_VIEW (view)->border_width;
- width = widget->allocation.width - 2 * border;
- height = widget->allocation.height - 2 * border;
+ width = allocation.width - 2 * border;
+ height = allocation.height - 2 * border;
x = (gdouble) (mevent->x - border) / (gdouble) width;
y = (gdouble) (mevent->y - border) / (gdouble) height;
diff --git a/app/widgets/gimpdasheditor.c b/app/widgets/gimpdasheditor.c
index 2f3b396..c1e3a12 100644
--- a/app/widgets/gimpdasheditor.c
+++ b/app/widgets/gimpdasheditor.c
@@ -20,8 +20,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
@@ -241,9 +239,12 @@ gimp_dash_editor_expose (GtkWidget *widget,
GimpDashEditor *editor = GIMP_DASH_EDITOR (widget);
GtkStyle *style = gtk_widget_get_style (widget);
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
+ GtkAllocation allocation;
gint x;
gint w, h;
+ gtk_widget_get_allocation (widget, &allocation);
+
update_blocksize (editor);
gdk_cairo_rectangle (cr, &event->area);
@@ -257,8 +258,8 @@ gimp_dash_editor_expose (GtkWidget *widget,
w = editor->block_width;
h = editor->block_height;
- editor->x0 = (widget->allocation.width - w * editor->n_segments) / 2;
- editor->y0 = (widget->allocation.height - h) / 2;
+ editor->x0 = (allocation.width - w * editor->n_segments) / 2;
+ editor->y0 = (allocation.height - h) / 2;
/* draw the dash segments */
@@ -289,7 +290,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
cairo_fill (cr);
- for (; x < widget->allocation.width + w; x += w)
+ for (; x < allocation.width + w; x += w)
{
gint index = dash_x_to_index (editor, x);
@@ -307,7 +308,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
if (x > 0)
x -= w;
- for (; x < widget->allocation.width + w; x += w)
+ for (; x < allocation.width + w; x += w)
{
gint index = dash_x_to_index (editor, x);
@@ -488,7 +489,10 @@ update_options_from_segments (GimpDashEditor *editor)
static void
update_blocksize (GimpDashEditor *editor)
{
- GtkWidget *widget = GTK_WIDGET (editor);
+ GtkWidget *widget = GTK_WIDGET (editor);
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
editor->block_height = 6;
@@ -497,7 +501,7 @@ update_blocksize (GimpDashEditor *editor)
4);
editor->block_height = MIN (ROUND (((float) editor->block_width) *
editor->n_segments / editor->dash_length),
- widget->allocation.height - 4);
+ allocation.height - 4);
}
static gint
diff --git a/app/widgets/gimpdockable.c b/app/widgets/gimpdockable.c
index a955c9d..4022dcb 100644
--- a/app/widgets/gimpdockable.c
+++ b/app/widgets/gimpdockable.c
@@ -392,7 +392,7 @@ gimp_dockable_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation;
gint border_width;
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
border_width = gtk_container_get_border_width (container);
@@ -1290,17 +1290,23 @@ static void
gimp_dockable_get_title_area (GimpDockable *dockable,
GdkRectangle *area)
{
- GtkWidget *widget = GTK_WIDGET (dockable);
- gint border = gtk_container_get_border_width (GTK_CONTAINER (dockable));
+ GtkWidget *widget = GTK_WIDGET (dockable);
+ GtkAllocation allocation;
+ GtkAllocation button_allocation;
+ gint border;
- area->x = widget->allocation.x + border;
- area->y = widget->allocation.y + border;
- area->width = (widget->allocation.width -
- 2 * border - dockable->p->menu_button->allocation.width);
- area->height = dockable->p->menu_button->allocation.height;
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_widget_get_allocation (dockable->p->menu_button, &button_allocation);
+
+ border = gtk_container_get_border_width (GTK_CONTAINER (dockable));
+
+ area->x = allocation.x + border;
+ area->y = allocation.y + border;
+ area->width = allocation.width - 2 * border - button_allocation.width;
+ area->height = button_allocation.height;
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
- area->x += dockable->p->menu_button->allocation.width;
+ area->x += button_allocation.width;
}
static void
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index 55bc9df..a76b9f3 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -20,8 +20,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <string.h>
#include <gtk/gtk.h>
@@ -798,6 +796,7 @@ gimp_dockbook_tab_drag_begin (GtkWidget *widget,
{
GimpDock *dock;
GimpPanedBoxClass *paned_box_class;
+ GtkAllocation allocation;
GtkWidget *window;
GtkWidget *view;
GtkRequisition requisition;
@@ -807,6 +806,8 @@ gimp_dockbook_tab_drag_begin (GtkWidget *widget,
dock = GIMP_DOCK (gimp_dockable_get_dockbook (dockable)->p->dock);
paned_box_class = GIMP_PANED_BOX_GET_CLASS (gimp_dock_get_vbox (dock));
+ gtk_widget_get_allocation (widget, &allocation);
+
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND);
gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (widget));
@@ -817,8 +818,8 @@ gimp_dockbook_tab_drag_begin (GtkWidget *widget,
gtk_widget_size_request (view, &requisition);
- if (requisition.width < widget->allocation.width)
- gtk_widget_set_size_request (view, widget->allocation.width, -1);
+ if (requisition.width < allocation.width)
+ gtk_widget_set_size_request (view, allocation.width, -1);
gtk_widget_show (window);
diff --git a/app/widgets/gimpfgbgeditor.c b/app/widgets/gimpfgbgeditor.c
index 34030e5..5286319 100644
--- a/app/widgets/gimpfgbgeditor.c
+++ b/app/widgets/gimpfgbgeditor.c
@@ -20,8 +20,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <string.h>
#include <gtk/gtk.h>
@@ -289,6 +287,7 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
GimpFgBgEditor *editor = GIMP_FG_BG_EDITOR (widget);
GtkStyle *style = gtk_widget_get_style (widget);
GdkWindow *window = gtk_widget_get_window (widget);
+ GtkAllocation allocation;
gint width, height;
gint default_w, default_h;
gint swap_w, swap_h;
@@ -298,8 +297,10 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
if (! gtk_widget_is_drawable (widget))
return FALSE;
- width = widget->allocation.width;
- height = widget->allocation.height;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ width = allocation.width;
+ height = allocation.height;
/* draw the default colors pixbuf */
if (! editor->default_icon)
@@ -395,10 +396,16 @@ gimp_fg_bg_editor_target (GimpFgBgEditor *editor,
gint x,
gint y)
{
- gint width = GTK_WIDGET (editor)->allocation.width;
- gint height = GTK_WIDGET (editor)->allocation.height;
- gint rect_w = editor->rect_width;
- gint rect_h = editor->rect_height;
+ GtkAllocation allocation;
+ gint width;
+ gint height;
+ gint rect_w = editor->rect_width;
+ gint rect_h = editor->rect_height;
+
+ gtk_widget_get_allocation (GTK_WIDGET (editor), &allocation);
+
+ width = allocation.width;
+ height = allocation.height;
if (x > 0 && x < rect_w && y > 0 && y < rect_h)
return FOREGROUND_AREA;
diff --git a/app/widgets/gimpfgbgview.c b/app/widgets/gimpfgbgview.c
index 0954b4d..d7b022b 100644
--- a/app/widgets/gimpfgbgview.c
+++ b/app/widgets/gimpfgbgview.c
@@ -20,8 +20,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <string.h>
#include <gtk/gtk.h>
@@ -210,6 +208,7 @@ gimp_fg_bg_view_expose (GtkWidget *widget,
GimpFgBgView *view = GIMP_FG_BG_VIEW (widget);
GtkStyle *style = gtk_widget_get_style (widget);
GdkWindow *window = gtk_widget_get_window (widget);
+ GtkAllocation allocation;
gint x, y;
gint width, height;
gint rect_w, rect_h;
@@ -218,10 +217,12 @@ gimp_fg_bg_view_expose (GtkWidget *widget,
if (! gtk_widget_is_drawable (widget))
return FALSE;
- x = widget->allocation.x;
- y = widget->allocation.y;
- width = widget->allocation.width;
- height = widget->allocation.height;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ x = allocation.x;
+ y = allocation.y;
+ width = allocation.width;
+ height = allocation.height;
rect_w = width * 3 / 4;
rect_h = height * 3 / 4;
diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c
index a27b65a..ae02370 100644
--- a/app/widgets/gimpgradienteditor.c
+++ b/app/widgets/gimpgradienteditor.c
@@ -44,8 +44,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <stdlib.h>
#include <string.h>
@@ -1895,7 +1893,12 @@ control_calc_p_pos (GimpGradientEditor *editor,
gdouble pos)
{
GtkAdjustment *adjustment = GTK_ADJUSTMENT (editor->scroll_data);
- gint pwidth = editor->control->allocation.width;
+ GtkAllocation allocation;
+ gint pwidth;
+
+ gtk_widget_get_allocation (editor->control, &allocation);
+
+ pwidth = allocation.width;
/* Calculate the position (in widget's coordinates) of the
* requested point from the gradient. Rounding is done to
@@ -1912,7 +1915,12 @@ control_calc_g_pos (GimpGradientEditor *editor,
gint pos)
{
GtkAdjustment *adjustment = GTK_ADJUSTMENT (editor->scroll_data);
- gint pwidth = editor->control->allocation.width;
+ GtkAllocation allocation;
+ gint pwidth;
+
+ gtk_widget_get_allocation (editor->control, &allocation);
+
+ pwidth = allocation.width;
/* Calculate the gradient position that corresponds to widget's coordinates */
diff --git a/app/widgets/gimphandlebar.c b/app/widgets/gimphandlebar.c
index 0c9ac80..172bbcb 100644
--- a/app/widgets/gimphandlebar.c
+++ b/app/widgets/gimphandlebar.c
@@ -17,8 +17,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
@@ -147,20 +145,23 @@ gimp_handle_bar_expose (GtkWidget *widget,
GdkEventExpose *eevent)
{
GimpHandleBar *bar = GIMP_HANDLE_BAR (widget);
+ GtkAllocation allocation;
cairo_t *cr;
gint x, y;
gint width, height;
gint i;
+ gtk_widget_get_allocation (widget, &allocation);
+
x = y = gtk_container_get_border_width (GTK_CONTAINER (widget));
- width = widget->allocation.width - 2 * x;
- height = widget->allocation.height - 2 * y;
+ width = allocation.width - 2 * x;
+ height = allocation.height - 2 * y;
if (! gtk_widget_get_has_window (widget))
{
- x += widget->allocation.x;
- y += widget->allocation.y;
+ x += allocation.x;
+ y += allocation.y;
}
cr = gdk_cairo_create (gtk_widget_get_window (widget));
@@ -213,13 +214,19 @@ static gboolean
gimp_handle_bar_button_press (GtkWidget *widget,
GdkEventButton *bevent)
{
- GimpHandleBar *bar = GIMP_HANDLE_BAR (widget);
- gint border = gtk_container_get_border_width (GTK_CONTAINER (widget));
- gint width = widget->allocation.width - 2 * border;
+ GimpHandleBar *bar= GIMP_HANDLE_BAR (widget);
+ GtkAllocation allocation;
+ gint border;
+ gint width;
gdouble value;
gint min_dist;
gint i;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ border = gtk_container_get_border_width (GTK_CONTAINER (widget));
+ width = allocation.width - 2 * border;
+
if (width < 1)
return FALSE;
@@ -258,10 +265,16 @@ gimp_handle_bar_motion_notify (GtkWidget *widget,
GdkEventMotion *mevent)
{
GimpHandleBar *bar = GIMP_HANDLE_BAR (widget);
- gint border = gtk_container_get_border_width (GTK_CONTAINER (widget));
- gint width = widget->allocation.width - 2 * border;
+ GtkAllocation allocation;
+ gint border;
+ gint width;
gdouble value;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ border = gtk_container_get_border_width (GTK_CONTAINER (widget));
+ width = allocation.width - 2 * border;
+
if (width < 1)
return FALSE;
diff --git a/app/widgets/gimphistogrameditor.c b/app/widgets/gimphistogrameditor.c
index cca44bd..da88373 100644
--- a/app/widgets/gimphistogrameditor.c
+++ b/app/widgets/gimphistogrameditor.c
@@ -17,8 +17,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gegl.h>
#include <gtk/gtk.h>
diff --git a/app/widgets/gimphistogramview.c b/app/widgets/gimphistogramview.c
index fcba461..e532c0a 100644
--- a/app/widgets/gimphistogramview.c
+++ b/app/widgets/gimphistogramview.c
@@ -17,8 +17,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
@@ -283,6 +281,7 @@ gimp_histogram_view_expose (GtkWidget *widget,
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
GtkStyle *style = gtk_widget_get_style (widget);
GdkWindow *window = gtk_widget_get_window (widget);
+ GtkAllocation allocation;
gint x;
gint x1, x2;
gint border;
@@ -299,9 +298,11 @@ gimp_histogram_view_expose (GtkWidget *widget,
if (! view->histogram && ! view->bg_histogram)
return FALSE;
+ gtk_widget_get_allocation (widget, &allocation);
+
border = view->border_width;
- width = widget->allocation.width - 2 * border;
- height = widget->allocation.height - 2 * border;
+ width = allocation.width - 2 * border;
+ height = allocation.height - 2 * border;
x1 = CLAMP (MIN (view->start, view->end), 0, 255);
x2 = CLAMP (MAX (view->start, view->end), 0, 255);
@@ -309,8 +310,8 @@ gimp_histogram_view_expose (GtkWidget *widget,
gdk_draw_rectangle (window,
style->base_gc[GTK_STATE_NORMAL], TRUE,
0, 0,
- widget->allocation.width,
- widget->allocation.height);
+ allocation.width,
+ allocation.height);
/* Draw the outer border */
gdk_draw_rectangle (window,
@@ -506,13 +507,16 @@ gimp_histogram_view_button_press (GtkWidget *widget,
if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 1)
{
- gint width;
+ GtkAllocation allocation;
+ gint width;
gdk_pointer_grab (gtk_widget_get_window (widget), FALSE,
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
NULL, NULL, bevent->time);
- width = widget->allocation.width - 2 * view->border_width;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ width = allocation.width - 2 * view->border_width;
view->start = CLAMP ((((bevent->x - view->border_width) * 256) / width),
0, 255);
@@ -555,9 +559,12 @@ gimp_histogram_view_motion_notify (GtkWidget *widget,
GdkEventMotion *mevent)
{
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
+ GtkAllocation allocation;
gint width;
- width = widget->allocation.width - 2 * view->border_width;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ width = allocation.width - 2 * view->border_width;
view->start = CLAMP ((((mevent->x - view->border_width) * 256) / width),
0, 255);
diff --git a/app/widgets/gimpmessagebox.c b/app/widgets/gimpmessagebox.c
index e895b95..787d37a 100644
--- a/app/widgets/gimpmessagebox.c
+++ b/app/widgets/gimpmessagebox.c
@@ -20,8 +20,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
@@ -308,7 +306,7 @@ gimp_message_box_size_allocate (GtkWidget *widget,
allocation->x -= rtl ? 0 : width;
allocation->width += width;
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
}
static void
diff --git a/app/widgets/gimpnavigationview.c b/app/widgets/gimpnavigationview.c
index 0aba478..dbd85ad 100644
--- a/app/widgets/gimpnavigationview.c
+++ b/app/widgets/gimpnavigationview.c
@@ -23,8 +23,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gegl.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -517,12 +515,15 @@ gimp_navigation_view_draw_marker (GimpNavigationView *nav_view,
if (view->renderer->viewable && nav_view->width && nav_view->height)
{
- GtkWidget *widget = GTK_WIDGET (view);
+ GtkWidget *widget = GTK_WIDGET (view);
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
- cairo_translate (cr, widget->allocation.x, widget->allocation.y);
+ cairo_translate (cr, allocation.x, allocation.y);
cairo_rectangle (cr,
0, 0,
- widget->allocation.width, widget->allocation.height);
+ allocation.width, allocation.height);
cairo_rectangle (cr,
nav_view->p_x, nav_view->p_y,
nav_view->p_width, nav_view->p_height);
diff --git a/app/widgets/gimppaletteview.c b/app/widgets/gimppaletteview.c
index 5ab30d4..35fb7aa 100644
--- a/app/widgets/gimppaletteview.c
+++ b/app/widgets/gimppaletteview.c
@@ -20,8 +20,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
@@ -176,11 +174,14 @@ gimp_palette_view_expose (GtkWidget *widget,
{
GimpViewRendererPalette *renderer;
GtkStyle *style = gtk_widget_get_style (widget);
+ GtkAllocation allocation;
cairo_t *cr;
gint row, col;
renderer = GIMP_VIEW_RENDERER_PALETTE (view->renderer);
+ gtk_widget_get_allocation (widget, &allocation);
+
row = pal_view->selected->position / renderer->columns;
col = pal_view->selected->position % renderer->columns;
@@ -189,8 +190,8 @@ gimp_palette_view_expose (GtkWidget *widget,
cairo_clip (cr);
cairo_rectangle (cr,
- widget->allocation.x + col * renderer->cell_width + 0.5,
- widget->allocation.y + row * renderer->cell_height + 0.5,
+ allocation.x + col * renderer->cell_width + 0.5,
+ allocation.y + row * renderer->cell_height + 0.5,
renderer->cell_width,
renderer->cell_height);
@@ -454,15 +455,18 @@ gimp_palette_view_expose_entry (GimpPaletteView *view,
GimpViewRendererPalette *renderer;
gint row, col;
GtkWidget *widget = GTK_WIDGET (view);
+ GtkAllocation allocation;
renderer = GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (view)->renderer);
+ gtk_widget_get_allocation (widget, &allocation);
+
row = entry->position / renderer->columns;
col = entry->position % renderer->columns;
gtk_widget_queue_draw_area (GTK_WIDGET (view),
- widget->allocation.x + col * renderer->cell_width,
- widget->allocation.y + row * renderer->cell_height,
+ allocation.x + col * renderer->cell_width,
+ allocation.y + row * renderer->cell_height,
renderer->cell_width + 1,
renderer->cell_height + 1);
}
diff --git a/app/widgets/gimpprogressbox.c b/app/widgets/gimpprogressbox.c
index 1832cfb..b28ac4a 100644
--- a/app/widgets/gimpprogressbox.c
+++ b/app/widgets/gimpprogressbox.c
@@ -20,8 +20,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
@@ -191,11 +189,14 @@ gimp_progress_box_progress_set_value (GimpProgress *progress,
{
GimpProgressBox *box = GIMP_PROGRESS_BOX (progress);
GtkProgressBar *bar = GTK_PROGRESS_BAR (box->progress);
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (GTK_WIDGET (bar), &allocation);
box->value = percentage;
/* only update the progress bar if this causes a visible change */
- if (fabs (GTK_WIDGET (bar)->allocation.width *
+ if (fabs (allocation.width *
(percentage - gtk_progress_bar_get_fraction (bar))) > 1.0)
{
gtk_progress_bar_set_fraction (bar, box->value);
diff --git a/app/widgets/gimpscalebutton.c b/app/widgets/gimpscalebutton.c
index ca5a72c..75438c5 100644
--- a/app/widgets/gimpscalebutton.c
+++ b/app/widgets/gimpscalebutton.c
@@ -20,8 +20,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include "widgets-types.h"
@@ -117,13 +115,16 @@ gimp_scale_button_image_expose (GtkWidget *widget,
GimpScaleButton *button)
{
GtkStyle *style = gtk_widget_get_style (widget);
+ GtkAllocation allocation;
GtkAdjustment *adj;
cairo_t *cr;
gint value;
gint steps;
gint i;
- steps = MIN (widget->allocation.width, widget->allocation.height) / 2;
+ gtk_widget_get_allocation (widget, &allocation);
+
+ steps = MIN (allocation.width, allocation.height) / 2;
adj = gtk_scale_button_get_adjustment (GTK_SCALE_BUTTON (button));
@@ -145,15 +146,15 @@ gimp_scale_button_image_expose (GtkWidget *widget,
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{
cairo_translate (cr,
- widget->allocation.x + widget->allocation.width - 0.5,
- widget->allocation.y + widget->allocation.height);
+ allocation.x + allocation.width - 0.5,
+ allocation.y + allocation.height);
cairo_scale (cr, -2.0, -2.0);
}
else
{
cairo_translate (cr,
- widget->allocation.x + 0.5,
- widget->allocation.y + widget->allocation.height);
+ allocation.x + 0.5,
+ allocation.y + allocation.height);
cairo_scale (cr, 2.0, -2.0);
}
diff --git a/app/widgets/gimpstrokeeditor.c b/app/widgets/gimpstrokeeditor.c
index ab855e4..e24b40b 100644
--- a/app/widgets/gimpstrokeeditor.c
+++ b/app/widgets/gimpstrokeeditor.c
@@ -17,8 +17,6 @@
#include "config.h"
-#undef GSEAL_ENABLE
-
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
@@ -340,8 +338,12 @@ gimp_stroke_editor_paint_button (GtkWidget *widget,
gpointer data)
{
GtkStyle *style = gtk_widget_get_style (widget);
- GtkAllocation *alloc = &widget->allocation;
- gint w = MIN (alloc->width, alloc->height) * 2 / 3;
+ GtkAllocation allocation;
+ gint w;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ w = MIN (allocation.width, allocation.height) * 2 / 3;
gtk_paint_arrow (style,
gtk_widget_get_window (widget),
@@ -349,8 +351,8 @@ gimp_stroke_editor_paint_button (GtkWidget *widget,
GTK_SHADOW_IN,
&event->area, widget, NULL,
data ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT, TRUE,
- alloc->x + (alloc->width - w) / 2,
- alloc->y + (alloc->height - w) / 2,
+ allocation.x + (allocation.width - w) / 2,
+ allocation.y + (allocation.height - w) / 2,
w, w);
return FALSE;
}
diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c
index 06867c2..0da4db8 100644
--- a/app/widgets/gimptoolbox.c
+++ b/app/widgets/gimptoolbox.c
@@ -603,13 +603,16 @@ gimp_toolbox_expose_event (GtkWidget *widget,
GdkEventExpose *event)
{
GimpToolbox *toolbox = GIMP_TOOLBOX (widget);
+ GtkAllocation header_allocation;
GdkRectangle clip_rect;
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
+ gtk_widget_get_allocation (toolbox->p->header, &header_allocation);
+
if (gtk_widget_get_visible (toolbox->p->header) &&
gdk_rectangle_intersect (&event->area,
- &toolbox->p->header->allocation,
+ &header_allocation,
&clip_rect))
{
GtkStyle *style = gtk_widget_get_style (widget);
@@ -625,8 +628,8 @@ gimp_toolbox_expose_event (GtkWidget *widget,
gdk_cairo_rectangle (cr, &clip_rect);
cairo_clip (cr);
- header_width = toolbox->p->header->allocation.width;
- header_height = toolbox->p->header->allocation.height;
+ header_width = header_allocation.width;
+ header_height = header_allocation.height;
gimp_cairo_wilber_get_size (cr, &wilber_width, &wilber_height);
diff --git a/app/widgets/gimpview-popup.c b/app/widgets/gimpview-popup.c
index 0265650..24c29ea 100644
--- a/app/widgets/gimpview-popup.c
+++ b/app/widgets/gimpview-popup.c
@@ -115,8 +115,12 @@ gimp_view_popup_show (GtkWidget *widget,
if (! gtk_widget_get_has_window (widget))
{
- popup->button_x += widget->allocation.x;
- popup->button_y += widget->allocation.y;
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ popup->button_x += allocation.x;
+ popup->button_y += allocation.y;
}
g_signal_connect (widget, "button-release-event",
diff --git a/app/widgets/gimpview.c b/app/widgets/gimpview.c
index 93a5d62..94a6b89 100644
--- a/app/widgets/gimpview.c
+++ b/app/widgets/gimpview.c
@@ -205,16 +205,19 @@ static void
gimp_view_realize (GtkWidget *widget)
{
GimpView *view = GIMP_VIEW (widget);
+ GtkAllocation allocation;
GdkWindowAttr attributes;
gint attributes_mask;
GTK_WIDGET_CLASS (parent_class)->realize (widget);
+ gtk_widget_get_allocation (widget, &allocation);
+
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_ONLY;
attributes.event_mask = gtk_widget_get_events (widget);
@@ -371,7 +374,7 @@ gimp_view_size_allocate (GtkWidget *widget,
allocation->width = width;
allocation->height = height;
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (view->event_window,
@@ -387,9 +390,13 @@ gimp_view_expose_event (GtkWidget *widget,
{
if (gtk_widget_is_drawable (widget))
{
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer,
gtk_widget_get_window (widget), widget,
- &widget->allocation,
+ &allocation,
&event->area);
}
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index ff4fd78..b1fb850 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -144,6 +144,7 @@ gimp_button_menu_position (GtkWidget *button,
gint *y)
{
GdkScreen *screen;
+ GtkAllocation button_allocation;
GtkRequisition menu_requisition;
GdkRectangle rect;
gint monitor;
@@ -154,6 +155,8 @@ gimp_button_menu_position (GtkWidget *button,
g_return_if_fail (x != NULL);
g_return_if_fail (y != NULL);
+ gtk_widget_get_allocation (button, &button_allocation);
+
if (gtk_widget_get_direction (button) == GTK_TEXT_DIR_RTL)
{
switch (position)
@@ -170,8 +173,8 @@ gimp_button_menu_position (GtkWidget *button,
if (! gtk_widget_get_has_window (button))
{
- *x += button->allocation.x;
- *y += button->allocation.y;
+ *x += button_allocation.x;
+ *y += button_allocation.y;
}
gdk_window_get_root_coords (gtk_widget_get_window (button), *x, *y, x, y);
@@ -190,13 +193,13 @@ gimp_button_menu_position (GtkWidget *button,
case GTK_POS_LEFT:
*x -= menu_requisition.width;
if (*x < rect.x)
- *x += menu_requisition.width + button->allocation.width;
+ *x += menu_requisition.width + button_allocation.width;
break;
case GTK_POS_RIGHT:
- *x += button->allocation.width;
+ *x += button_allocation.width;
if (*x + menu_requisition.width > rect.x + rect.width)
- *x -= button->allocation.width + menu_requisition.width;
+ *x -= button_allocation.width + menu_requisition.width;
break;
default:
@@ -204,7 +207,7 @@ gimp_button_menu_position (GtkWidget *button,
break;
}
- *y += button->allocation.height / 2;
+ *y += button_allocation.height / 2;
if (*y + menu_requisition.height > rect.y + rect.height)
*y -= menu_requisition.height;
diff --git a/plug-ins/script-fu/script-fu-console.c b/plug-ins/script-fu/script-fu-console.c
index e76186c..69f8df8 100644
--- a/plug-ins/script-fu/script-fu-console.c
+++ b/plug-ins/script-fu/script-fu-console.c
@@ -22,8 +22,6 @@
#include <glib/gstdio.h>
-#undef GSEAL_ENABLE
-
#include "libgimp/gimp.h"
#include "libgimp/gimpui.h"
@@ -484,11 +482,18 @@ script_fu_browse_row_activated (GtkDialog *dialog)
static gboolean
script_fu_console_idle_scroll_end (GtkWidget *view)
{
- GtkAdjustment *adj = GTK_TEXT_VIEW (view)->vadjustment;
+ GtkWidget *parent = gtk_widget_get_parent (view);
+
+ if (parent)
+ {
+ GtkAdjustment *adj;
- gtk_adjustment_set_value (adj,
- gtk_adjustment_get_upper (adj) -
- gtk_adjustment_get_page_size (adj));
+ adj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (parent));
+
+ gtk_adjustment_set_value (adj,
+ gtk_adjustment_get_upper (adj) -
+ gtk_adjustment_get_page_size (adj));
+ }
g_object_unref (view);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]