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
This commit is contained in:
Michael Natterer 2010-01-15 15:33:08 +01:00
parent 67365732d4
commit 7175f3e883
23 changed files with 204 additions and 126 deletions

View File

@ -624,7 +624,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
*/ */
if (event->type != GDK_KEY_PRESS && if (event->type != GDK_KEY_PRESS &&
event->type != GDK_KEY_RELEASE && event->type != GDK_KEY_RELEASE &&
((GdkEventAny *) event)->window != canvas->window) ((GdkEventAny *) event)->window != gtk_widget_get_window (canvas))
{ {
return FALSE; return FALSE;
} }

View File

@ -17,8 +17,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <string.h> #include <string.h>
#include <gegl.h> #include <gegl.h>

View File

@ -17,8 +17,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -340,6 +338,7 @@ gimp_curve_view_expose (GtkWidget *widget,
{ {
GimpCurveView *view = GIMP_CURVE_VIEW (widget); GimpCurveView *view = GIMP_CURVE_VIEW (widget);
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
GtkAllocation allocation;
cairo_t *cr; cairo_t *cr;
gint border; gint border;
gint width; gint width;
@ -352,10 +351,11 @@ gimp_curve_view_expose (GtkWidget *widget,
if (! view->curve) if (! view->curve)
return FALSE; return FALSE;
border = GIMP_HISTOGRAM_VIEW (view)->border_width; gtk_widget_get_allocation (widget, &allocation);
width = widget->allocation.width - 2 * border - 1; border = GIMP_HISTOGRAM_VIEW (view)->border_width;
height = widget->allocation.height - 2 * border - 1; width = allocation.width - 2 * border - 1;
height = allocation.height - 2 * border - 1;
cr = gdk_cairo_create (gtk_widget_get_window (widget)); 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); GimpCurveView *view = GIMP_CURVE_VIEW (widget);
GimpCurve *curve = view->curve; GimpCurve *curve = view->curve;
GtkAllocation allocation;
gint border; gint border;
gint width, height; gint width, height;
gdouble x; gdouble x;
@ -532,9 +533,11 @@ gimp_curve_view_button_press (GtkWidget *widget,
if (! curve || bevent->button != 1) if (! curve || bevent->button != 1)
return TRUE; return TRUE;
gtk_widget_get_allocation (widget, &allocation);
border = GIMP_HISTOGRAM_VIEW (view)->border_width; border = GIMP_HISTOGRAM_VIEW (view)->border_width;
width = widget->allocation.width - 2 * border; width = allocation.width - 2 * border;
height = widget->allocation.height - 2 * border; height = allocation.height - 2 * border;
x = (gdouble) (bevent->x - border) / (gdouble) width; x = (gdouble) (bevent->x - border) / (gdouble) width;
y = (gdouble) (bevent->y - border) / (gdouble) height; y = (gdouble) (bevent->y - border) / (gdouble) height;
@ -621,6 +624,7 @@ gimp_curve_view_motion_notify (GtkWidget *widget,
{ {
GimpCurveView *view = GIMP_CURVE_VIEW (widget); GimpCurveView *view = GIMP_CURVE_VIEW (widget);
GimpCurve *curve = view->curve; GimpCurve *curve = view->curve;
GtkAllocation allocation;
GimpCursorType new_cursor = GDK_X_CURSOR; GimpCursorType new_cursor = GDK_X_CURSOR;
gint border; gint border;
gint width, height; gint width, height;
@ -632,9 +636,11 @@ gimp_curve_view_motion_notify (GtkWidget *widget,
if (! curve) if (! curve)
return TRUE; return TRUE;
gtk_widget_get_allocation (widget, &allocation);
border = GIMP_HISTOGRAM_VIEW (view)->border_width; border = GIMP_HISTOGRAM_VIEW (view)->border_width;
width = widget->allocation.width - 2 * border; width = allocation.width - 2 * border;
height = widget->allocation.height - 2 * border; height = allocation.height - 2 * border;
x = (gdouble) (mevent->x - border) / (gdouble) width; x = (gdouble) (mevent->x - border) / (gdouble) width;
y = (gdouble) (mevent->y - border) / (gdouble) height; y = (gdouble) (mevent->y - border) / (gdouble) height;

View File

@ -20,8 +20,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
@ -241,9 +239,12 @@ gimp_dash_editor_expose (GtkWidget *widget,
GimpDashEditor *editor = GIMP_DASH_EDITOR (widget); GimpDashEditor *editor = GIMP_DASH_EDITOR (widget);
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget)); cairo_t *cr = gdk_cairo_create (gtk_widget_get_window (widget));
GtkAllocation allocation;
gint x; gint x;
gint w, h; gint w, h;
gtk_widget_get_allocation (widget, &allocation);
update_blocksize (editor); update_blocksize (editor);
gdk_cairo_rectangle (cr, &event->area); gdk_cairo_rectangle (cr, &event->area);
@ -257,8 +258,8 @@ gimp_dash_editor_expose (GtkWidget *widget,
w = editor->block_width; w = editor->block_width;
h = editor->block_height; h = editor->block_height;
editor->x0 = (widget->allocation.width - w * editor->n_segments) / 2; editor->x0 = (allocation.width - w * editor->n_segments) / 2;
editor->y0 = (widget->allocation.height - h) / 2; editor->y0 = (allocation.height - h) / 2;
/* draw the dash segments */ /* 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]); gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
cairo_fill (cr); 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); gint index = dash_x_to_index (editor, x);
@ -307,7 +308,7 @@ gimp_dash_editor_expose (GtkWidget *widget,
if (x > 0) if (x > 0)
x -= w; 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); gint index = dash_x_to_index (editor, x);
@ -488,7 +489,10 @@ update_options_from_segments (GimpDashEditor *editor)
static void static void
update_blocksize (GimpDashEditor *editor) 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; editor->block_height = 6;
@ -497,7 +501,7 @@ update_blocksize (GimpDashEditor *editor)
4); 4);
editor->block_height = MIN (ROUND (((float) editor->block_width) * editor->block_height = MIN (ROUND (((float) editor->block_width) *
editor->n_segments / editor->dash_length), editor->n_segments / editor->dash_length),
widget->allocation.height - 4); allocation.height - 4);
} }
static gint static gint

View File

@ -392,7 +392,7 @@ gimp_dockable_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation; GtkAllocation child_allocation;
gint border_width; gint border_width;
widget->allocation = *allocation; gtk_widget_set_allocation (widget, allocation);
border_width = gtk_container_get_border_width (container); border_width = gtk_container_get_border_width (container);
@ -1290,17 +1290,23 @@ static void
gimp_dockable_get_title_area (GimpDockable *dockable, gimp_dockable_get_title_area (GimpDockable *dockable,
GdkRectangle *area) GdkRectangle *area)
{ {
GtkWidget *widget = GTK_WIDGET (dockable); GtkWidget *widget = GTK_WIDGET (dockable);
gint border = gtk_container_get_border_width (GTK_CONTAINER (dockable)); GtkAllocation allocation;
GtkAllocation button_allocation;
gint border;
area->x = widget->allocation.x + border; gtk_widget_get_allocation (widget, &allocation);
area->y = widget->allocation.y + border; gtk_widget_get_allocation (dockable->p->menu_button, &button_allocation);
area->width = (widget->allocation.width -
2 * border - dockable->p->menu_button->allocation.width); border = gtk_container_get_border_width (GTK_CONTAINER (dockable));
area->height = dockable->p->menu_button->allocation.height;
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) 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 static void

View File

@ -20,8 +20,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -798,6 +796,7 @@ gimp_dockbook_tab_drag_begin (GtkWidget *widget,
{ {
GimpDock *dock; GimpDock *dock;
GimpPanedBoxClass *paned_box_class; GimpPanedBoxClass *paned_box_class;
GtkAllocation allocation;
GtkWidget *window; GtkWidget *window;
GtkWidget *view; GtkWidget *view;
GtkRequisition requisition; GtkRequisition requisition;
@ -807,6 +806,8 @@ gimp_dockbook_tab_drag_begin (GtkWidget *widget,
dock = GIMP_DOCK (gimp_dockable_get_dockbook (dockable)->p->dock); dock = GIMP_DOCK (gimp_dockable_get_dockbook (dockable)->p->dock);
paned_box_class = GIMP_PANED_BOX_GET_CLASS (gimp_dock_get_vbox (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); window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_DND); 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)); 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); gtk_widget_size_request (view, &requisition);
if (requisition.width < widget->allocation.width) if (requisition.width < allocation.width)
gtk_widget_set_size_request (view, widget->allocation.width, -1); gtk_widget_set_size_request (view, allocation.width, -1);
gtk_widget_show (window); gtk_widget_show (window);

View File

@ -20,8 +20,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -289,6 +287,7 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
GimpFgBgEditor *editor = GIMP_FG_BG_EDITOR (widget); GimpFgBgEditor *editor = GIMP_FG_BG_EDITOR (widget);
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
GdkWindow *window = gtk_widget_get_window (widget); GdkWindow *window = gtk_widget_get_window (widget);
GtkAllocation allocation;
gint width, height; gint width, height;
gint default_w, default_h; gint default_w, default_h;
gint swap_w, swap_h; gint swap_w, swap_h;
@ -298,8 +297,10 @@ gimp_fg_bg_editor_expose (GtkWidget *widget,
if (! gtk_widget_is_drawable (widget)) if (! gtk_widget_is_drawable (widget))
return FALSE; return FALSE;
width = widget->allocation.width; gtk_widget_get_allocation (widget, &allocation);
height = widget->allocation.height;
width = allocation.width;
height = allocation.height;
/* draw the default colors pixbuf */ /* draw the default colors pixbuf */
if (! editor->default_icon) if (! editor->default_icon)
@ -395,10 +396,16 @@ gimp_fg_bg_editor_target (GimpFgBgEditor *editor,
gint x, gint x,
gint y) gint y)
{ {
gint width = GTK_WIDGET (editor)->allocation.width; GtkAllocation allocation;
gint height = GTK_WIDGET (editor)->allocation.height; gint width;
gint rect_w = editor->rect_width; gint height;
gint rect_h = editor->rect_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) if (x > 0 && x < rect_w && y > 0 && y < rect_h)
return FOREGROUND_AREA; return FOREGROUND_AREA;

View File

@ -20,8 +20,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <string.h> #include <string.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
@ -210,6 +208,7 @@ gimp_fg_bg_view_expose (GtkWidget *widget,
GimpFgBgView *view = GIMP_FG_BG_VIEW (widget); GimpFgBgView *view = GIMP_FG_BG_VIEW (widget);
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
GdkWindow *window = gtk_widget_get_window (widget); GdkWindow *window = gtk_widget_get_window (widget);
GtkAllocation allocation;
gint x, y; gint x, y;
gint width, height; gint width, height;
gint rect_w, rect_h; gint rect_w, rect_h;
@ -218,10 +217,12 @@ gimp_fg_bg_view_expose (GtkWidget *widget,
if (! gtk_widget_is_drawable (widget)) if (! gtk_widget_is_drawable (widget))
return FALSE; return FALSE;
x = widget->allocation.x; gtk_widget_get_allocation (widget, &allocation);
y = widget->allocation.y;
width = widget->allocation.width; x = allocation.x;
height = widget->allocation.height; y = allocation.y;
width = allocation.width;
height = allocation.height;
rect_w = width * 3 / 4; rect_w = width * 3 / 4;
rect_h = height * 3 / 4; rect_h = height * 3 / 4;

View File

@ -44,8 +44,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -1895,7 +1893,12 @@ control_calc_p_pos (GimpGradientEditor *editor,
gdouble pos) gdouble pos)
{ {
GtkAdjustment *adjustment = GTK_ADJUSTMENT (editor->scroll_data); 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 /* Calculate the position (in widget's coordinates) of the
* requested point from the gradient. Rounding is done to * requested point from the gradient. Rounding is done to
@ -1912,7 +1915,12 @@ control_calc_g_pos (GimpGradientEditor *editor,
gint pos) gint pos)
{ {
GtkAdjustment *adjustment = GTK_ADJUSTMENT (editor->scroll_data); 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 */ /* Calculate the gradient position that corresponds to widget's coordinates */

View File

@ -17,8 +17,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
@ -147,20 +145,23 @@ gimp_handle_bar_expose (GtkWidget *widget,
GdkEventExpose *eevent) GdkEventExpose *eevent)
{ {
GimpHandleBar *bar = GIMP_HANDLE_BAR (widget); GimpHandleBar *bar = GIMP_HANDLE_BAR (widget);
GtkAllocation allocation;
cairo_t *cr; cairo_t *cr;
gint x, y; gint x, y;
gint width, height; gint width, height;
gint i; gint i;
gtk_widget_get_allocation (widget, &allocation);
x = y = gtk_container_get_border_width (GTK_CONTAINER (widget)); x = y = gtk_container_get_border_width (GTK_CONTAINER (widget));
width = widget->allocation.width - 2 * x; width = allocation.width - 2 * x;
height = widget->allocation.height - 2 * y; height = allocation.height - 2 * y;
if (! gtk_widget_get_has_window (widget)) if (! gtk_widget_get_has_window (widget))
{ {
x += widget->allocation.x; x += allocation.x;
y += widget->allocation.y; y += allocation.y;
} }
cr = gdk_cairo_create (gtk_widget_get_window (widget)); cr = gdk_cairo_create (gtk_widget_get_window (widget));
@ -213,13 +214,19 @@ static gboolean
gimp_handle_bar_button_press (GtkWidget *widget, gimp_handle_bar_button_press (GtkWidget *widget,
GdkEventButton *bevent) GdkEventButton *bevent)
{ {
GimpHandleBar *bar = GIMP_HANDLE_BAR (widget); GimpHandleBar *bar= GIMP_HANDLE_BAR (widget);
gint border = gtk_container_get_border_width (GTK_CONTAINER (widget)); GtkAllocation allocation;
gint width = widget->allocation.width - 2 * border; gint border;
gint width;
gdouble value; gdouble value;
gint min_dist; gint min_dist;
gint i; 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) if (width < 1)
return FALSE; return FALSE;
@ -258,10 +265,16 @@ gimp_handle_bar_motion_notify (GtkWidget *widget,
GdkEventMotion *mevent) GdkEventMotion *mevent)
{ {
GimpHandleBar *bar = GIMP_HANDLE_BAR (widget); GimpHandleBar *bar = GIMP_HANDLE_BAR (widget);
gint border = gtk_container_get_border_width (GTK_CONTAINER (widget)); GtkAllocation allocation;
gint width = widget->allocation.width - 2 * border; gint border;
gint width;
gdouble value; 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) if (width < 1)
return FALSE; return FALSE;

View File

@ -17,8 +17,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gegl.h> #include <gegl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>

View File

@ -17,8 +17,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
@ -283,6 +281,7 @@ gimp_histogram_view_expose (GtkWidget *widget,
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget); GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
GdkWindow *window = gtk_widget_get_window (widget); GdkWindow *window = gtk_widget_get_window (widget);
GtkAllocation allocation;
gint x; gint x;
gint x1, x2; gint x1, x2;
gint border; gint border;
@ -299,9 +298,11 @@ gimp_histogram_view_expose (GtkWidget *widget,
if (! view->histogram && ! view->bg_histogram) if (! view->histogram && ! view->bg_histogram)
return FALSE; return FALSE;
gtk_widget_get_allocation (widget, &allocation);
border = view->border_width; border = view->border_width;
width = widget->allocation.width - 2 * border; width = allocation.width - 2 * border;
height = widget->allocation.height - 2 * border; height = allocation.height - 2 * border;
x1 = CLAMP (MIN (view->start, view->end), 0, 255); x1 = CLAMP (MIN (view->start, view->end), 0, 255);
x2 = CLAMP (MAX (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, gdk_draw_rectangle (window,
style->base_gc[GTK_STATE_NORMAL], TRUE, style->base_gc[GTK_STATE_NORMAL], TRUE,
0, 0, 0, 0,
widget->allocation.width, allocation.width,
widget->allocation.height); allocation.height);
/* Draw the outer border */ /* Draw the outer border */
gdk_draw_rectangle (window, gdk_draw_rectangle (window,
@ -506,13 +507,16 @@ gimp_histogram_view_button_press (GtkWidget *widget,
if (bevent->type == GDK_BUTTON_PRESS && bevent->button == 1) 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_pointer_grab (gtk_widget_get_window (widget), FALSE,
GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK, GDK_BUTTON_RELEASE_MASK | GDK_BUTTON1_MOTION_MASK,
NULL, NULL, bevent->time); 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), view->start = CLAMP ((((bevent->x - view->border_width) * 256) / width),
0, 255); 0, 255);
@ -555,9 +559,12 @@ gimp_histogram_view_motion_notify (GtkWidget *widget,
GdkEventMotion *mevent) GdkEventMotion *mevent)
{ {
GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget); GimpHistogramView *view = GIMP_HISTOGRAM_VIEW (widget);
GtkAllocation allocation;
gint width; 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), view->start = CLAMP ((((mevent->x - view->border_width) * 256) / width),
0, 255); 0, 255);

View File

@ -20,8 +20,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h" #include "libgimpwidgets/gimpwidgets.h"
@ -308,7 +306,7 @@ gimp_message_box_size_allocate (GtkWidget *widget,
allocation->x -= rtl ? 0 : width; allocation->x -= rtl ? 0 : width;
allocation->width += width; allocation->width += width;
widget->allocation = *allocation; gtk_widget_set_allocation (widget, allocation);
} }
static void static void

View File

@ -23,8 +23,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gegl.h> #include <gegl.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkkeysyms.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) if (view->renderer->viewable && nav_view->width && nav_view->height)
{ {
GtkWidget *widget = GTK_WIDGET (view); GtkWidget *widget = GTK_WIDGET (view);
GtkAllocation allocation;
cairo_translate (cr, widget->allocation.x, widget->allocation.y); gtk_widget_get_allocation (widget, &allocation);
cairo_translate (cr, allocation.x, allocation.y);
cairo_rectangle (cr, cairo_rectangle (cr,
0, 0, 0, 0,
widget->allocation.width, widget->allocation.height); allocation.width, allocation.height);
cairo_rectangle (cr, cairo_rectangle (cr,
nav_view->p_x, nav_view->p_y, nav_view->p_x, nav_view->p_y,
nav_view->p_width, nav_view->p_height); nav_view->p_width, nav_view->p_height);

View File

@ -20,8 +20,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h> #include <gdk/gdkkeysyms.h>
@ -176,11 +174,14 @@ gimp_palette_view_expose (GtkWidget *widget,
{ {
GimpViewRendererPalette *renderer; GimpViewRendererPalette *renderer;
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
GtkAllocation allocation;
cairo_t *cr; cairo_t *cr;
gint row, col; gint row, col;
renderer = GIMP_VIEW_RENDERER_PALETTE (view->renderer); renderer = GIMP_VIEW_RENDERER_PALETTE (view->renderer);
gtk_widget_get_allocation (widget, &allocation);
row = pal_view->selected->position / renderer->columns; row = pal_view->selected->position / renderer->columns;
col = 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_clip (cr);
cairo_rectangle (cr, cairo_rectangle (cr,
widget->allocation.x + col * renderer->cell_width + 0.5, allocation.x + col * renderer->cell_width + 0.5,
widget->allocation.y + row * renderer->cell_height + 0.5, allocation.y + row * renderer->cell_height + 0.5,
renderer->cell_width, renderer->cell_width,
renderer->cell_height); renderer->cell_height);
@ -454,15 +455,18 @@ gimp_palette_view_expose_entry (GimpPaletteView *view,
GimpViewRendererPalette *renderer; GimpViewRendererPalette *renderer;
gint row, col; gint row, col;
GtkWidget *widget = GTK_WIDGET (view); GtkWidget *widget = GTK_WIDGET (view);
GtkAllocation allocation;
renderer = GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (view)->renderer); renderer = GIMP_VIEW_RENDERER_PALETTE (GIMP_VIEW (view)->renderer);
gtk_widget_get_allocation (widget, &allocation);
row = entry->position / renderer->columns; row = entry->position / renderer->columns;
col = entry->position % renderer->columns; col = entry->position % renderer->columns;
gtk_widget_queue_draw_area (GTK_WIDGET (view), gtk_widget_queue_draw_area (GTK_WIDGET (view),
widget->allocation.x + col * renderer->cell_width, allocation.x + col * renderer->cell_width,
widget->allocation.y + row * renderer->cell_height, allocation.y + row * renderer->cell_height,
renderer->cell_width + 1, renderer->cell_width + 1,
renderer->cell_height + 1); renderer->cell_height + 1);
} }

View File

@ -20,8 +20,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h" #include "libgimpmath/gimpmath.h"
@ -191,11 +189,14 @@ gimp_progress_box_progress_set_value (GimpProgress *progress,
{ {
GimpProgressBox *box = GIMP_PROGRESS_BOX (progress); GimpProgressBox *box = GIMP_PROGRESS_BOX (progress);
GtkProgressBar *bar = GTK_PROGRESS_BAR (box->progress); GtkProgressBar *bar = GTK_PROGRESS_BAR (box->progress);
GtkAllocation allocation;
gtk_widget_get_allocation (GTK_WIDGET (bar), &allocation);
box->value = percentage; box->value = percentage;
/* only update the progress bar if this causes a visible change */ /* 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) (percentage - gtk_progress_bar_get_fraction (bar))) > 1.0)
{ {
gtk_progress_bar_set_fraction (bar, box->value); gtk_progress_bar_set_fraction (bar, box->value);

View File

@ -20,8 +20,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "widgets-types.h" #include "widgets-types.h"
@ -117,13 +115,16 @@ gimp_scale_button_image_expose (GtkWidget *widget,
GimpScaleButton *button) GimpScaleButton *button)
{ {
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
GtkAllocation allocation;
GtkAdjustment *adj; GtkAdjustment *adj;
cairo_t *cr; cairo_t *cr;
gint value; gint value;
gint steps; gint steps;
gint i; 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)); 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) if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
{ {
cairo_translate (cr, cairo_translate (cr,
widget->allocation.x + widget->allocation.width - 0.5, allocation.x + allocation.width - 0.5,
widget->allocation.y + widget->allocation.height); allocation.y + allocation.height);
cairo_scale (cr, -2.0, -2.0); cairo_scale (cr, -2.0, -2.0);
} }
else else
{ {
cairo_translate (cr, cairo_translate (cr,
widget->allocation.x + 0.5, allocation.x + 0.5,
widget->allocation.y + widget->allocation.height); allocation.y + allocation.height);
cairo_scale (cr, 2.0, -2.0); cairo_scale (cr, 2.0, -2.0);
} }

View File

@ -17,8 +17,6 @@
#include "config.h" #include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h" #include "libgimpbase/gimpbase.h"
@ -340,8 +338,12 @@ gimp_stroke_editor_paint_button (GtkWidget *widget,
gpointer data) gpointer data)
{ {
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
GtkAllocation *alloc = &widget->allocation; GtkAllocation allocation;
gint w = MIN (alloc->width, alloc->height) * 2 / 3; gint w;
gtk_widget_get_allocation (widget, &allocation);
w = MIN (allocation.width, allocation.height) * 2 / 3;
gtk_paint_arrow (style, gtk_paint_arrow (style,
gtk_widget_get_window (widget), gtk_widget_get_window (widget),
@ -349,8 +351,8 @@ gimp_stroke_editor_paint_button (GtkWidget *widget,
GTK_SHADOW_IN, GTK_SHADOW_IN,
&event->area, widget, NULL, &event->area, widget, NULL,
data ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT, TRUE, data ? GTK_ARROW_LEFT : GTK_ARROW_RIGHT, TRUE,
alloc->x + (alloc->width - w) / 2, allocation.x + (allocation.width - w) / 2,
alloc->y + (alloc->height - w) / 2, allocation.y + (allocation.height - w) / 2,
w, w); w, w);
return FALSE; return FALSE;
} }

View File

@ -603,13 +603,16 @@ gimp_toolbox_expose_event (GtkWidget *widget,
GdkEventExpose *event) GdkEventExpose *event)
{ {
GimpToolbox *toolbox = GIMP_TOOLBOX (widget); GimpToolbox *toolbox = GIMP_TOOLBOX (widget);
GtkAllocation header_allocation;
GdkRectangle clip_rect; GdkRectangle clip_rect;
GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); 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) && if (gtk_widget_get_visible (toolbox->p->header) &&
gdk_rectangle_intersect (&event->area, gdk_rectangle_intersect (&event->area,
&toolbox->p->header->allocation, &header_allocation,
&clip_rect)) &clip_rect))
{ {
GtkStyle *style = gtk_widget_get_style (widget); GtkStyle *style = gtk_widget_get_style (widget);
@ -625,8 +628,8 @@ gimp_toolbox_expose_event (GtkWidget *widget,
gdk_cairo_rectangle (cr, &clip_rect); gdk_cairo_rectangle (cr, &clip_rect);
cairo_clip (cr); cairo_clip (cr);
header_width = toolbox->p->header->allocation.width; header_width = header_allocation.width;
header_height = toolbox->p->header->allocation.height; header_height = header_allocation.height;
gimp_cairo_wilber_get_size (cr, &wilber_width, &wilber_height); gimp_cairo_wilber_get_size (cr, &wilber_width, &wilber_height);

View File

@ -115,8 +115,12 @@ gimp_view_popup_show (GtkWidget *widget,
if (! gtk_widget_get_has_window (widget)) if (! gtk_widget_get_has_window (widget))
{ {
popup->button_x += widget->allocation.x; GtkAllocation allocation;
popup->button_y += widget->allocation.y;
gtk_widget_get_allocation (widget, &allocation);
popup->button_x += allocation.x;
popup->button_y += allocation.y;
} }
g_signal_connect (widget, "button-release-event", g_signal_connect (widget, "button-release-event",

View File

@ -205,16 +205,19 @@ static void
gimp_view_realize (GtkWidget *widget) gimp_view_realize (GtkWidget *widget)
{ {
GimpView *view = GIMP_VIEW (widget); GimpView *view = GIMP_VIEW (widget);
GtkAllocation allocation;
GdkWindowAttr attributes; GdkWindowAttr attributes;
gint attributes_mask; gint attributes_mask;
GTK_WIDGET_CLASS (parent_class)->realize (widget); GTK_WIDGET_CLASS (parent_class)->realize (widget);
gtk_widget_get_allocation (widget, &allocation);
attributes.window_type = GDK_WINDOW_CHILD; attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x; attributes.x = allocation.x;
attributes.y = widget->allocation.y; attributes.y = allocation.y;
attributes.width = widget->allocation.width; attributes.width = allocation.width;
attributes.height = widget->allocation.height; attributes.height = allocation.height;
attributes.wclass = GDK_INPUT_ONLY; attributes.wclass = GDK_INPUT_ONLY;
attributes.event_mask = gtk_widget_get_events (widget); attributes.event_mask = gtk_widget_get_events (widget);
@ -371,7 +374,7 @@ gimp_view_size_allocate (GtkWidget *widget,
allocation->width = width; allocation->width = width;
allocation->height = height; allocation->height = height;
widget->allocation = *allocation; gtk_widget_set_allocation (widget, allocation);
if (GTK_WIDGET_REALIZED (widget)) if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (view->event_window, gdk_window_move_resize (view->event_window,
@ -387,9 +390,13 @@ gimp_view_expose_event (GtkWidget *widget,
{ {
if (gtk_widget_is_drawable (widget)) if (gtk_widget_is_drawable (widget))
{ {
GtkAllocation allocation;
gtk_widget_get_allocation (widget, &allocation);
gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer, gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer,
gtk_widget_get_window (widget), widget, gtk_widget_get_window (widget), widget,
&widget->allocation, &allocation,
&event->area); &event->area);
} }

View File

@ -144,6 +144,7 @@ gimp_button_menu_position (GtkWidget *button,
gint *y) gint *y)
{ {
GdkScreen *screen; GdkScreen *screen;
GtkAllocation button_allocation;
GtkRequisition menu_requisition; GtkRequisition menu_requisition;
GdkRectangle rect; GdkRectangle rect;
gint monitor; gint monitor;
@ -154,6 +155,8 @@ gimp_button_menu_position (GtkWidget *button,
g_return_if_fail (x != NULL); g_return_if_fail (x != NULL);
g_return_if_fail (y != NULL); g_return_if_fail (y != NULL);
gtk_widget_get_allocation (button, &button_allocation);
if (gtk_widget_get_direction (button) == GTK_TEXT_DIR_RTL) if (gtk_widget_get_direction (button) == GTK_TEXT_DIR_RTL)
{ {
switch (position) switch (position)
@ -170,8 +173,8 @@ gimp_button_menu_position (GtkWidget *button,
if (! gtk_widget_get_has_window (button)) if (! gtk_widget_get_has_window (button))
{ {
*x += button->allocation.x; *x += button_allocation.x;
*y += button->allocation.y; *y += button_allocation.y;
} }
gdk_window_get_root_coords (gtk_widget_get_window (button), *x, *y, x, 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: case GTK_POS_LEFT:
*x -= menu_requisition.width; *x -= menu_requisition.width;
if (*x < rect.x) if (*x < rect.x)
*x += menu_requisition.width + button->allocation.width; *x += menu_requisition.width + button_allocation.width;
break; break;
case GTK_POS_RIGHT: case GTK_POS_RIGHT:
*x += button->allocation.width; *x += button_allocation.width;
if (*x + menu_requisition.width > rect.x + rect.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; break;
default: default:
@ -204,7 +207,7 @@ gimp_button_menu_position (GtkWidget *button,
break; break;
} }
*y += button->allocation.height / 2; *y += button_allocation.height / 2;
if (*y + menu_requisition.height > rect.y + rect.height) if (*y + menu_requisition.height > rect.y + rect.height)
*y -= menu_requisition.height; *y -= menu_requisition.height;

View File

@ -22,8 +22,6 @@
#include <glib/gstdio.h> #include <glib/gstdio.h>
#undef GSEAL_ENABLE
#include "libgimp/gimp.h" #include "libgimp/gimp.h"
#include "libgimp/gimpui.h" #include "libgimp/gimpui.h"
@ -484,11 +482,18 @@ script_fu_browse_row_activated (GtkDialog *dialog)
static gboolean static gboolean
script_fu_console_idle_scroll_end (GtkWidget *view) script_fu_console_idle_scroll_end (GtkWidget *view)
{ {
GtkAdjustment *adj = GTK_TEXT_VIEW (view)->vadjustment; GtkWidget *parent = gtk_widget_get_parent (view);
gtk_adjustment_set_value (adj, if (parent)
gtk_adjustment_get_upper (adj) - {
gtk_adjustment_get_page_size (adj)); GtkAdjustment *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); g_object_unref (view);