Commit Graph

76 Commits

Author SHA1 Message Date
465eba3260 app: factor out button-2-motion handling code in GimpDisplayShell
less code in the huge gimp_display_shell_canvas_tool_events().
Also fix the rotating cursor in gimp_display_shell_start_scrolling().
2017-05-11 21:31:41 +02:00
dba909a9fa Bug 776370 - Changing active layer breaks the GEGL operation dialog
We can't just switch to a GimpOperationTool by using the normal
gimp_context_set_tool() or gimp_context_tool_changed() because it
needs additional initialization like setting an operation at all.

In gimp_gegl_procedure_execute_async(), g_object_set_data() the used
procedure on the newly created tool.

In gimp_display_shell_initialize_tool(), when we re-create the active
tool because of a drawable change, check for the procedure and invoke
it again, instead of simply creating an empty operation tool by
calling gimp_context_tool_changed().
2017-01-23 00:05:18 +01:00
b1ca8a161c app: allow to zoom with middle mouse button + control + drag up/down 2016-11-16 14:41:30 +01:00
151b44e4bb Bug 759939 - Ghost brush outline in FG Select tool
Fix the check that keeps events on overlay widgets from entering the
tool event mechanism, they have no business there.

gimp_overlay_child_realize(): set the embedding widget's event mask on
all overlay children, so their windows will be used as event window,
so their events become distinguishable from events on the parent (the
canvas).

gimp_display_shell_canvas_tool_events(): fix the check for events on
overlays, and skip them for real this time.
2016-10-14 22:14:11 +02:00
5037ff35ca Bug 771444: Tablet stylus misbehaves when crossing...
the edge of a dock in multi-window-mode

when the pointer is grabbed do not process a
motion-notify-event having the wrong 'device' member.

This avoids a harmful device change.
2016-09-22 18:18:40 +02:00
2120742cb9 app: don't unconditionally call tool_manager_modifier_state_active()
Only call it if the display is the active tool's focus display.
2016-04-15 11:28:13 +01:00
2a31b96f4b Bug 732160 - menu activation with alt-somekey makes tools stay...
...in "alt-pressed" mode

Menu activation doesn't cause a focus-out becaus menu keyboard
grabbing is implemented with a simple gtk_grab_add() (the menu popup
never gets the focus). Therefore, the canvas never gets a focus-out
event and the pressed modifiers are stuck.

Fixed by connecting to "grab-notify" on the canvas, and artificially
releasing all modifiers when the canvas is shadowed by a grab.
2016-04-15 00:22:25 +01:00
7889ec08f7 Bug 668016 - Accidentally clicking ruler loses active tool's state
Add two new tools, GimpGuideTool and GimpSamplePointTool. They are
one-trick-ponies and can only create new or move existing guides and
sample points. They can't be selected from the toolbox, only
temporarily pushed as active tools on top of any active tool using
their public start() APIs.

Use that API to enable them when the rulers are clicked, and replace
the entire guide and sample point moving code in GimpMoveTool and
GimpColorTool by simple calls to that API.

This might look like overkill but can easily be used for other
features like moving guides from within the paint tools (mirror
painting) or gegl filters (preview curtain).
2016-04-03 16:41:42 +02:00
fa46ef11f1 app: add the point of code removed in previous commit back in 2015-12-28 23:06:04 +02:00
a5fbe2d33a app: remove some pointless code 2015-12-28 22:23:35 +02:00
4ea6f6dd28 app: minor formatting cleanup in gimpdisplayshell-tool-events.c 2015-04-18 08:40:31 +02:00
cea42c73d8 app: fix implicit enum casting
Silences clang.
2015-01-10 00:02:28 +01:00
b161253939 app: refactor all motion managment to use scale factors passed with coords 2014-11-17 00:03:13 +02:00
9a953a9239 app: locking brush size to zoom 2014-11-17 00:03:10 +02:00
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
934edb75ab app: redo commit "make sure overlay widgets are keyboard navigatable"
Letting just tab presses bubble up when an overlay canvas child didn't
handle a key event isn't enough. Instead, let all key presses and
releases bubble up if the canvas itself doesn't have the focus.
Read: don't make assumptions.
2013-06-08 17:27:05 +02:00
2d68b1d4f9 app: make sure overlay widgets are keyboard navigatable
Tab key events are not handled by the widget itself, they are supposed
to bubble up until they hit the generic keyboard navigation code
that knows about the focus chain, therefore:

gimp_display_shell_canvas_tool_events(): if an overlay widget is
focussed, don't handle Tab events and toggle dock visibility. Instead,
simply bail out with FALSE so the event reaches te keyboard navigation
code.

Also treat GDK_KEY_KP_Tab like GDK_KEY_Tab all over the place.
2013-06-08 15:27:14 +02:00
87584d2f82 Bug 699100 - Move tool: space-bar inhibits function of Move tool
Don't try to switch to the move tool if the move tool is already active.
Also never bail out early from gimp_display_shell_space_pressed() so we
don't end up in an inconsistent state.
2013-04-28 15:28:18 +02:00
3643551280 Bug 697530 - zoom during mouse-pan focuses on wrong location
Block all key events while middle-mouse panning, to prevent
accelerators from being invoked.
2013-04-21 20:00:28 +02:00
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
6b8426874d app: simplify scroll offset calculation for middle-mouse scrolling 2013-04-20 08:37:15 +02:00
169d32532a Bug 676927 - Shortcuts with backspace not working if image is focused
Move local variable out of the switch() block, it was never initialized.
2013-02-15 01:00:13 +01:00
6b0d1038cc Bug 692641 - Various spelling fixes 2013-01-27 18:59:02 +01:00
5d668971d7 display - run the file-open command when double-clicking in an empty shell. 2012-12-01 22:31:29 +09:00
5de48ef8b5 Bug 686521 - Zoom Tool Displays Wrong Cursor When Zooming In/Out
When updating the tool cursor on BUTTON_PRESS, pass a state *without*
the newly pressed button's mask to gimp_display_shell_update_cursor(),
or it will simply never call the cursor update function. Tool cursors
don't normally change when a mouse button is down.
2012-11-06 22:46:47 +01:00
e546f2b43b Bug 683462 - cropping with rectangular select tool leaves misaligned...
Reset the tool on image changes again, but not if only the active
drawable changes, so keep bug #678890 closed:

Introduce new dirty flag GIMP_DIRTY_ACTIVE_DRAWABLE and set it on all
tools' dirty_mask except for rect select. Check the new flag when
reseting the active tool because of a drawable change.
2012-09-06 23:55:35 +02:00
38bec7d924 app: compress motion events up to the first release event
I'm not sure if it'd be better to compress only sequence
of contiguous motion events, thinking to the case of anticipating
a motion event before a modifier key press/release.
2012-06-24 13:23:11 +02:00
f400bc49ca Bug 677262 - move the layer with the arrow keys, broken after...
commit 9ce8d4fae2. Fix the return_val
logic added in that commit, and make sure we always swallow arroy key
events, because we don't want focus keynav away from the canvas.
2012-06-08 00:21:07 +02:00
6c9f1b5715 Bug 676872 - Image Properties keyboard shortcut Alt+Return Broken
Don't swallow key events which were not handled by the keyboard
controller.
2012-05-27 19:55:42 +02:00
51a8e66824 app: reduce nesting in gimp_display_shell_canvas_no_image_events() 2011-12-15 22:35:44 +01:00
8569c6e2f7 app: don't request motion hints on the canvas
They are a dark ages concept, and it's almost 2012.
2011-12-10 23:22:08 +01:00
7da455214d app: merge if() madness into one single even bigger madness 2011-12-09 22:34:44 +01:00
5ec2bd7287 app: improve ignoring other buttons while one down 2011-12-09 23:27:18 +02:00
435b5b4386 app: move variable to local scope in gimp_display_shell_canvas_tool_events() 2011-12-09 20:54:24 +01:00
ea49a7b466 app: ignore new button events on the canvas while another button is down
Fixes tons of possibly dangerous warnings, and likely some weird
crashes.
2011-12-09 20:53:11 +01:00
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
a38faefba7 app: use toggle_behavior_mask not CONTROL to trigger zoom-on-scroll 2011-10-07 00:00:42 +02:00
59f4396c7b app: use the toggle_behavior modifier instead of GDK_CONTROL_MASK
to switch between dragging a guide or a sample point from a ruler.
2011-10-06 21:10:18 +02:00
e8250320d5 app: use gdk_event_triggers_context_menu() for the image menu
and clean up button event handling a bit.
2011-10-05 20:04:42 +02:00
c18c21f651 app: treat Meta_L and Meta_R as tool-relevant modifiers
for the Mac, they are still unhandled by tools though.
2011-10-05 19:44:24 +02:00
f1d4dde36a libgimpwidgets: add gdk_event_triggers_context_menu() to gimp3migration.[ch]
and remove gimp_button_event_triggers_context_menu() again. Update
all callers to use the new function.
2011-10-02 16:23:59 +02:00
d92cd2f6c8 Add gimp_button_event_triggers_context_menu() and use it
instead of checking for event->button == 3, so context menus
work correctly on the Mac. Didn't change the image menu yet
because thet requires some more refactoring.
2011-09-19 00:47:23 +02:00
1bff2c8df2 app: sprinkle const qualifiers in the tool event callback functions 2011-05-31 23:18:11 +02:00
da18c1114b app: gimpdisplayshell-tool-events.c: move Tab handling to a utility function
instead of having separate utility functions for the different
functions triggered by various Tab combinations.
2011-05-31 09:24:14 +02:00
8e5f18fb9e app: make Alt+Tab and Alt+Shift+Tab cycle through all open displays
in both multi- and single-window mode. This is useful especially in
multi-window mode because in single-window we can already cycle
through all tabs with Ctrl+PageUp/Down.
2011-05-30 23:46:50 +02:00
534b48cb0d app: add gimp_motion_buffer_get_last_motion_time() and use it
The last poking into the buffer is gone now.
2011-04-18 13:13:51 +02:00
e028195cf3 app: rename process_stroke() and process_hover() to request_foo()
Because that's what we are doing by calling the functions: requesting
the emission of "stroke" and "hover" signals.
2011-04-18 11:32:10 +02:00
3fbbb9b333 app: GimpMotionBuffer API cleanup and refactoring
- start_stroke()/finih_stroke() -> begin_stroke()/end_stroke()
- process_event_queue() -> process_stroke()
- GimpMotionBuffer::motion() -> GimpMotionBuffer::stroke()
- add GimpMotionBuffer::hover() and process_hover()
- remove push_event_history() and pop_event_queue() from API

The thing works like this:

- Motion events are continuously fed into the buffer using motion_event()
- begin_stroke()/end_stroke() correspond to BUTTON_PRESS/BUTTON_RELEASE,
  the period between them is a "stroke"
- If motion_event() returns TRUE, we request "stroke" signals by calling
  process_stroke() and "hover" signals by calling process_hover()
2011-04-18 11:08:24 +02:00
d62cf65030 app: rename gimp_motion_buffer_eval_event() to motion_event()
because it's feeding it motion events.
2011-04-18 01:09:57 +02:00
6f865eda2b app: add start_stroke() and finish_stroke() API to GimpMotionBuffer
where finish_stroke() is the former flush_event_queue() and
start_stroke() is used in BUTTON_PRESS instead of poking into the
motion buffer's internals. Also, call finish_stroke() also when the
tool is not active, so the event buffer is flushed (the "motion"
callback will ignore the events if the tool is not active).
2011-04-18 00:35:20 +02:00