2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1997-11-25 06:05:25 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1997-11-25 06:05:25 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1997-11-25 06:05:25 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2018-07-12 05:27:07 +08:00
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
1997-11-25 06:05:25 +08:00
|
|
|
*/
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2001-10-13 20:52:30 +08:00
|
|
|
#ifndef __GIMP_DISPLAY_SHELL_H__
|
|
|
|
#define __GIMP_DISPLAY_SHELL_H__
|
1997-11-25 06:05:25 +08:00
|
|
|
|
|
|
|
|
2004-03-21 05:59:41 +08:00
|
|
|
/* Apply to a float the same rounding mode used in the renderer */
|
2008-03-06 00:37:43 +08:00
|
|
|
#define PROJ_ROUND(coord) ((gint) RINT (coord))
|
|
|
|
#define PROJ_ROUND64(coord) ((gint64) RINT (coord))
|
2004-03-21 05:59:41 +08:00
|
|
|
|
2002-06-27 06:16:59 +08:00
|
|
|
/* scale values */
|
2007-03-14 18:26:19 +08:00
|
|
|
#define SCALEX(s,x) PROJ_ROUND ((x) * (s)->scale_x)
|
|
|
|
#define SCALEY(s,y) PROJ_ROUND ((y) * (s)->scale_y)
|
2002-06-27 06:16:59 +08:00
|
|
|
|
|
|
|
/* unscale values */
|
2007-03-14 18:26:19 +08:00
|
|
|
#define UNSCALEX(s,x) ((gint) ((x) / (s)->scale_x))
|
|
|
|
#define UNSCALEY(s,y) ((gint) ((y) / (s)->scale_y))
|
2002-06-27 06:16:59 +08:00
|
|
|
/* (and float-returning versions) */
|
2007-03-14 18:26:19 +08:00
|
|
|
#define FUNSCALEX(s,x) ((x) / (s)->scale_x)
|
|
|
|
#define FUNSCALEY(s,y) ((y) / (s)->scale_y)
|
2002-06-27 06:16:59 +08:00
|
|
|
|
|
|
|
|
2001-10-13 20:52:30 +08:00
|
|
|
#define GIMP_TYPE_DISPLAY_SHELL (gimp_display_shell_get_type ())
|
|
|
|
#define GIMP_DISPLAY_SHELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DISPLAY_SHELL, GimpDisplayShell))
|
|
|
|
#define GIMP_DISPLAY_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DISPLAY_SHELL, GimpDisplayShellClass))
|
|
|
|
#define GIMP_IS_DISPLAY_SHELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DISPLAY_SHELL))
|
|
|
|
#define GIMP_IS_DISPLAY_SHELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DISPLAY_SHELL))
|
|
|
|
#define GIMP_DISPLAY_SHELL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DISPLAY_SHELL, GimpDisplayShellClass))
|
|
|
|
|
|
|
|
|
|
|
|
typedef struct _GimpDisplayShellClass GimpDisplayShellClass;
|
|
|
|
|
|
|
|
struct _GimpDisplayShell
|
|
|
|
{
|
2017-02-23 07:31:39 +08:00
|
|
|
GtkEventBox parent_instance;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
GimpDisplay *display;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
GimpUIManager *popup_manager;
|
2018-04-29 23:27:47 +08:00
|
|
|
GdkMonitor *initial_monitor;
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2008-11-16 07:16:04 +08:00
|
|
|
GimpDisplayOptions *options;
|
|
|
|
GimpDisplayOptions *fullscreen_options;
|
|
|
|
GimpDisplayOptions *no_image_options;
|
2002-11-24 06:22:21 +08:00
|
|
|
|
2008-11-16 07:16:04 +08:00
|
|
|
GimpUnit unit;
|
2002-06-27 06:16:59 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
gint offset_x; /* offset of display image */
|
|
|
|
gint offset_y;
|
2001-11-02 17:31:21 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
gdouble scale_x; /* horizontal scale factor */
|
|
|
|
gdouble scale_y; /* vertical scale factor */
|
2007-03-14 18:01:08 +08:00
|
|
|
|
2015-11-14 01:51:32 +08:00
|
|
|
gboolean flip_horizontally;
|
|
|
|
gboolean flip_vertically;
|
2013-04-19 22:22:19 +08:00
|
|
|
gdouble rotate_angle;
|
|
|
|
cairo_matrix_t *rotate_transform;
|
|
|
|
cairo_matrix_t *rotate_untransform;
|
|
|
|
|
2008-11-16 07:16:04 +08:00
|
|
|
gdouble monitor_xres;
|
|
|
|
gdouble monitor_yres;
|
|
|
|
gboolean dot_for_dot; /* ignore monitor resolution */
|
|
|
|
|
|
|
|
GimpZoomModel *zoom;
|
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
gdouble last_scale; /* scale used when reverting zoom */
|
|
|
|
guint last_scale_time; /* time when last_scale was set */
|
|
|
|
gint last_offset_x; /* offsets used when reverting zoom */
|
|
|
|
gint last_offset_y;
|
2007-02-07 16:13:44 +08:00
|
|
|
|
2008-11-16 07:16:04 +08:00
|
|
|
gdouble other_scale; /* scale factor entered in Zoom->Other*/
|
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
gint disp_width; /* width of drawing area */
|
|
|
|
gint disp_height; /* height of drawing area */
|
2001-11-02 17:31:21 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
gboolean proximity; /* is a device in proximity */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2019-08-11 03:00:14 +08:00
|
|
|
gboolean show_image; /* whether to show the image */
|
|
|
|
|
2019-09-04 20:50:29 +08:00
|
|
|
gboolean show_all; /* show the entire image */
|
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
Selection *selection; /* Selection (marching ants) */
|
Issue #5640: Selection tools not showing selection on Wayland.
As suggested in a comment (itself coming from an IRC discussion), we
should not use gdk_window_(begin|end)_draw_frame() functions as this
works on X, but not on Wayland anymore. Instead draw directly during
draw() call of the shell widget, and force it to happen regularly, to
update the marching ants, via gtk_widget_queue_draw_region().
This is tested and works on Wayland. Please everyone, test thoroughly to
make sure it works well in all situations, and also that we don't get
any unexpected slowdowns.
Since the symptoms are very similar, it is highly possible that it also
fixes the issue #5952 too, for selection not showing on macOS since Big
Sur 11 (maybe they changed the same way as Wayland did). Unfortunately I
can't check this myself. Please test, whoever has access to a macOS Big
Sur and can build GIMP!
2021-05-09 08:17:23 +08:00
|
|
|
gint64 selection_update; /* Last selection index update */
|
2001-11-11 07:03:22 +08:00
|
|
|
|
2010-02-20 21:52:37 +08:00
|
|
|
GList *children;
|
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
GtkWidget *canvas; /* GimpCanvas widget */
|
2021-01-27 04:14:45 +08:00
|
|
|
GtkGesture *zoom_gesture; /* Zoom gesture handler for the canvas*/
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
GtkAdjustment *hsbdata; /* adjustments */
|
|
|
|
GtkAdjustment *vsbdata;
|
|
|
|
GtkWidget *hsb; /* scroll bars */
|
|
|
|
GtkWidget *vsb;
|
2004-06-23 00:31:27 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
GtkWidget *hrule; /* rulers */
|
|
|
|
GtkWidget *vrule;
|
2004-06-23 00:31:27 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
GtkWidget *origin; /* NW: origin */
|
|
|
|
GtkWidget *quick_mask_button;/* SW: quick mask button */
|
|
|
|
GtkWidget *zoom_button; /* NE: zoom toggle button */
|
|
|
|
GtkWidget *nav_ebox; /* SE: navigation event box */
|
include the new "paint-funcs/paint-funcs-types.h".
2001-11-28 Michael Natterer <mitch@gimp.org>
* app/base/base-types.h: include the new
"paint-funcs/paint-funcs-types.h".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs-types.h: new file. Includes
"base/base-types.h".
* app/paint-funcs/paint-funcs.[ch]: removed the enums here,
include "paint-funcs-types.h".
* app/widgets/widgets-types.h: include "display/display-types.h"
* app/display/display-types.h: include "widgets/widgets-types.h".
* app/tools/tools-types.h: include "display/display-types.h"
* app/gui/gui-types.h: include "tools/tools-types.h".
The order of namespaces/dependencies should be (but is not):
(base, paint-funcs) -> (core, file, xcf, pdb) ->
(widgets, display) -> tools -> gui
* app/path.c: include "tools/tools-types.h".
* app/core/Makefile.am
* app/core/gimpimage-guides.[ch]
* app/core/gimpimage-merge.[ch]
* app/core/gimpimage-resize.[ch]
* app/core/gimpimage-scale.[ch]: new files.
* app/core/gimpimage.[ch]: removed the stuff which is in the new
files. Reordered all functions in both the .h and .c files,
commented the groups of functions.
* app/core/gimpcontainer.c: create the handler_id using a counter,
not the address of a pointer, because the address *may* be the
same twice, added debugging output.
* app/core/gimpviewable.[ch]: added primitive support for getting
a preview GdkPixbuf.
* app/nav_window.c
* app/undo.c
* app/undo_history.c
* app/core/gimpimage-duplicate.c
* app/core/gimpimage-mask.[ch]
* app/display/gimpdisplay.c
* app/display/gimpdisplayshell-callbacks.c
* app/display/gimpdisplayshell-dnd.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell-scale.c
* app/display/gimpdisplayshell-scroll.c
* app/gui/image-commands.c
* app/gui/info-window.c
* app/gui/layers-commands.c
* app/gui/palette-import-dialog.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimpmovetool.c
* app/widgets/gimpcontainerview-utils.c
* app/xcf/xcf-load.c: changed accordingly, some cleanup.
* tools/pdbgen/pdb/guides.pdb
* tools/pdbgen/pdb/image.pdb: changed accordingly, reordered functions.
* app/plug_in.c: set the labels of the "Repeat" and "Re-Show" menu
items to the name of the last plug-in (Fixes #50986).
* app/display/gimpdisplayshell.[ch]: set the labels of "Undo" and
"Redo" to the resp. undo names. Much simplified the WM icon stuff
by removing most code and using gimp_viewable_get_new_preview_pixbuf().
* app/widgets/gimpbrushfactoryview.c: forgot to assign the GQuark
returned by gimp_container_add_handler().
* app/pdb/guides_cmds.c
* app/pdb/image_cmds.c
* libgimp/gimpimage_pdb.[ch]: regenerated.
2001-11-29 01:51:06 +08:00
|
|
|
|
2009-10-04 21:31:38 +08:00
|
|
|
GtkWidget *statusbar; /* statusbar */
|
|
|
|
|
2010-09-30 04:12:01 +08:00
|
|
|
GimpCanvasItem *canvas_item; /* items drawn on the canvas */
|
2013-04-24 06:01:01 +08:00
|
|
|
GimpCanvasItem *unrotated_item; /* unrotated items for e.g. cursor */
|
2010-11-13 02:47:51 +08:00
|
|
|
GimpCanvasItem *passe_partout; /* item for the highlight */
|
2011-11-17 04:32:29 +08:00
|
|
|
GimpCanvasItem *preview_items; /* item for previews */
|
2010-10-08 07:03:56 +08:00
|
|
|
GimpCanvasItem *vectors; /* item proxy of vectors */
|
2010-10-03 02:57:40 +08:00
|
|
|
GimpCanvasItem *grid; /* item proxy of the grid */
|
2010-10-01 16:33:39 +08:00
|
|
|
GimpCanvasItem *guides; /* item proxies of guides */
|
2010-10-01 15:01:51 +08:00
|
|
|
GimpCanvasItem *sample_points; /* item proxies of sample points */
|
2019-09-04 21:33:09 +08:00
|
|
|
GimpCanvasItem *canvas_boundary; /* item for the cabvas boundary */
|
2010-10-03 06:28:40 +08:00
|
|
|
GimpCanvasItem *layer_boundary; /* item for the layer boundary */
|
2011-11-17 04:10:43 +08:00
|
|
|
GimpCanvasItem *tool_items; /* tools items, below the cursor */
|
2010-10-03 03:56:36 +08:00
|
|
|
GimpCanvasItem *cursor; /* item for the software cursor */
|
2010-09-30 04:12:01 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
guint title_idle_id; /* title update idle ID */
|
2009-09-24 01:33:36 +08:00
|
|
|
gchar *title; /* current title */
|
|
|
|
gchar *status; /* current default statusbar content */
|
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
guint fill_idle_id; /* display_shell_fill() idle ID */
|
2008-03-20 18:37:43 +08:00
|
|
|
|
2011-07-25 04:09:21 +08:00
|
|
|
GimpHandedness cursor_handedness;/* Handedness for cursor display */
|
2008-03-25 20:45:33 +08:00
|
|
|
GimpCursorType current_cursor; /* Currently installed main cursor */
|
|
|
|
GimpToolCursorType tool_cursor; /* Current Tool cursor */
|
|
|
|
GimpCursorModifier cursor_modifier; /* Cursor modifier (plus, minus, ...) */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2011-07-25 04:09:21 +08:00
|
|
|
GimpCursorType override_cursor; /* Overriding cursor */
|
2008-03-25 20:45:33 +08:00
|
|
|
gboolean using_override_cursor;
|
|
|
|
gboolean draw_cursor; /* should we draw software cursor ? */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
GtkWidget *close_dialog; /* close dialog */
|
|
|
|
GtkWidget *scale_dialog; /* scale (zoom) dialog */
|
2013-04-21 05:22:14 +08:00
|
|
|
GtkWidget *rotate_dialog; /* rotate dialog */
|
2008-03-25 20:45:33 +08:00
|
|
|
GtkWidget *nav_popup; /* navigation popup */
|
2001-11-01 05:20:09 +08:00
|
|
|
|
2016-05-14 06:56:26 +08:00
|
|
|
GimpColorConfig *color_config; /* color management settings */
|
2016-05-15 05:50:58 +08:00
|
|
|
gboolean color_config_set; /* settings changed from defaults */
|
2016-05-14 06:56:26 +08:00
|
|
|
|
2016-05-26 03:35:54 +08:00
|
|
|
GimpColorTransform *profile_transform;
|
|
|
|
GeglBuffer *profile_buffer; /* buffer for profile transform */
|
|
|
|
guchar *profile_data; /* profile_buffer's pixels */
|
|
|
|
gint profile_stride; /* profile_buffer's stride */
|
2015-05-27 18:28:33 +08:00
|
|
|
|
2017-11-03 15:59:06 +08:00
|
|
|
GimpColorDisplayStack *filter_stack; /* color display conversion stuff */
|
2003-11-22 06:52:36 +08:00
|
|
|
guint filter_idle_id;
|
2002-05-16 00:28:41 +08:00
|
|
|
|
2017-11-03 15:59:06 +08:00
|
|
|
GimpColorTransform *filter_transform;
|
|
|
|
const Babl *filter_format; /* filter_buffer's format */
|
Initial space invasion commit in GIMP
All babl formats now have a space equivalent to a color profile,
determining the format's primaries and TRCs. This commit makes GIMP
aware of this.
libgimp:
- enum GimpPrecision: rename GAMMA values to NON_LINEAR and keep GAMMA
as deprecated aliases, add PERCEPTUAL values so we now have LINEAR,
NON_LINEAR and PERCPTUAL for each encoding, matching the babl
encoding variants RGB, R'G'B' and R~G~B~.
- gimp_color_transform_can_gegl_copy() now returns TRUE if both
profiles can return a babl space, increasing the amount of fast babl
color conversions significantly.
- TODO: no solution yet for getting libgimp drawable proxy buffers in
the right format with space.
plug-ins:
- follow the GimpPrecision change.
- TODO: everything else unchanged and partly broken or sub-optimal,
like setting a new image's color profile too late.
app:
- add enum GimpTRCType { LINEAR, NON_LINEAR, PERCEPTUAL } as
replacement for all "linear" booleans.
- change gimp-babl functions to take babl spaces and GimpTRCType
parameters and support all sorts of new perceptual ~ formats.
- a lot of places changed in the early days of goat invasion didn't
take advantage of gimp-babl utility functions and constructed
formats manually. They all needed revisiting and many now use much
simpler code calling gimp-babl API.
- change gimp_babl_format_get_color_profile() to really extract a
newly allocated color profile from the format, and add
gimp_babl_get_builtin_color_profile() which does the same as
gimp_babl_format_get_color_profile() did before. Visited all callers
to decide whether they are looking for the format's actual profile,
or for one of the builtin profiles, simplifying code that only needs
builtin profiles.
- drawables have a new get_space_api(), get_linear() is now get_trc().
- images now have a "layer space" and an API to get it,
gimp_image_get_layer_format() returns formats in that space.
- an image's layer space is created from the image's color profile,
change gimpimage-color-profile to deal with that correctly
- change many babl_format() calls to babl_format_with_space() and take
the space from passed formats or drawables
- add function gimp_layer_fix_format_space() which replaces the
layer's buffer with one that has the image's layer format, but
doesn't change pixel values
- use gimp_layer_fix_format_space() to make sure layers loaded from
XCF and created by plug-ins have the right space when added to the
image, because it's impossible to always assign the right space upon
layer creation
- "assign color profile" and "discard color profile" now require use
of gimp_layer_fix_format_space() too because the profile is now
embedded in all formats via the space. Add
gimp_image_assign_color_profile() which does all that and call it
instead of a simple gimp_image_set_color_profile(), also from the
PDB set-color-profile functions, which are essentially "assign" and
"discard" calls.
- generally, make sure a new image's color profile is set before
adding layers to it, gimp_image_set_color_profile() is more than
before considered know-what-you-are-doing API.
- take special precaution in all places that call
gimp_drawable_convert_type(), we now must pass a new_profile from
all callers that convert layers within the same image (such as
image_convert_type, image_convert_precision), because the layer's
new space can't be determined from the image's layer format during
the call.
- change all "linear" properties to "trc", in all config objects like
for levels and curves, in the histogram, in the widgets. This results
in some GUI that now has three choices instead of two.
TODO: we might want to reduce that back to two later.
- keep "linear" boolean properties around as compat if needed for file
pasring, but always convert the parsed parsed boolean to
GimpTRCType.
- TODO: the image's "enable color management" switch is currently
broken, will fix that in another commit.
2018-07-21 20:23:01 +08:00
|
|
|
GimpColorProfile *filter_profile; /* filter_format's profile */
|
2017-11-03 15:59:06 +08:00
|
|
|
GeglBuffer *filter_buffer; /* buffer for display filters */
|
|
|
|
guchar *filter_data; /* filter_buffer's pixels */
|
|
|
|
gint filter_stride; /* filter_buffer's stride */
|
2015-05-27 18:28:33 +08:00
|
|
|
|
2019-09-12 02:00:32 +08:00
|
|
|
gint render_scale;
|
|
|
|
|
2019-07-16 05:24:35 +08:00
|
|
|
cairo_surface_t *render_cache;
|
|
|
|
cairo_region_t *render_cache_valid;
|
|
|
|
|
|
|
|
gint render_buf_width;
|
|
|
|
gint render_buf_height;
|
|
|
|
|
|
|
|
cairo_surface_t *render_surface; /* buffer for rendering the mask */
|
2015-05-27 18:28:33 +08:00
|
|
|
cairo_surface_t *mask_surface; /* buffer for rendering the mask */
|
|
|
|
cairo_pattern_t *checkerboard; /* checkerboard pattern */
|
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
gint paused_count;
|
2003-09-12 06:24:30 +08:00
|
|
|
|
2010-10-08 07:03:56 +08:00
|
|
|
GimpTreeHandler *vectors_freeze_handler;
|
|
|
|
GimpTreeHandler *vectors_thaw_handler;
|
|
|
|
GimpTreeHandler *vectors_visible_handler;
|
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
gboolean zoom_on_resize;
|
2004-06-23 00:31:27 +08:00
|
|
|
|
2008-08-17 15:21:41 +08:00
|
|
|
gboolean size_allocate_from_configure_event;
|
2018-06-28 06:52:08 +08:00
|
|
|
gboolean size_allocate_center_image;
|
2008-08-17 15:21:41 +08:00
|
|
|
|
2003-10-14 19:14:28 +08:00
|
|
|
/* the state of gimp_display_shell_tool_events() */
|
2011-02-27 23:38:51 +08:00
|
|
|
GdkDevice *grab_pointer;
|
|
|
|
GdkDevice *grab_pointer_source;
|
|
|
|
guint32 grab_pointer_time;
|
2011-12-10 06:21:22 +08:00
|
|
|
|
2011-02-27 23:38:51 +08:00
|
|
|
GdkDevice *grab_keyboard;
|
|
|
|
GdkDevice *grab_keyboard_source;
|
|
|
|
guint32 grab_keyboard_time;
|
2011-02-19 21:46:23 +08:00
|
|
|
|
2021-01-27 04:14:45 +08:00
|
|
|
/* the state of gimp_display_shell_zoom_gesture_*() */
|
|
|
|
gdouble last_zoom_scale;
|
|
|
|
|
Bug 724692 - Canvas rotation stuck with specific order of actions.
Commit b279c2d217 was breaking a specific use case, which I oversaw:
when space bar activates the move tool, you may want to release the
space bar while mouse button is pressed, and expect to still be able to
move the layer/selection/guide, but releasing space was stopping the
move immediately. The move tool must only be deactivated when both space
and button 1 are released, and the move itself must continue as long as
button 1 is pressed (when started while space was pressed).
As a nice side effect of this commit, panning and canvas rotation are
also improved since now they can be continued while releasing space
(respectively shift-space) if mouse button 1 was pressed, and up until
the mouse button is released. Pressing space again, then releasing the
mouse, back and forth, also work as expected (i.e. move tool stay
activated though the move stops; and panning or rotation continue).
Of course now we don't get anymore panning/rotation stuck while neither
space nor mouse buttons are pressed (which was the original bug). At
least one of these need to stay pressed for panning/rotation/move to
stay activated. And initial activation is obviously always through
(shift-)space only.
2018-04-14 21:36:08 +08:00
|
|
|
/* Two states are possible when the shell is grabbed: it can be
|
|
|
|
* grabbed with space (or space+button1 which is the same state),
|
|
|
|
* then if space is released but button1 was still pressed, we wait
|
|
|
|
* for button1 to be released as well.
|
|
|
|
*/
|
2008-03-25 20:45:33 +08:00
|
|
|
gboolean space_release_pending;
|
Bug 724692 - Canvas rotation stuck with specific order of actions.
Commit b279c2d217 was breaking a specific use case, which I oversaw:
when space bar activates the move tool, you may want to release the
space bar while mouse button is pressed, and expect to still be able to
move the layer/selection/guide, but releasing space was stopping the
move immediately. The move tool must only be deactivated when both space
and button 1 are released, and the move itself must continue as long as
button 1 is pressed (when started while space was pressed).
As a nice side effect of this commit, panning and canvas rotation are
also improved since now they can be continued while releasing space
(respectively shift-space) if mouse button 1 was pressed, and up until
the mouse button is released. Pressing space again, then releasing the
mouse, back and forth, also work as expected (i.e. move tool stay
activated though the move stops; and panning or rotation continue).
Of course now we don't get anymore panning/rotation stuck while neither
space nor mouse buttons are pressed (which was the original bug). At
least one of these need to stay pressed for panning/rotation/move to
stay activated. And initial activation is obviously always through
(shift-)space only.
2018-04-14 21:36:08 +08:00
|
|
|
gboolean button1_release_pending;
|
2008-03-25 20:45:33 +08:00
|
|
|
const gchar *space_shaded_tool;
|
2008-11-16 07:16:04 +08:00
|
|
|
|
2008-03-25 20:45:33 +08:00
|
|
|
gboolean scrolling;
|
2018-06-04 17:42:02 +08:00
|
|
|
gint scroll_start_x;
|
|
|
|
gint scroll_start_y;
|
2013-04-20 14:37:15 +08:00
|
|
|
gint scroll_last_x;
|
|
|
|
gint scroll_last_y;
|
2013-04-19 22:22:19 +08:00
|
|
|
gboolean rotating;
|
|
|
|
gdouble rotate_drag_angle;
|
2016-11-16 21:41:30 +08:00
|
|
|
gboolean scaling;
|
2008-11-16 07:16:04 +08:00
|
|
|
gpointer scroll_info;
|
2018-12-23 02:09:34 +08:00
|
|
|
gboolean layer_picking;
|
|
|
|
GimpLayer *picked_layer;
|
2008-11-16 07:16:04 +08:00
|
|
|
|
2013-06-23 04:26:46 +08:00
|
|
|
GeglBuffer *mask;
|
2016-02-06 04:19:17 +08:00
|
|
|
gint mask_offset_x;
|
|
|
|
gint mask_offset_y;
|
2010-09-29 06:10:37 +08:00
|
|
|
GimpRGB mask_color;
|
2014-06-12 03:33:57 +08:00
|
|
|
gboolean mask_inverted;
|
2009-01-10 08:48:30 +08:00
|
|
|
|
2011-04-18 00:53:42 +08:00
|
|
|
GimpMotionBuffer *motion_buffer;
|
2009-01-10 08:48:30 +08:00
|
|
|
|
2010-06-19 02:57:59 +08:00
|
|
|
GQueue *zoom_focus_pointer_queue;
|
2013-09-29 00:00:31 +08:00
|
|
|
|
|
|
|
gboolean blink;
|
|
|
|
guint blink_timeout_id;
|
2001-10-13 20:52:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _GimpDisplayShellClass
|
|
|
|
{
|
2017-02-23 07:31:39 +08:00
|
|
|
GtkEventBoxClass parent_class;
|
2002-05-08 00:23:14 +08:00
|
|
|
|
2002-09-28 00:17:31 +08:00
|
|
|
void (* scaled) (GimpDisplayShell *shell);
|
|
|
|
void (* scrolled) (GimpDisplayShell *shell);
|
2013-04-21 09:15:22 +08:00
|
|
|
void (* rotated) (GimpDisplayShell *shell);
|
2002-09-28 00:17:31 +08:00
|
|
|
void (* reconnect) (GimpDisplayShell *shell);
|
2001-10-13 20:52:30 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
GType gimp_display_shell_get_type (void) G_GNUC_CONST;
|
2006-09-05 01:18:38 +08:00
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
GtkWidget * gimp_display_shell_new (GimpDisplay *display,
|
2006-09-05 01:18:38 +08:00
|
|
|
GimpUnit unit,
|
|
|
|
gdouble scale,
|
2014-05-03 06:54:20 +08:00
|
|
|
GimpUIManager *popup_manager,
|
2018-04-29 23:27:47 +08:00
|
|
|
GdkMonitor *monitor);
|
2006-09-05 01:18:38 +08:00
|
|
|
|
2010-02-20 21:52:37 +08:00
|
|
|
void gimp_display_shell_add_overlay (GimpDisplayShell *shell,
|
|
|
|
GtkWidget *child,
|
2010-02-26 07:09:54 +08:00
|
|
|
gdouble image_x,
|
2010-02-28 21:48:47 +08:00
|
|
|
gdouble image_y,
|
2010-10-18 18:50:17 +08:00
|
|
|
GimpHandleAnchor anchor,
|
2010-02-28 21:48:47 +08:00
|
|
|
gint spacing_x,
|
|
|
|
gint spacing_y);
|
2010-02-26 07:09:54 +08:00
|
|
|
void gimp_display_shell_move_overlay (GimpDisplayShell *shell,
|
|
|
|
GtkWidget *child,
|
2010-02-20 21:52:37 +08:00
|
|
|
gdouble image_x,
|
2010-02-28 21:48:47 +08:00
|
|
|
gdouble image_y,
|
2010-10-18 18:50:17 +08:00
|
|
|
GimpHandleAnchor anchor,
|
2010-02-28 21:48:47 +08:00
|
|
|
gint spacing_x,
|
|
|
|
gint spacing_y);
|
2010-02-20 21:52:37 +08:00
|
|
|
|
2009-09-29 05:53:05 +08:00
|
|
|
GimpImageWindow * gimp_display_shell_get_window (GimpDisplayShell *shell);
|
2009-10-04 21:31:38 +08:00
|
|
|
GimpStatusbar * gimp_display_shell_get_statusbar (GimpDisplayShell *shell);
|
|
|
|
|
2016-05-14 06:56:26 +08:00
|
|
|
GimpColorConfig * gimp_display_shell_get_color_config
|
|
|
|
(GimpDisplayShell *shell);
|
|
|
|
|
2009-10-05 01:24:55 +08:00
|
|
|
void gimp_display_shell_present (GimpDisplayShell *shell);
|
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
void gimp_display_shell_reconnect (GimpDisplayShell *shell);
|
2006-09-05 01:18:38 +08:00
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
void gimp_display_shell_empty (GimpDisplayShell *shell);
|
|
|
|
void gimp_display_shell_fill (GimpDisplayShell *shell,
|
2008-03-20 00:15:50 +08:00
|
|
|
GimpImage *image,
|
|
|
|
GimpUnit unit,
|
|
|
|
gdouble scale);
|
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
void gimp_display_shell_scaled (GimpDisplayShell *shell);
|
|
|
|
void gimp_display_shell_scrolled (GimpDisplayShell *shell);
|
2013-04-21 09:15:22 +08:00
|
|
|
void gimp_display_shell_rotated (GimpDisplayShell *shell);
|
2006-09-05 01:18:38 +08:00
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
void gimp_display_shell_set_unit (GimpDisplayShell *shell,
|
2006-09-05 01:18:38 +08:00
|
|
|
GimpUnit unit);
|
2009-10-03 06:06:44 +08:00
|
|
|
GimpUnit gimp_display_shell_get_unit (GimpDisplayShell *shell);
|
2006-09-05 01:18:38 +08:00
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
gboolean gimp_display_shell_snap_coords (GimpDisplayShell *shell,
|
2006-09-05 01:18:38 +08:00
|
|
|
GimpCoords *coords,
|
|
|
|
gint snap_offset_x,
|
|
|
|
gint snap_offset_y,
|
|
|
|
gint snap_width,
|
|
|
|
gint snap_height);
|
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
gboolean gimp_display_shell_mask_bounds (GimpDisplayShell *shell,
|
2015-07-02 07:53:46 +08:00
|
|
|
gint *x,
|
|
|
|
gint *y,
|
|
|
|
gint *width,
|
|
|
|
gint *height);
|
2006-09-05 01:18:38 +08:00
|
|
|
|
2019-08-11 03:00:14 +08:00
|
|
|
void gimp_display_shell_set_show_image
|
|
|
|
(GimpDisplayShell *shell,
|
|
|
|
gboolean show_image);
|
|
|
|
|
2019-09-04 20:50:29 +08:00
|
|
|
void gimp_display_shell_set_show_all (GimpDisplayShell *shell,
|
|
|
|
gboolean show_all);
|
|
|
|
|
|
|
|
GimpPickable * gimp_display_shell_get_pickable (GimpDisplayShell *shell);
|
2019-09-20 00:57:16 +08:00
|
|
|
GimpPickable * gimp_display_shell_get_canvas_pickable
|
|
|
|
(GimpDisplayShell *shell);
|
2019-09-04 20:50:29 +08:00
|
|
|
GeglRectangle gimp_display_shell_get_bounding_box
|
|
|
|
(GimpDisplayShell *shell);
|
2019-09-15 21:22:06 +08:00
|
|
|
gboolean gimp_display_shell_get_infinite_canvas
|
|
|
|
(GimpDisplayShell *shell);
|
2019-09-04 20:50:29 +08:00
|
|
|
|
2019-09-05 18:51:35 +08:00
|
|
|
void gimp_display_shell_update_priority_rect
|
|
|
|
(GimpDisplayShell *shell);
|
|
|
|
|
2018-07-01 22:19:54 +08:00
|
|
|
void gimp_display_shell_flush (GimpDisplayShell *shell);
|
2006-09-05 01:18:38 +08:00
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
void gimp_display_shell_pause (GimpDisplayShell *shell);
|
|
|
|
void gimp_display_shell_resume (GimpDisplayShell *shell);
|
2006-09-05 01:18:38 +08:00
|
|
|
|
2009-10-03 06:06:44 +08:00
|
|
|
void gimp_display_shell_set_highlight (GimpDisplayShell *shell,
|
2017-12-13 23:01:48 +08:00
|
|
|
const GdkRectangle *highlight,
|
|
|
|
double opacity);
|
2009-10-03 06:06:44 +08:00
|
|
|
void gimp_display_shell_set_mask (GimpDisplayShell *shell,
|
2013-06-23 04:26:46 +08:00
|
|
|
GeglBuffer *mask,
|
2016-02-06 04:19:17 +08:00
|
|
|
gint offset_x,
|
|
|
|
gint offset_y,
|
2014-06-12 03:33:57 +08:00
|
|
|
const GimpRGB *color,
|
|
|
|
gboolean inverted);
|
2005-07-31 18:40:54 +08:00
|
|
|
|
2001-10-13 20:52:30 +08:00
|
|
|
|
|
|
|
#endif /* __GIMP_DISPLAY_SHELL_H__ */
|