Commit c590c6aa authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/display/gimpdisplayshell-callbacks.c

2003-10-28  Sven Neumann  <sven@gimp.org>

	* app/display/gimpdisplayshell-callbacks.c
	* app/display/gimpdisplayshell-layer-select.c
	* app/widgets/gimpcontainerpopup.c
	* app/widgets/gimphistogramview.c
	* app/widgets/gimpnavigationpreview.c
	* libgimpwidgets/gimpcolorselect.c
	* libgimpwidgets/gimpoffsetarea.c
	* libgimpwidgets/gimppickbutton.c: use multihead safe variants of
	the unsafe functions gdk_pointer_ungrab(), gdk_keyboard_ungrab()
	and gdk_device_get_core_pointer().

	* plug-ins/libgck/gck/gck.h
	* plug-ins/libgck/gck/gckcolor.c: made libgck multi-head safe.

	* plug-ins/Lighting/lighting_ui.c
	* plug-ins/MapObject/mapobject_preview.c
	* plug-ins/MapObject/mapobject_ui.c: changed accordingly.

	* plug-ins/common/animationplay.c
	* plug-ins/common/curve_bend.c
	* plug-ins/gfig/gfig.c
	* plug-ins/imagemap/imap_preview.c: use multihead safe GDK API.
parent 662218d6
2003-10-28 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-layer-select.c
* app/widgets/gimpcontainerpopup.c
* app/widgets/gimphistogramview.c
* app/widgets/gimpnavigationpreview.c
* libgimpwidgets/gimpcolorselect.c
* libgimpwidgets/gimpoffsetarea.c
* libgimpwidgets/gimppickbutton.c: use multihead safe variants of
the unsafe functions gdk_pointer_ungrab(), gdk_keyboard_ungrab()
and gdk_device_get_core_pointer().
* plug-ins/libgck/gck/gck.h
* plug-ins/libgck/gck/gckcolor.c: made libgck multi-head safe.
* plug-ins/Lighting/lighting_ui.c
* plug-ins/MapObject/mapobject_preview.c
* plug-ins/MapObject/mapobject_ui.c: changed accordingly.
* plug-ins/common/animationplay.c
* plug-ins/common/curve_bend.c
* plug-ins/gfig/gfig.c
* plug-ins/imagemap/imap_preview.c: use multihead safe GDK API.
2003-10-29 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.c
......@@ -32,7 +57,8 @@
* app/composite/gimp-composite-regression.c: Added functions to
print the pixels in their various formats.
* app/composite/gimp-composite-{mmx,sse,sse2,altivec,vis}.c: Regenerated
* app/composite/gimp-composite-{mmx,sse,sse2,altivec,vis}.c:
Regenerated.
* app/composite/gimp-composite-{mmx,sse,sse2}.c: Removed the dodge
optimisation because it has the same problem that the divide
......@@ -1543,8 +1543,11 @@ prefs_dialog_new (Gimp *gimp,
/* 8-Bit Displays */
vbox2 = prefs_frame_new (_("8-Bit Displays"), GTK_CONTAINER (vbox), FALSE);
/* disabling this entry is not multi-head safe */
#if 0
if (gdk_rgb_get_visual ()->depth != 8)
gtk_widget_set_sensitive (GTK_WIDGET (vbox2->parent), FALSE);
#endif
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
......
......@@ -401,6 +401,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
GimpDisplay *gdisp;
GimpImage *gimage;
Gimp *gimp;
GdkDisplay *gdk_display;
GimpCoords display_coords;
GimpCoords image_coords;
GdkModifierType state;
......@@ -443,6 +444,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
&display_coords,
&image_coords);
gdk_display = gtk_widget_get_display (canvas);
switch (event->type)
{
case GDK_ENTER_NOTIFY:
......@@ -547,6 +550,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
case GDK_BUTTON_PRESS:
{
GdkEventButton *bevent;
GdkEventMask event_mask;
GimpTool *active_tool;
bevent = (GdkEventButton *) event;
......@@ -582,31 +586,26 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
case 1:
state |= GDK_BUTTON1_MASK;
if (((gimp_tool_control_motion_mode (active_tool->control) ==
GIMP_MOTION_MODE_EXACT) &&
GIMP_DISPLAY_CONFIG (gimp->config)->perfect_mouse) ||
event_mask = (GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK);
if (! GIMP_DISPLAY_CONFIG (gimp->config)->perfect_mouse &&
(gimp_tool_control_motion_mode (active_tool->control) !=
GIMP_MOTION_MODE_EXACT))
{
/* don't request motion hins for XInput devices because
* the wacom driver is known to report crappy hints
* (#6901) --mitch
*/
(gimp_devices_get_current (gimp) !=
gdk_device_get_core_pointer ()))
{
gdk_pointer_grab (canvas->window, FALSE,
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, time);
}
else
{
gdk_pointer_grab (canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, time);
if (gimp_devices_get_current (gimp) ==
gdk_display_get_core_pointer (gdk_display))
{
event_mask |= (GDK_POINTER_MOTION_HINT_MASK);
}
}
gdk_pointer_grab (canvas->window,
FALSE, event_mask, NULL, NULL, time);
if (! shell->space_pressed && ! shell->space_release_pending)
gdk_keyboard_grab (canvas->window, FALSE, time);
......@@ -734,9 +733,9 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
gdisp);
if (! shell->space_pressed && ! shell->space_release_pending)
gdk_keyboard_ungrab (time);
gdk_display_keyboard_ungrab (gdk_display, time);
gdk_pointer_ungrab (time);
gdk_display_pointer_ungrab (gdk_display, time);
if (shell->space_release_pending)
{
......@@ -755,7 +754,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
shell->space_release_pending = FALSE;
gdk_keyboard_ungrab (time);
gdk_display_keyboard_ungrab (gdk_display, time);
}
break;
......@@ -1110,7 +1109,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
shell->space_pressed = FALSE;
gdk_keyboard_ungrab (time);
gdk_display_keyboard_ungrab (gdk_display, time);
}
return_val = TRUE;
......
......@@ -163,7 +163,8 @@ static void
layer_select_destroy (LayerSelect *layer_select,
guint32 time)
{
gdk_keyboard_ungrab (time);
gdk_display_keyboard_ungrab (gtk_widget_get_display (layer_select->shell),
time);
gtk_widget_destroy (layer_select->shell);
......
......@@ -105,7 +105,7 @@ gimp_display_shell_selection_create (GdkWindow *win,
{
GdkVisual *visual;
visual = gdk_rgb_get_visual ();
visual = gdk_screen_get_rgb_visual (gdk_drawable_get_screen (win));
cycled_ants_pixmap = create_cycled_ants_pixmap (win, visual->depth);
}
......
......@@ -1543,8 +1543,11 @@ prefs_dialog_new (Gimp *gimp,
/* 8-Bit Displays */
vbox2 = prefs_frame_new (_("8-Bit Displays"), GTK_CONTAINER (vbox), FALSE);
/* disabling this entry is not multi-head safe */
#if 0
if (gdk_rgb_get_visual ()->depth != 8)
gtk_widget_set_sensitive (GTK_WIDGET (vbox2->parent), FALSE);
#endif
table = prefs_table_new (1, GTK_CONTAINER (vbox2), FALSE);
......
......@@ -358,6 +358,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
GimpPaintCore *core;
GimpBrush *current_brush;
GimpDrawable *drawable;
GdkDisplay *gdk_display;
GimpCoords curr_coords;
gint off_x, off_y;
......@@ -365,6 +366,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
paint_tool = GIMP_PAINT_TOOL (tool);
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
gdk_display = gtk_widget_get_display (gdisp->shell);
core = paint_tool->core;
drawable = gimp_image_active_drawable (gdisp->gimage);
......@@ -393,7 +396,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
}
core->use_pressure = (gimp_devices_get_current (gdisp->gimage->gimp) !=
gdk_device_get_core_pointer ());
gdk_display_get_core_pointer (gdk_display));
if (! gimp_paint_core_start (core, drawable, paint_options, &curr_coords))
return;
......
......@@ -358,6 +358,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
GimpPaintCore *core;
GimpBrush *current_brush;
GimpDrawable *drawable;
GdkDisplay *gdk_display;
GimpCoords curr_coords;
gint off_x, off_y;
......@@ -365,6 +366,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
paint_tool = GIMP_PAINT_TOOL (tool);
paint_options = GIMP_PAINT_OPTIONS (tool->tool_info->tool_options);
gdk_display = gtk_widget_get_display (gdisp->shell);
core = paint_tool->core;
drawable = gimp_image_active_drawable (gdisp->gimage);
......@@ -393,7 +396,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
}
core->use_pressure = (gimp_devices_get_current (gdisp->gimage->gimp) !=
gdk_device_get_core_pointer ());
gdk_display_get_core_pointer (gdk_display));
if (! gimp_paint_core_start (core, drawable, paint_options, &curr_coords))
return;
......
......@@ -227,7 +227,7 @@ gimp_container_popup_map (GtkWidget *widget)
}
else
{
gdk_display_pointer_ungrab (gdk_drawable_get_display (widget->window),
gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
GDK_CURRENT_TIME);
}
}
......
......@@ -80,7 +80,7 @@ gimp_devices_init (Gimp *gimp,
manager->device_info_list = gimp_list_new (GIMP_TYPE_DEVICE_INFO,
GIMP_CONTAINER_POLICY_STRONG);
manager->current_device = gdk_device_get_core_pointer ();
manager->current_device = gdk_display_get_core_pointer (gdk_display_get_default ());
manager->change_notify = change_notify;
/* create device info structures for present devices */
......
......@@ -328,7 +328,8 @@ gimp_histogram_view_events (GimpHistogramView *view,
case GDK_BUTTON_RELEASE:
bevent = (GdkEventButton *) event;
gdk_pointer_ungrab (bevent->time);
gdk_display_pointer_ungrab (gtk_widget_get_display (GTK_WIDGET (view)),
bevent->time);
{
gint start, end;
......
......@@ -61,13 +61,13 @@ static gboolean gimp_navigation_preview_expose (GtkWidget *widget,
GdkEventExpose *eevent);
static gboolean gimp_navigation_preview_button_press (GtkWidget *widget,
GdkEventButton *bevent);
static gboolean gimp_navigation_preview_button_release (GtkWidget *widget,
static gboolean gimp_navigation_preview_button_release (GtkWidget *widget,
GdkEventButton *bevent);
static gboolean gimp_navigation_preview_scroll (GtkWidget *widget,
static gboolean gimp_navigation_preview_scroll (GtkWidget *widget,
GdkEventScroll *sevent);
static gboolean gimp_navigation_preview_motion_notify (GtkWidget *widget,
static gboolean gimp_navigation_preview_motion_notify (GtkWidget *widget,
GdkEventMotion *mevent);
static gboolean gimp_navigation_preview_key_press (GtkWidget *widget,
static gboolean gimp_navigation_preview_key_press (GtkWidget *widget,
GdkEventKey *kevent);
static void gimp_navigation_preview_transform (GimpNavigationPreview *nav_preview);
......@@ -119,7 +119,7 @@ gimp_navigation_preview_class_init (GimpNavigationPreviewClass *klass)
parent_class = g_type_class_peek_parent (klass);
preview_signals[MARKER_CHANGED] =
preview_signals[MARKER_CHANGED] =
g_signal_new ("marker_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
......@@ -217,7 +217,7 @@ gimp_navigation_preview_realize (GtkWidget *widget)
gdk_gc_set_function (nav_preview->gc, GDK_INVERT);
gdk_gc_set_line_attributes (nav_preview->gc,
BORDER_PEN_WIDTH,
BORDER_PEN_WIDTH,
GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_ROUND);
}
......@@ -274,13 +274,13 @@ gimp_navigation_preview_move_to (GimpNavigationPreview *nav_preview,
(preview->renderer->width - nav_preview->p_width));
else
ratiox = 1.0;
if (preview->renderer->height != nav_preview->p_height)
ratioy = ((gimage->height - nav_preview->height + 1.0) /
(preview->renderer->height - nav_preview->p_height));
else
ratioy = 1.0;
x = tx * ratiox;
y = ty * ratioy;
......@@ -309,7 +309,7 @@ gimp_navigation_preview_grab_pointer (GimpNavigationPreview *nav_preview)
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK |
GDK_EXTENSION_EVENTS_ALL,
window, cursor, 0);
window, cursor, GDK_CURRENT_TIME);
gdk_cursor_unref (cursor);
}
......@@ -365,7 +365,7 @@ gimp_navigation_preview_button_press (GtkWidget *widget,
}
static gboolean
gimp_navigation_preview_button_release (GtkWidget *widget,
gimp_navigation_preview_button_release (GtkWidget *widget,
GdkEventButton *bevent)
{
GimpNavigationPreview *nav_preview;
......@@ -378,7 +378,8 @@ gimp_navigation_preview_button_release (GtkWidget *widget,
nav_preview->has_grab = FALSE;
gtk_grab_remove (widget);
gdk_pointer_ungrab (0);
gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
GDK_CURRENT_TIME);
break;
default:
......@@ -389,7 +390,7 @@ gimp_navigation_preview_button_release (GtkWidget *widget,
}
static gboolean
gimp_navigation_preview_scroll (GtkWidget *widget,
gimp_navigation_preview_scroll (GtkWidget *widget,
GdkEventScroll *sevent)
{
GimpNavigationPreview *nav_preview;
......@@ -430,7 +431,7 @@ gimp_navigation_preview_scroll (GtkWidget *widget,
}
static gboolean
gimp_navigation_preview_motion_notify (GtkWidget *widget,
gimp_navigation_preview_motion_notify (GtkWidget *widget,
GdkEventMotion *mevent)
{
GimpNavigationPreview *nav_preview;
......@@ -482,7 +483,7 @@ gimp_navigation_preview_motion_notify (GtkWidget *widget,
}
static gboolean
gimp_navigation_preview_key_press (GtkWidget *widget,
gimp_navigation_preview_key_press (GtkWidget *widget,
GdkEventKey *kevent)
{
GimpNavigationPreview *nav_preview;
......
......@@ -61,13 +61,13 @@ static gboolean gimp_navigation_preview_expose (GtkWidget *widget,
GdkEventExpose *eevent);
static gboolean gimp_navigation_preview_button_press (GtkWidget *widget,
GdkEventButton *bevent);
static gboolean gimp_navigation_preview_button_release (GtkWidget *widget,
static gboolean gimp_navigation_preview_button_release (GtkWidget *widget,
GdkEventButton *bevent);
static gboolean gimp_navigation_preview_scroll (GtkWidget *widget,
static gboolean gimp_navigation_preview_scroll (GtkWidget *widget,
GdkEventScroll *sevent);
static gboolean gimp_navigation_preview_motion_notify (GtkWidget *widget,
static gboolean gimp_navigation_preview_motion_notify (GtkWidget *widget,
GdkEventMotion *mevent);
static gboolean gimp_navigation_preview_key_press (GtkWidget *widget,
static gboolean gimp_navigation_preview_key_press (GtkWidget *widget,
GdkEventKey *kevent);
static void gimp_navigation_preview_transform (GimpNavigationPreview *nav_preview);
......@@ -119,7 +119,7 @@ gimp_navigation_preview_class_init (GimpNavigationPreviewClass *klass)
parent_class = g_type_class_peek_parent (klass);
preview_signals[MARKER_CHANGED] =
preview_signals[MARKER_CHANGED] =
g_signal_new ("marker_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
......@@ -217,7 +217,7 @@ gimp_navigation_preview_realize (GtkWidget *widget)
gdk_gc_set_function (nav_preview->gc, GDK_INVERT);
gdk_gc_set_line_attributes (nav_preview->gc,
BORDER_PEN_WIDTH,
BORDER_PEN_WIDTH,
GDK_LINE_SOLID, GDK_CAP_BUTT, GDK_JOIN_ROUND);
}
......@@ -274,13 +274,13 @@ gimp_navigation_preview_move_to (GimpNavigationPreview *nav_preview,
(preview->renderer->width - nav_preview->p_width));
else
ratiox = 1.0;
if (preview->renderer->height != nav_preview->p_height)
ratioy = ((gimage->height - nav_preview->height + 1.0) /
(preview->renderer->height - nav_preview->p_height));
else
ratioy = 1.0;
x = tx * ratiox;
y = ty * ratioy;
......@@ -309,7 +309,7 @@ gimp_navigation_preview_grab_pointer (GimpNavigationPreview *nav_preview)
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON_MOTION_MASK |
GDK_EXTENSION_EVENTS_ALL,
window, cursor, 0);
window, cursor, GDK_CURRENT_TIME);
gdk_cursor_unref (cursor);
}
......@@ -365,7 +365,7 @@ gimp_navigation_preview_button_press (GtkWidget *widget,
}
static gboolean
gimp_navigation_preview_button_release (GtkWidget *widget,
gimp_navigation_preview_button_release (GtkWidget *widget,
GdkEventButton *bevent)
{
GimpNavigationPreview *nav_preview;
......@@ -378,7 +378,8 @@ gimp_navigation_preview_button_release (GtkWidget *widget,
nav_preview->has_grab = FALSE;
gtk_grab_remove (widget);
gdk_pointer_ungrab (0);
gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
GDK_CURRENT_TIME);
break;
default:
......@@ -389,7 +390,7 @@ gimp_navigation_preview_button_release (GtkWidget *widget,
}
static gboolean
gimp_navigation_preview_scroll (GtkWidget *widget,
gimp_navigation_preview_scroll (GtkWidget *widget,
GdkEventScroll *sevent)
{
GimpNavigationPreview *nav_preview;
......@@ -430,7 +431,7 @@ gimp_navigation_preview_scroll (GtkWidget *widget,
}
static gboolean
gimp_navigation_preview_motion_notify (GtkWidget *widget,
gimp_navigation_preview_motion_notify (GtkWidget *widget,
GdkEventMotion *mevent)
{
GimpNavigationPreview *nav_preview;
......@@ -482,7 +483,7 @@ gimp_navigation_preview_motion_notify (GtkWidget *widget,
}
static gboolean
gimp_navigation_preview_key_press (GtkWidget *widget,
gimp_navigation_preview_key_press (GtkWidget *widget,
GdkEventKey *kevent)
{
GimpNavigationPreview *nav_preview;
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpcolorselect.c
* Copyright (C) 2002 Michael Natterer <mitch@gimp.org>
......@@ -11,10 +11,10 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
......@@ -240,7 +240,7 @@ gimp_color_select_get_type (void)
};
select_type = g_type_register_static (GIMP_TYPE_COLOR_SELECTOR,
"GimpColorSelect",
"GimpColorSelect",
&select_info, 0);
}
......@@ -353,7 +353,7 @@ gimp_color_select_init (GimpColorSelect *select)
{
N_("_H"), N_("_S"), N_("_V"), N_("_R"), N_("_G"), N_("_B")
};
static const gchar *tips[7] =
static const gchar *tips[7] =
{
N_("Hue"),
N_("Saturation"),
......@@ -719,7 +719,8 @@ gimp_color_select_xy_events (GtkWidget *widget,
x = bevent->x;
y = bevent->y;
gdk_pointer_ungrab (bevent->time);
gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
bevent->time);
break;
case GDK_MOTION_NOTIFY:
......@@ -743,10 +744,10 @@ gimp_color_select_xy_events (GtkWidget *widget,
select->pos[0] = (x * 255) / (XY_DEF_WIDTH - 1);
select->pos[1] = 255 - (y * 255) / (XY_DEF_HEIGHT - 1);
select->pos[0] = CLAMP (select->pos[0], 0, 255);
select->pos[1] = CLAMP (select->pos[1], 0, 255);
gimp_color_select_draw_xy_marker (select, NULL);
gimp_color_select_update (select, UPDATE_VALUES | UPDATE_CALLER);
......@@ -792,7 +793,8 @@ gimp_color_select_z_events (GtkWidget *widget,
bevent = (GdkEventButton *) event;
z = bevent->y;
gdk_pointer_ungrab (bevent->time);
gdk_display_pointer_ungrab (gtk_widget_get_display (widget),
bevent->time);
break;
case GDK_MOTION_NOTIFY:
......@@ -812,7 +814,7 @@ gimp_color_select_z_events (GtkWidget *widget,
}
gimp_color_select_draw_z_marker (select, NULL);
select->pos[2] = 255 - (z * 255) / (Z_DEF_HEIGHT - 1);
select->pos[2] = CLAMP (select->pos[2], 0, 255);
......
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpoffsetarea.c
* Copyright (C) 2001 Sven Neumann <sven@gimp.org>
......@@ -8,7 +8,7 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
......@@ -93,13 +93,13 @@ gimp_offset_area_class_init (GimpOffsetAreaClass *klass)
parent_class = g_type_class_peek_parent (klass);
gimp_offset_area_signals[OFFSETS_CHANGED] =
gimp_offset_area_signals[OFFSETS_CHANGED] =
g_signal_new ("offsets_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpOffsetAreaClass, offsets_changed),
NULL, NULL,
_gimp_widgets_marshal_VOID__INT_INT,
_gimp_widgets_marshal_VOID__INT_INT,
G_TYPE_NONE, 2,
G_TYPE_INT,
G_TYPE_INT);
......@@ -119,7 +119,7 @@ gimp_offset_area_init (GimpOffsetArea *offset_area)
offset_area->display_ratio_x = 1.0;
offset_area->display_ratio_y = 1.0;
gtk_widget_add_events (GTK_WIDGET (offset_area),
gtk_widget_add_events (GTK_WIDGET (offset_area),
GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);
}
......@@ -127,11 +127,11 @@ gimp_offset_area_init (GimpOffsetArea *offset_area)
* gimp_offset_area_new:
* @orig_width: the original width
* @orig_height: the original height
*
* Creates a new #GimpOffsetArea widget. A #GimpOffsetArea can be used
* when resizing an image or a drawable to allow the user to interactively
*
* Creates a new #GimpOffsetArea widget. A #GimpOffsetArea can be used
* when resizing an image or a drawable to allow the user to interactively
* specify the new offsets.
*
*
* Return value: the new #GimpOffsetArea widget.
**/
GtkWidget *
......@@ -158,7 +158,7 @@ gimp_offset_area_new (gint orig_width,
* @offset_area: a #GimpOffsetArea.
* @width: the new width
* @height: the new height
*
*
* Sets the size of the image/drawable displayed by the #GimpOffsetArea.
* If the offsets change as a result of this change, the %offsets_changed
* signal is emitted.
......@@ -172,26 +172,26 @@ gimp_offset_area_set_size (GimpOffsetArea *offset_area,
gint offset_y;
g_return_if_fail (GIMP_IS_OFFSET_AREA (offset_area));
g_return_if_fail (width > 0 && height > 0);
if (offset_area->width != width || offset_area->height != height)
{
offset_area->width = width;
offset_area->width = width;
offset_area->height = height;
if (offset_area->orig_width <= offset_area->width)
offset_x = CLAMP (offset_area->offset_x,
offset_x = CLAMP (offset_area->offset_x,
0, offset_area->width - offset_area->orig_width);
else
offset_x = CLAMP (offset_area->offset_x,
offset_x = CLAMP (offset_area->offset_x,
offset_area->width - offset_area->orig_width, 0);
if (offset_area->orig_height <= offset_area->height)
offset_y = CLAMP (offset_area->offset_y,
offset_y = CLAMP (offset_area->offset_y,
0, offset_area->height - offset_area->orig_height);
else
offset_y = CLAMP (offset_area->offset_y,
offset_y = CLAMP (offset_area->offset_y,
offset_area->height - offset_area->orig_height, 0);
offset_area->offset_x = offset_x;
......@@ -203,9 +203,9 @@ gimp_offset_area_set_size (GimpOffsetArea *offset_area,
if (offset_x != offset_area->offset_x ||
offset_y != offset_area->offset_y)
{
g_signal_emit (offset_area,
gimp_offset_area_signals[OFFSETS_CHANGED], 0,
offset_area->offset_x,
g_signal_emit (offset_area,
gimp_offset_area_signals[OFFSETS_CHANGED], 0,
offset_area->offset_x,
offset_area->offset_y);
}
}
......@@ -216,7 +216,7 @@ gimp_offset_area_set_size (GimpOffsetArea *offset_area,
* @offset_area: a #GimpOffsetArea.
* @offset_x: the X offset
* @offset_y: the Y offset
*
*
* Sets the offsets of the image/drawable displayed by the #GimpOffsetArea.
* It does not emit the %offsets_changed signal.
**/
......@@ -226,21 +226,21 @@ gimp_offset_area_set_offsets (GimpOffsetArea *offset_area,
gint offset_y)
{
g_return_if_fail (GIMP_IS_OFFSET_AREA (offset_area));
if (offset_area->offset_x != offset_x || offset_area->offset_y != offset_y)
{
if (offset_area->orig_width <= offset_area->width)
offset_area->offset_x =
offset_area->offset_x =
CLAMP (offset_x, 0, offset_area->width - offset_area->orig_width);
else
offset_area->offset_x =
offset_area->offset_x =
CLAMP (offset_x, offset_area->width - offset_area->orig_width, 0);
if (offset_area->orig_height <= offset_area->height)
offset_area->offset_y =
offset_area->offset_y =
CLAMP (offset_y, 0, offset_area->height - offset_area->orig_height);
else
offset_area->offset_y =
offset_area->offset_y =
CLAMP (offset_y, offset_area->height - offset_area->orig_height, 0);
gtk_widget_queue_draw (GTK_WIDGET (offset_area));
......@@ -283,7 +283,7 @@ gimp_offset_area_event (GtkWidget *widget,
static gint orig_offset_y = 0;
static gint start_x = 0;
static gint start_y = 0;
GimpOffsetArea *offset_area = GIMP_OFFSET_AREA (widget);
GdkEventConfigure *conf_event;
gint offset_x;
......@@ -296,17 +296,17 @@ gimp_offset_area_event (GtkWidget *widget,
{
case GDK_CONFIGURE:
conf_event = (GdkEventConfigure *) event;
offset_area->display_ratio_x = (gdouble) conf_event->width /
offset_area->display_ratio_x = (gdouble) conf_event->width /
((offset_area->orig_width <= offset_area->width) ?
offset_area->width :
offset_area->width :
offset_area->orig_width * 2 - offset_area->width);
offset_area->display_ratio_y = (gdouble) conf_event->height /
offset_area->display_ratio_y = (gdouble) conf_event->height /
((offset_area->orig_height <= offset_area->height) ?
offset_area->height :
offset_area->height :
offset_area->orig_height * 2 - offset_area->height);
break;