Commit Graph

42 Commits

Author SHA1 Message Date
Michael Natterer 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
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 a38faefba7 app: use toggle_behavior_mask not CONTROL to trigger zoom-on-scroll 2011-10-07 00:00:42 +02:00
Michael Natterer 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
Michael Natterer 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
Michael Natterer 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
Michael Natterer 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
Michael Natterer 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
Michael Natterer 1bff2c8df2 app: sprinkle const qualifiers in the tool event callback functions 2011-05-31 23:18:11 +02:00
Michael Natterer 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
Michael Natterer 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
Michael Natterer 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
Michael Natterer 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
Michael Natterer 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
Michael Natterer 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
Michael Natterer 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
Michael Natterer 334e4c5d71 app: move process_event_queue() and flush_event_queue() to GimpMotionBuffer
and emit the buffer's "motion" signal when a motion is supposed
to happen. In GimpDisplayShell, connect to GimpMotionBuffer::motion()
and call the tool.
2011-04-17 21:46:29 +02:00
Michael Natterer d784ca0a59 app: don't PAUSE/RESUME the active tool around sending it motion events
That's most likely a very old artifact that was needed not even when
we used to do XOR, and these days it's even wrong because it makes
the tools think that something about the display has changed, like
zoom or scroll.
2011-04-17 21:12:02 +02:00
Michael Natterer 9f61a7d2a1 app: siplify gimp_display_shell_process_event_queue()
by using gimp_motion_buffer_pop_event_queue() here too.
2011-04-17 20:43:55 +02:00
Michael Natterer bb3eac557d app: add gimp_motion_buffer_pop_event_queue() and use it
instead of accessing and removing the queue's first element menually.
2011-04-17 20:20:18 +02:00
Michael Natterer aa7c31b802 app: s/gdouble inertia_factor/gboolean event_fill/ in eval_event()
Also remove "gdouble max_coord_smooth" from GimpTool and simply use
the existing motion mode for deciding whether or not to fill in
events.
2011-04-17 19:59:31 +02:00
Michael Natterer 7ab72eb54a app: flush the event queue unconditionally on BUTTON_RELEASE
The flashing function checks for a non-empty queue by itself. Also
remove the timeout source explicitly in flush_event_queue() because it
might be called directly, and its FALSE return value has no effect on
the timeout source in that case.
2011-04-17 19:21:46 +02:00
Michael Natterer 2dbaf7f490 app: set "last_read_motion_time" in gimp_motion_buffer_eval_event()
because it is called whenever we process a newly received event.
2011-04-17 19:05:49 +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
Mikael Magnusson ac403ce11d Add a controller for binding mouse buttons 2011-04-06 23:35:14 +02:00
Michael Natterer 7fae1b3c50 app: update the tool's state after the wheel controller has handled the event 2011-04-06 22:50:20 +02:00
Michael Natterer febc1da4be app: ignore button 1 release if we have no pointer grab
which is more correct than the previous commit
2011-04-06 22:44:08 +02:00
Michael Natterer 14d30fd795 app: ignore button releases while another button's action is going on
- ignore button 1 release if we are button-2-scrolling
- ignore button 2 release if we are not button-2-scrolling
2011-04-06 22:30:44 +02:00
Michael Natterer 754d45c357 app: completely ignore focus change events while we have a grab
in order to be safe against whatever windowing system / event manager
depending event order. Also properly update the tool's state after a
button reelease, and after a space release.
2011-04-06 21:37:46 +02:00
Michael Natterer fce5c7ea26 app: add "gboolean focus_in" to gimp_display_shell_update_focus()
and use it to update the tool's state also when the canvas gets a
FOCUS_OUT.
2011-04-03 19:02:19 +02:00
Michael Natterer 5a76519c88 app: call gimp_display_shell_update_focus() in more cases
instead of duplicating its functionality.
2011-04-03 18:52:24 +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 b468bb5ec9 app: add gimp_display_shell_initialize_tool() in tool-events.c
so another big block of logic is gone from "the huge function".
2011-04-03 18:28:26 +02:00
Michael Natterer e4daf561ac app: return TRUE after handling double and triple click tool events
so we don't redundantly update the cursor again.
2011-03-31 10:21:55 +02:00
Michael Natterer ee844c6395 app: GimpDeviceManager refactoring part two
- change gimp_devices_get_list() to gimp_devices_get_manager()
- remove gimp_devices_get_current()
- let GimpDeviceStatus connect to the manager's "notify::current-device"
  directly and remove device status updating code from gui.c
- cleanup in gimpdevices.c
2011-02-28 14:37:00 +01:00
Michael Natterer d136b9f7d2 app: redo the last commit and call proximity_in() at all logical places
Keep the comment at the place where calling it isn't immediately
obvious, and add checks to proximity_in() and out() so they bail out
when the proximity state is already set correctly.
2011-02-27 12:16:51 +01:00
Michael Natterer 75add92218 app: add utility functions proximity_in() and proximity_out()
and use them instead of manually setting proximity. Also add comments
about why we call the proximity functions where we call them (instead
of calling them where it seems more logical).
2011-02-27 12:08:09 +01:00
Michael Natterer 955fecc3cd app: replace a wrong G_LIKELY() by G_UNLIKELY() in tool_events() 2011-02-27 11:08:36 +01:00
Michael Natterer 85af450b3c app: forgot to #include "widgets/gimpwidgets-utils.h" 2011-02-24 16:54:39 +01:00
Michael Natterer c11b0d2a79 app: move tool event debug output to a utility function
to reduce clutter in gimp_display_shell_canvas_tool_events().
2011-02-24 12:34:57 +01:00
Michael Natterer 3c0453b3c0 app: clean up static functions in the new tool-events.c file 2011-02-24 02:15:53 +01:00
Michael Natterer c09ad998a4 app: split tool event handling out into an own file
it was simply getting too hairy in the callbacks.c file.
2011-02-24 02:15:53 +01:00