Build with GSEAL_ENABLE and #undef it where accessors are missing

This commit is contained in:
Michael Natterer
2009-10-17 19:51:33 +02:00
parent fb1fdf49b4
commit 6608d66cde
7 changed files with 129 additions and 75 deletions

View File

@ -17,6 +17,8 @@
#include "config.h"
#undef GSEAL_ENABLE
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
@ -181,8 +183,7 @@ gimp_canvas_init (GimpCanvas *canvas)
GtkWidget *widget = GTK_WIDGET (canvas);
gint i;
GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (widget, TRUE);
gtk_widget_set_extension_events (widget, GDK_EXTENSION_EVENTS_ALL);
for (i = 0; i < GIMP_CANVAS_NUM_STYLES; i++)
@ -234,15 +235,18 @@ static void
gimp_canvas_realize (GtkWidget *widget)
{
GimpCanvas *canvas = GIMP_CANVAS (widget);
GtkAllocation allocation;
GdkWindowAttr attributes;
gint attributes_mask;
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
gtk_widget_get_allocation (widget, &allocation);
attributes.x = allocation.x;
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
@ -252,12 +256,15 @@ gimp_canvas_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gtk_widget_set_window (widget,
gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask));
gdk_window_set_user_data (gtk_widget_get_window (widget), widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, gtk_widget_get_window (widget),
widget->style = gtk_style_attach (gtk_widget_get_style (widget),
gtk_widget_get_window (widget));
gtk_style_set_background (gtk_widget_get_style (widget),
gtk_widget_get_window (widget),
GTK_STATE_NORMAL);
canvas->stipple[0] =
@ -302,7 +309,7 @@ static void
gimp_canvas_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
widget->allocation = *allocation;
gtk_widget_set_allocation (widget, allocation);
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (gtk_widget_get_window (widget),
@ -351,7 +358,7 @@ gimp_canvas_gc_new (GimpCanvas *canvas,
GdkColor fg = { 0, 0, 0, 0 };
GdkColor bg = { 0, 0, 0, 0 };
if (! GTK_WIDGET_REALIZED (canvas))
if (! GTK_WIDGET_REALIZED (GTK_WIDGET (canvas)))
return NULL;
switch (style)
@ -921,22 +928,26 @@ void
gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (canvas);
GtkStyle *style = gtk_widget_get_style (widget);
gdouble wilber_width;
gdouble wilber_height;
gdouble width;
gdouble height;
gdouble side;
gdouble factor;
GtkWidget *widget = GTK_WIDGET (canvas);
GtkStyle *style = gtk_widget_get_style (widget);
GtkStateType state = gtk_widget_get_state (widget);
GtkAllocation allocation;
gdouble wilber_width;
gdouble wilber_height;
gdouble width;
gdouble height;
gdouble side;
gdouble factor;
gtk_widget_get_allocation (widget, &allocation);
gimp_cairo_wilber_get_size (cr, &wilber_width, &wilber_height);
wilber_width /= 2;
wilber_height /= 2;
side = MIN (MIN (widget->allocation.width, widget->allocation.height),
MAX (widget->allocation.width, widget->allocation.height) / 2);
side = MIN (MIN (allocation.width, allocation.height),
MAX (allocation.width, allocation.height) / 2);
width = MAX (wilber_width, side);
height = MAX (wilber_height, side);
@ -949,12 +960,12 @@ gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
*/
gimp_cairo_wilber (cr,
- wilber_width * 0.6,
widget->allocation.height / factor - wilber_height * 1.1);
allocation.height / factor - wilber_height * 1.1);
cairo_set_source_rgba (cr,
style->fg[widget->state].red / 65535.0,
style->fg[widget->state].green / 65535.0,
style->fg[widget->state].blue / 65535.0,
style->fg[state].red / 65535.0,
style->fg[state].green / 65535.0,
style->fg[state].blue / 65535.0,
0.15);
cairo_fill (cr);
}

View File

@ -246,7 +246,7 @@ gimp_displays_get_num_visible (Gimp *gimp)
GimpDisplay *display = list->data;
GimpDisplayShell *shell = gimp_display_get_shell (display);
if (GTK_WIDGET_DRAWABLE (shell))
if (gtk_widget_is_drawable (GTK_WIDGET (shell)))
{
GtkWidget *toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));

View File

@ -17,6 +17,8 @@
#include "config.h"
#undef GSEAL_ENABLE
#include <stdlib.h>
#include <gegl.h>
@ -231,16 +233,19 @@ gimp_display_shell_canvas_realize (GtkWidget *canvas,
{
GimpCanvasPaddingMode padding_mode;
GimpRGB padding_color;
GtkAllocation allocation;
gtk_widget_grab_focus (shell->canvas);
gimp_display_shell_get_padding (shell, &padding_mode, &padding_color);
gimp_display_shell_set_padding (shell, padding_mode, &padding_color);
gtk_widget_get_allocation (canvas, &allocation);
gimp_display_shell_title_update (shell);
shell->disp_width = canvas->allocation.width;
shell->disp_height = canvas->allocation.height;
shell->disp_width = allocation.width;
shell->disp_height = allocation.height;
/* set up the scrollbar observers */
g_signal_connect (shell->hsbdata, "value-changed",
@ -661,7 +666,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
/* If the device (and maybe the tool) has changed, update the new
* tool's state
*/
if (device_changed && GTK_WIDGET_HAS_FOCUS (canvas))
if (device_changed && gtk_widget_has_focus (canvas))
{
gimp_display_shell_update_focus (shell, &image_coords, state);
}
@ -783,7 +788,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
* canvas immediately, therefore we do this before logging
* the BUTTON_PRESS.
*/
if (! GTK_WIDGET_HAS_FOCUS (canvas))
if (! gtk_widget_has_focus (canvas))
gtk_widget_grab_focus (canvas);
GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_PRESS (%d @ %0.0f:%0.0f)",
@ -795,7 +800,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
*
* this happens in "click to focus" mode.
*/
if (! GTK_WIDGET_HAS_FOCUS (canvas))
if (! gtk_widget_has_focus (canvas))
{
/* do the things a FOCUS_IN event would do and set a flag
* preventing it from doing the same.
@ -1750,7 +1755,7 @@ gimp_display_shell_ruler_button_press (GtkWidget *widget,
if (active_tool)
{
if (! GTK_WIDGET_HAS_FOCUS (shell->canvas))
if (! gtk_widget_has_focus (shell->canvas))
{
gimp_display_shell_update_focus (shell, NULL, event->state);

View File

@ -236,7 +236,7 @@ gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
{
shell->current_cursor = cursor_type;
if (GTK_WIDGET_DRAWABLE (shell->canvas))
if (gtk_widget_is_drawable (shell->canvas))
gdk_window_set_cursor (gtk_widget_get_window (shell->canvas), NULL);
return;

View File

@ -17,6 +17,8 @@
#include "config.h"
#undef GSEAL_ENABLE
#include <string.h>
#include <gegl.h>
@ -902,15 +904,13 @@ gimp_display_shell_new (GimpDisplay *display,
shell->hsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, image_width,
1, 1, image_width));
shell->hsb = gtk_hscrollbar_new (shell->hsbdata);
GTK_WIDGET_UNSET_FLAGS (shell->hsb, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (shell->hsb, FALSE);
/* the vertical scrollbar */
shell->vsbdata = GTK_ADJUSTMENT (gtk_adjustment_new (0, 0, image_height,
1, 1, image_height));
shell->vsb = gtk_vscrollbar_new (shell->vsbdata);
GTK_WIDGET_UNSET_FLAGS (shell->vsb, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (shell->vsb, FALSE);
/* create the contents of the inner_table ********************************/
@ -1025,7 +1025,7 @@ gimp_display_shell_new (GimpDisplay *display,
"width-request", 18,
"height-request", 18,
NULL);
GTK_WIDGET_UNSET_FLAGS (shell->zoom_button, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (shell->zoom_button, FALSE);
gtk_image = gtk_image_new_from_stock (GIMP_STOCK_ZOOM_FOLLOW_WINDOW,
GTK_ICON_SIZE_MENU);
@ -1049,7 +1049,7 @@ gimp_display_shell_new (GimpDisplay *display,
"width-request", 18,
"height-request", 18,
NULL);
GTK_WIDGET_UNSET_FLAGS (shell->quick_mask_button, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (shell->quick_mask_button, FALSE);
gtk_image = gtk_image_new_from_stock (GIMP_STOCK_QUICK_MASK_OFF,
GTK_ICON_SIZE_MENU);

View File

@ -17,6 +17,8 @@
#include "config.h"
#undef GSEAL_ENABLE
#include <gegl.h>
#include <gtk/gtk.h>
@ -419,12 +421,15 @@ gimp_image_window_configure_event (GtkWidget *widget,
GdkEventConfigure *event)
{
GimpImageWindow *window = GIMP_IMAGE_WINDOW (widget);
GtkAllocation allocation;
gint current_width;
gint current_height;
gtk_widget_get_allocation (widget, &allocation);
/* Grab the size before we run the parent implementation */
current_width = widget->allocation.width;
current_height = widget->allocation.height;
current_width = allocation.width;
current_height = allocation.height;
/* Run the parent implementation */
if (GTK_WIDGET_CLASS (parent_class)->configure_event)
@ -748,7 +753,7 @@ gimp_image_window_get_show_menubar (GimpImageWindow *window)
private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
return GTK_WIDGET_VISIBLE (private->menubar);
return gtk_widget_get_visible (private->menubar);
}
void
@ -761,7 +766,7 @@ gimp_image_window_set_show_docks (GimpImageWindow *window,
private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
gtk_widget_set_visible (private->left_docks, show);
gtk_widget_set_visible (private->left_docks, show);
gtk_widget_set_visible (private->right_docks, show);
}
@ -774,8 +779,8 @@ gimp_image_window_get_show_docks (GimpImageWindow *window)
private = GIMP_IMAGE_WINDOW_GET_PRIVATE (window);
return (GTK_WIDGET_VISIBLE (private->left_docks) &&
GTK_WIDGET_VISIBLE (private->right_docks));
return (gtk_widget_get_visible (private->left_docks) &&
gtk_widget_get_visible (private->right_docks));
}
gboolean
@ -798,6 +803,7 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
GimpDisplayShell *active_shell;
GimpImage *image;
GtkWidget *widget;
GtkAllocation allocation;
GdkScreen *screen;
GdkRectangle rect;
gint monitor;
@ -823,6 +829,8 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
widget = GTK_WIDGET (window);
screen = gtk_widget_get_screen (widget);
gtk_widget_get_allocation (widget, &allocation);
monitor = gdk_screen_get_monitor_at_window (screen,
gtk_widget_get_window (widget));
gdk_screen_get_monitor_geometry (screen, monitor, &rect);
@ -843,14 +851,30 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
* the normal approach to border size, so special case that.
*/
if (disp_width > 1 || !active_shell->vsb)
border_width = widget->allocation.width - disp_width;
{
border_width = allocation.width - disp_width;
}
else
border_width = widget->allocation.width - disp_width + active_shell->vsb->allocation.width;
{
GtkAllocation vsb_allocation;
gtk_widget_get_allocation (active_shell->vsb, &vsb_allocation);
border_width = allocation.width - disp_width + vsb_allocation.width;
}
if (disp_height > 1 || !active_shell->hsb)
border_height = widget->allocation.height - disp_height;
{
border_height = allocation.height - disp_height;
}
else
border_height = widget->allocation.height - disp_height + active_shell->hsb->allocation.height;
{
GtkAllocation hsb_allocation;
gtk_widget_get_allocation (active_shell->hsb, &hsb_allocation);
border_height = allocation.height - disp_height + hsb_allocation.height;
}
max_auto_width = (rect.width - border_width) * 0.75;
@ -887,20 +911,24 @@ gimp_image_window_shrink_wrap (GimpImageWindow *window,
if (resize)
{
GimpStatusbar *statusbar = gimp_display_shell_get_statusbar (active_shell);
gint statusbar_width;
if (width < GTK_WIDGET (statusbar)->requisition.width)
width = GTK_WIDGET (statusbar)->requisition.width;
gtk_widget_get_size_request (GTK_WIDGET (statusbar),
&statusbar_width, NULL);
if (width < statusbar_width)
width = statusbar_width;
width = width + border_width;
height = height + border_height;
if (grow_only)
{
if (width < widget->allocation.width)
width = widget->allocation.width;
if (width < allocation.width)
width = allocation.width;
if (height < widget->allocation.height)
height = widget->allocation.height;
if (height < allocation.height)
height = allocation.height;
}
gtk_window_resize (GTK_WINDOW (window), width, height);
@ -1061,8 +1089,12 @@ gimp_image_window_image_notify (GimpDisplay *display,
}
else
{
width = GTK_WIDGET (window)->allocation.width;
height = GTK_WIDGET (window)->allocation.height;
GtkAllocation allocation;
gtk_widget_get_allocation (GTK_WIDGET (window), &allocation);
width = allocation.width;
height = allocation.height;
}
gimp_dialog_factory_add_foreign (private->display_factory,

View File

@ -19,6 +19,8 @@
#include <string.h>
#undef GSEAL_ENABLE
#include <gegl.h>
#include <gtk/gtk.h>
@ -194,7 +196,7 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
statusbar->unit_combo = gimp_unit_combo_box_new_with_model (store);
g_object_unref (store);
GTK_WIDGET_UNSET_FLAGS (statusbar->unit_combo, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (statusbar->unit_combo, FALSE);
g_object_set (statusbar->unit_combo, "focus-on-click", FALSE, NULL);
gtk_box_pack_start (GTK_BOX (hbox), statusbar->unit_combo, FALSE, FALSE, 0);
gtk_widget_show (statusbar->unit_combo);
@ -204,7 +206,7 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
statusbar);
statusbar->scale_combo = gimp_scale_combo_box_new ();
GTK_WIDGET_UNSET_FLAGS (statusbar->scale_combo, GTK_CAN_FOCUS);
gtk_widget_set_can_focus (statusbar->scale_combo, FALSE);
g_object_set (statusbar->scale_combo, "focus-on-click", FALSE, NULL);
gtk_box_pack_start (GTK_BOX (hbox), statusbar->scale_combo, FALSE, FALSE, 0);
gtk_widget_show (statusbar->scale_combo);
@ -235,12 +237,12 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
/* don't show the progress bar */
statusbar->cancel_button = gtk_button_new ();
gtk_widget_set_can_focus (statusbar->cancel_button, FALSE);
gtk_button_set_relief (GTK_BUTTON (statusbar->cancel_button),
GTK_RELIEF_NONE);
gtk_widget_set_sensitive (statusbar->cancel_button, FALSE);
gtk_box_pack_start (GTK_BOX (hbox),
statusbar->cancel_button, FALSE, FALSE, 0);
GTK_WIDGET_UNSET_FLAGS (statusbar->cancel_button, GTK_CAN_FOCUS);
/* don't show the cancel button */
image = gtk_image_new_from_stock (GTK_STOCK_CANCEL, GTK_ICON_SIZE_MENU);
@ -371,13 +373,13 @@ gimp_statusbar_progress_start (GimpProgress *progress,
*/
gtk_container_resize_children (GTK_CONTAINER (statusbar));
if (! GTK_WIDGET_VISIBLE (statusbar))
if (! gtk_widget_get_visible (GTK_WIDGET (statusbar)))
{
gtk_widget_show (GTK_WIDGET (statusbar));
statusbar->progress_shown = TRUE;
}
if (GTK_WIDGET_DRAWABLE (bar))
if (gtk_widget_is_drawable (bar))
gdk_window_process_updates (gtk_widget_get_window (bar), TRUE);
gimp_statusbar_override_window_title (statusbar);
@ -439,7 +441,7 @@ gimp_statusbar_progress_set_text (GimpProgress *progress,
gimp_statusbar_replace (statusbar, "progress", NULL, "%s", message);
if (GTK_WIDGET_DRAWABLE (bar))
if (gtk_widget_is_drawable (bar))
gdk_window_process_updates (gtk_widget_get_window (bar), TRUE);
gimp_statusbar_override_window_title (statusbar);
@ -454,18 +456,21 @@ gimp_statusbar_progress_set_value (GimpProgress *progress,
if (statusbar->progress_active)
{
GtkWidget *bar = statusbar->progressbar;
GtkWidget *bar = statusbar->progressbar;
GtkAllocation allocation;
gtk_widget_get_allocation (bar, &allocation);
statusbar->progress_value = percentage;
/* only update the progress bar if this causes a visible change */
if (fabs (bar->allocation.width *
if (fabs (allocation.width *
(percentage -
gtk_progress_bar_get_fraction (GTK_PROGRESS_BAR (bar)))) > 1.0)
{
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), percentage);
if (GTK_WIDGET_DRAWABLE (bar))
if (gtk_widget_is_drawable (bar))
gdk_window_process_updates (gtk_widget_get_window (bar), TRUE);
}
}
@ -477,9 +482,7 @@ gimp_statusbar_progress_get_value (GimpProgress *progress)
GimpStatusbar *statusbar = GIMP_STATUSBAR (progress);
if (statusbar->progress_active)
{
return statusbar->progress_value;
}
return statusbar->progress_value;
return 0.0;
}
@ -495,7 +498,7 @@ gimp_statusbar_progress_pulse (GimpProgress *progress)
gtk_progress_bar_pulse (GTK_PROGRESS_BAR (bar));
if (GTK_WIDGET_DRAWABLE (bar))
if (gtk_widget_is_drawable (bar))
gdk_window_process_updates (gtk_widget_get_window (bar), TRUE);
}
}
@ -524,11 +527,14 @@ gimp_statusbar_progress_message (GimpProgress *progress,
if (pango_layout_get_line_count (layout) == 1)
{
gint width;
GtkAllocation label_allocation;
gint width;
gtk_widget_get_allocation (label, &label_allocation);
pango_layout_get_pixel_size (layout, &width, NULL);
if (width < label->allocation.width)
if (width < label_allocation.width)
{
if (stock_id)
{
@ -541,7 +547,7 @@ gimp_statusbar_progress_message (GimpProgress *progress,
g_object_unref (pixbuf);
handle_msg = (width < label->allocation.width);
handle_msg = (width < label_allocation.width);
}
else
{
@ -704,7 +710,7 @@ gimp_statusbar_get_visible (GimpStatusbar *statusbar)
if (statusbar->progress_shown)
return FALSE;
return GTK_WIDGET_VISIBLE (statusbar);
return gtk_widget_get_visible (GTK_WIDGET (statusbar));
}
void