Commit Graph

199 Commits

Author SHA1 Message Date
Daniel Sabo a059c0e7eb app: Fix on canvas widgets ignoring clicks from tablets - bug 614441
Disable extended input events when the cursor moves to a child of
the canvas widget. Otherwise GTK will try and fail to deliver an
extended event to the child widget, and end up sending it to the
canvas instead.
2014-02-10 22:28:08 +01:00
Michael Natterer 57d291e130 app: cache the GeglBuffer used for display filters in GimpDisplayShell
so it is not created and destroyed all the time.
2013-11-02 20:56:25 +01:00
Michael Natterer 462f61794e app: fix drawing of the empty canvas wilber 2013-09-28 18:00:31 +02:00
Jehan 0df8ae52fb Bug 704065 - Snap default preferences are now settable in the preferences.
Along with this change, the snap preferences have been moved from
GimpDisplayConfig to GimpDisplayOptions, where it makes much more sense.
One of the consequences is that there is no need to duplicate these
values in GimpDisplayShell anymore to differenciate defaults and
current settings.
2013-08-27 23:31:22 +12:00
Michael Natterer 31e9cc2ad9 Bug 702369 - foreground selection doesnt work with image precision >8 bit
This removes the obsolete check which makes the tool fail from
gimp_display_shell_set_mask(). Also change the foreground select tool
and the display mask from using GimpChannel to GeglBuffer, because
that's what it needs, simply buffers. Most changed files simply newly
include <gegl.h> because a GeglBuffer appeared in two headers.
2013-06-22 22:26:46 +02:00
Michael Natterer aea94211b1 app: add an unrotated canvas item group to GimpDisplayShell
and put the software cursor and the tool progress there.
2013-04-24 00:01:01 +02:00
Michael Natterer 3972da5256 app: add signal GimpDisplayShell::rotated and use it to update the menu 2013-04-21 03:15:22 +02:00
Michael Natterer 977a194923 app: add a rotate dialog to rotate to exact degrees 2013-04-20 23:22:14 +02:00
Michael Natterer b3a9a6a3e3 Bug 55367 - Rotated view of the canvas (view is rotated, not image contents)
First version of display rotation, inspired by gimp-painter.
The rotation always happens around the image's center.

The only "UI" for rotating is currently shift+middle-drag and
shift+space-drag. Control constrains the angle to 15 degrees
and is currently the only way to go back to "no rotation".
2013-04-20 15:11:01 +02:00
Michael Natterer 6b8426874d app: simplify scroll offset calculation for middle-mouse scrolling 2013-04-20 08:37:15 +02:00
Michael Natterer 810bb18949 app: remove the old rendering increments from struct GimpDisplayShell
and don't use them for (un)transforming integer coordinates. Everything
seems to work fine, but this sort of change has caused off-by-one errors
before, please review.
2013-04-18 02:10:38 +02:00
Michael Natterer d0a5879f28 app: some GIMP-style cleanup to the last commit 2013-02-02 17:07:03 +01:00
Chris Wilson 4a81849e36 app: Use SHM transport for data transfer for display
Recent Cairo uses SHM transports when available, and exposes the ability
for its users to manage images shared between it and the display.
This allows us to eliminate copies, and if the architecture supports it
even to upload directly into GPU addressable memory without any copies
(all in normal system memory so we suffer no performance penalty when
applying the filters). The caveat is that we need to be aware of the
synchronize requirements, the cairo_surface_flush and
cairo_surface_mark_dirty, around access to the transport image. To
reduce the frequency of these barriers, we can subdivide the transport
image into small chunks as to satisfy individual updates and delay the
synchronisation barrier until we are forced to reuse earlier pixels.

Note this bumps the required Cairo version to 1.12, and please be aware
that the XSHM transport requires bug fixes from cairo.git (will be
1.12.12)

v2: After further reflections with Mitch, we realized we can share the
transport surface between all canvases by attaching it to the common
screen.

v3: Fix a couple of typos in insert_node() introduced when switching
variables names.

v4: Encapsulating within an image surface rather than a subsurface was
hiding the backing SHM segment from cairo, causing it to allocate
further SHM resources to stream the upload. We should be able to use a
sub-surface here, but it is more convenient to wrap the pixels in an
image surface for rendering the filters (and conveniently masking the
callee flushes from invalidating our parent transport surface).

Cc: Michael Natterer <mitch@gimp.org>
2013-02-02 13:59:59 +01:00
Michael Natterer c6ba0ffbdf app/cursors/libgimpwidgets: bye bye stone age B&W bitmap cursors 2012-08-26 22:53:04 +02:00
Michael Natterer 022af2610e app: GimpDisplayShell: fix type of the new grab time members 2011-12-09 23:21:22 +01:00
Michael Natterer 01f92a3b48 app: get rid of server grabs for almost all canvas interaction
Because it's generally the right thing to do, and server grabs broke
badly with input devices / client side windows.

gimpdisplayshell-grab.c: change logic to only server-grab if an event
is passed to the pointer grab/ungrab functions, but always use
gtk_grab_add/remove() which is sufficient in most cases.

gimpdisplayshell-tool-events.c: have the grab functions grab the
server only for space-bar scrolling and do all tool interaction,
including ruler clicks, with gtk_grab_add/remove(). Refactor things
a bit to also use the grab API for button-2 scrolling.

gimpdeviceinfo-coords.c: transform the event's coords to the canvas'
coordinate system, they might come from a ruler now.

This fixes the following bugs:

Bug 645315 - gimp_display_shell_pointer_grab: gdk_pointer_grab failed...
Bug 644351 - Gimp misses some strokes especially when drawing fast
Bug 645747 - Gimp is now unusable on xfce4
2011-12-09 20:20:02 +01:00
Michael Natterer d38ded387d Bug 663121 - guides are below rotate/transform/shear/perspective preview
Add a canvas item group for previews, and a small preview infrastructure
to GimpDrawTool, and put the transform preview into the preview group,
which is below all guides, grid and layer boundaries.
2011-11-16 21:32:29 +01:00
Michael Natterer ffc9948d6e app: add a canvas group for tool items
so we can control where in the canvas item stack they appear.
Put the group right below the software cursor.
2011-11-16 21:10:43 +01:00
Alexander Hämmerle 421ca4114e Bug 641187 - GIMP needs a left-handed cursor option
Add a cursor-handedness setting and flip the cursor when it's set to
left-handed.
2011-07-24 22:09:21 +02:00
Michael Natterer e09520fb08 app: add GimpMotionBuffer class to swallow all the event smoothing code
This commit only adds the class and removes the members from
GimpDisplayShell, so everything looks more ugly than before, but
I wanted the member moving separate from any refactorings.
2011-04-17 18:53:42 +02:00
Martin Nordholts 6b5e495841 app: Remove comments about cachelines in GimpDisplayShell
Remove comments about cachelines in GimpDisplayShell that no one cares
about in 2011.
2011-04-07 07:12:32 +02:00
Michael Natterer a0641d73d6 app: remove the hackish "button_press_before_focus" from GimpDisplayShell
and simply *always* set the tool to the right state before sending it
a button_press. GimpTool's state setting functions are now smart
enough to simply ignore setting the same state again. When recieving a
FOCUS_IN, skip state setting when the pointer is grabbed, which is a
safe indicator for tool interaction going on. This hopefully fixes
states for both click-to-focus and focus-follows-mouse *and* fixes the
previously warning case where a new image was opened into an already
focussed canvas (the warning then happened on button press, and the
tool was in an inconsistent state).
2011-04-03 18:42:50 +02:00
Michael Natterer f09be52c1b app: turn the transform preview into a GimpCanvasItem
And remove all the complicated handling code entirely. This makes
GimpTransformTool a lot less complex. As a nice side effect, the
preview is now always 100% in sync with the grid and handles.
2011-03-27 16:40:41 +02:00
Michael Natterer d504eeb048 app: move GimpDisplayShell pointer/keyboard grabbing to utility functions
Spit warnings in the functions if grabbing fails and return a boolean
success value. Bail out in the callers upon grab failure instead of
assuming that grabbing always succeeds and running into an
inconsistent state that can cause all sorts of problems.
2011-02-20 12:12:48 +01:00
Michael Natterer e4532fe2a8 app: call gimp_canvas_item_begin,end_change() around passe partout changes
Also remove the "highlight" member from the GimpDisplayShell struct.
2010-11-12 20:18:03 +01:00
Michael Natterer 458230bf8d app: use a GimpCanvasPassePartout for drawing the crop highlight
and remove all old drawing logic.
2010-11-12 19:47:51 +01:00
Michael Natterer b2a2e3200e app: derive GimpDisplayShell from GtkBox instead of GtkVBox
and avoid gtk_container_add() on boxes in some more plavces.
2010-10-30 15:12:20 +02:00
Michael Natterer 5b64b83569 app: introduce enum GimpHandleAnchor as replacement for GtkAnchorType
because the latter is gone in GTK+ 3.0
2010-10-18 12:50:17 +02:00
Michael Natterer 55f01bf6f3 app: remove gimp_display_shell_draw_vectors()
which is the last bit of non-item drawing of stuff that is not
somehow the image itself... wheee!

This involves reverting commit
6bce0641d4 and adding back all the
vectors handlers that were in gimpdisplayshell-callbacks.c before.
Change the callbacks to manage proxy items for all the image's
vectors.
2010-10-08 01:03:56 +02:00
Michael Natterer 3e69ae0039 app: add a layer boundary canvas item class
and use it to draw the layer boundary. Remove a lot of stuff
that was there only to draw the boundary before:

- remvoe all layer boundary stuff from the selection code
- remove gimp_display_shell_draw_layer()
- remove enum values GIMP_SELECTION_LAYER_ON,OFF from core-enums.h
- remove all lines calling gimp_image_selection_control() with
  the removed enum values
- remove gimp_layer_boundary()
2010-10-03 00:28:40 +02:00
Michael Natterer 1d45f6295e app: add a software cursor canvas item
and use it to draw the sw cursor. Almost every aspect of the old code
was ugly and hard to read, this is so much nicer...
2010-10-02 21:56:36 +02:00
Michael Natterer 502d7c815b app: add a canvas grid item class and use it to draw the grid
Remove gimp_display_shell_draw_grid().
2010-10-02 20:57:40 +02:00
Michael Natterer 3b4f2ec94c app: add a GimpCanvasProxyGroup that will be used for guides 2010-10-01 10:33:39 +02:00
Michael Natterer 75b4c8096f app: add a proxy group which will keep sample point canvas items 2010-10-01 09:27:57 +02:00
Michael Natterer 7edfa2ca54 app: start an infrastructure where the shell keeps around its canvas items
- Invalidate the proper area when an item gets added or removed.
- Draw the kept canvas items instead of calling a draw tool function.
- The draw tool now sets its item on the shell.
2010-09-29 22:12:01 +02:00
Sven Neumann 2ef259cd20 app: use GimpRGB as mask color
Instead of passing GimpChannelType as mask color to
gimp_display_shell_set_mask(), change that function to accept a
GimpRGB color.

Adapt GimpForegroundSelectTool, the only user of the display mask
feature, to this change.
2010-09-29 20:35:00 +02:00
Sven Neumann a7413bd784 app/display: implement drawing of selection mask
Use cairo_mask_surface() to render the selection mask (as used by
the foreground selection tool).
2010-09-29 20:35:00 +02:00
Sven Neumann ccee0ec41a app/display: let cairo render the checkerboard
Instead of blending the scaled image data onto the checkerboard and
then painting this image to the screen, render the image data into
an ARGB cairo image surface. Then paint a checkerboard on the canvas
and the image on top of it.
2010-09-29 20:34:59 +02:00
Michael Natterer 6bce0641d4 app: add signal GimpImage::update_vectors() and have the image manage updates
...just as we do for drawables. Connect to adding, removing, modifying
and toggling visibility of all vectors and emit "update-vectors"
accordingly. Add an update-vectors signal handler to GimpDisplayShell
and remove all other vectors handlers.
2010-09-17 11:31:57 +02:00
Michael Natterer f0c40d3717 app: port GimpDisplayShell image drawing to cairo 2010-08-27 23:15:25 +02:00
Michael Natterer 18d3882c5c app: port GimpDisplayShell pen drawing to cairo 2010-08-23 21:59:27 +02:00
Michael Natterer 529ce40a5d app: port GimpDisplayShell grid drawing to cairo 2010-08-11 13:16:55 +02:00
Martin Nordholts 7e3898da09 app/tests: Add keyboard zoom focus regression test
Add keyboard zoom focus regression test. We also need a new display
shell utility function
gimp_display_shell_push_zoom_focus_pointer_pos() for that.
2010-06-18 20:57:59 +02:00
Michael Natterer 84d33e4316 app: make image-coords overlay widgets work fine at any zoom factor
Add anchor and spacing parameters to the shell overlay API, so
overlays can be positioned on each side of a point in image space,
with configurable spacing in display space.
2010-02-28 14:48:47 +01:00
Michael Natterer ff01c2d77e app: add API to move an existing image-coords overlay around 2010-02-26 01:27:04 +01:00
Michael Natterer 9b75184442 app: add API to add overlays in image coordinates
and update their positions when the shell scrolls and zooms.
2010-02-20 15:15:53 +01:00
Michael Natterer b6ce5d075d Remove macros SCREEN_XRES() and SCREEN_YRES()
and add gimp_display_shell_get_screen_resolution() instead. The times
when these macros were used in inner loops have long passed.
2010-02-03 19:50:46 +01:00
Michael Natterer 94dcbe0e2e Add new function gimp_display_shell_present()
Not only presents the shell's toplevel, but also makes it the active
shell in the image window.
2009-10-04 19:24:55 +02:00
Michael Natterer dee0afed79 Move the statusbar back to GimpDisplayShell
Keeping it in GimpImageWindow was a bad idea because
- it wasted space
- it produced evil code because
- it conceptually didn't belong there
2009-10-04 15:33:03 +02:00
Michael Natterer 750c11f001 Move the display render buf size #defines to gimpdisplayshell-render.h 2009-10-03 00:15:04 +02:00