Commit Graph

155 Commits

Author SHA1 Message Date
John Ralls
d859c921c5 Quartz: Fix incompatible types in assignment
NSEvent -scrollingDeltaX and -scrollingDeltaY aren't defined before
10.7, so objc assumes that they return a pointer. Trying to cast to a
float generates a compiler error.
2012-03-01 17:00:35 -08:00
Michael Natterer
d0b032e3be quartz: Implement smooth scrolling
nsevent scrollingDeltaX/Y (available on OSX >= Lion) is used to
provide the smooth scrolling values. In any case, old fashioned
events are still sent, setting _gdk_event_set_pointer_emulated()
if the event contains both smooth and non-smooth values.
2012-03-01 16:28:58 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Michael Natterer
0ea1924494 quartz: add virtual modifiers already in GDK, just as X11 does it
Key event states  will now always contain GDK_META_MASK in addition
to GDK_MOD2_MASK.
(cherry picked from commit d915d17ff6)
2012-01-19 16:29:41 +01:00
Michael Natterer
5ca2f06893 quartz: include all buttons' state in GdkEventMotion.state
(cherry picked from commit 3b5c5710da)
2011-11-09 00:36:21 +01:00
Michael Natterer
5f6c70f211 quartz: include all buttons' states in GdkEventButton.state
(cherry picked from commit a381e8ea62)
2011-11-09 00:26:30 +01:00
Michael Natterer
264241eb11 Bug 663605 - Fix event->state of many event types on quartz
Don't try to remember the current keyboard modifier and mouse button
states from the last event, because that isn't always right, and don't
set event.state = 0 for generated events. Instead, add private functions
to get the current states, and implement them with API that retrieves
these states independently from an event.
2011-11-08 21:52:49 +01:00
Kristian Rietveld
88329aeff4 quartz: use get_toplevel_from_ns_event in one more place
Fixup needed due to refactoring in GTK+-3.0.
2011-11-06 10:36:00 +01:00
Kristian Rietveld
e5ccae5782 quartz: make test_resize () conform to coding style 2011-11-06 10:16:27 +01:00
Kristian Rietveld
9f45c37be7 quartz: Process motion events within windows bounds without window set
When an NSEvent does not have the window field set, we already assumed
the event was not for us and discarded it.  But for NSMouseMoved events
we now make an exception, because such events generated after
using/clicking the main menu bar have the window field set to NULL while
the application window still has focus.

We used to experience a loss of motion events after using the menu bar,
this could be seen in buttons that stopped prelighting and first
clicks often being ignored unless you clicked somewhere else first.
These issues are fixed by this patch.
2011-11-06 10:15:16 +01:00
Kristian Rietveld
7269cdf315 quartz: Factor out toplevel from NSEvent code into function 2011-11-06 10:12:24 +01:00
Kristian Rietveld
6a7280ce1a quartz: Separate out screen_point conversion in function
Reduces code duplication and confusion.
2011-11-06 10:10:12 +01:00
Kristian Rietveld
4d9d8ba96d quartz: remove unused variable 2011-11-06 10:04:39 +01:00
Michael Natterer
a99d14f61c quartz: resolve the modifier confusion on the Mac
- map Alt/Option to MOD1
- map Command to MOD2
- map MOD2 to the virtual Meta
- improve/fix (?) group handling in gdkkeys-quartz.c
2011-09-26 16:01:50 +02:00
John Ralls
f84c787be4 Bug 655122: Lion Crashes during resize
Move resizing detection to a separate function and on 10.7 detect
resizes on all edges so that they don't result in grabs.
2011-08-13 15:30:59 -07:00
Kristian Rietveld
58ba8a7c7f quartz: use already existing current_button_state variable 2011-07-30 23:01:38 +02:00
Kristian Rietveld
a979e414fb quartz: remove _gdk_quartz_events_get_current_event_mask 2011-07-30 23:01:38 +02:00
Kristian Rietveld
c9f6c7645c quartz: return modifiers instead of an event mask ... 2011-07-30 23:01:37 +02:00
John Ralls
cfaed624be Update quartz to reflect deletion of GdkNativeWindow and client_message functions. 2011-02-01 13:53:00 -08:00
Kristian Rietveld
deffbd9885 quartz: reorder gdkprivate-quartz.h and related clean up 2010-12-23 14:17:42 +01:00
Kristian Rietveld
fb8717f722 quartz: move utils to gdkutils-quartz.c 2010-12-23 14:17:41 +01:00
Kristian Rietveld
caa9794af8 quartz: Clean up header files, use same arrangement as X11 backend 2010-12-23 14:17:41 +01:00
Kristian Rietveld
197590258f quartz: Make keyboard input work again 2010-12-22 22:33:05 +01:00
Kristian Rietveld
083c556e00 quartz: rename GdkDeviceManagerCore -> GdkQuartzDeviceManagerCore 2010-12-22 17:47:05 +01:00
Kristian Rietveld
3bc60a8149 quartz: rename GdkQuartzWindow to GdkQuartzNSWindow 2010-12-22 17:47:04 +01:00
Kristian Rietveld
6b96c56976 quartz: remove duplicate definition of gdk_flush 2010-12-22 17:47:03 +01:00
Kristian Rietveld
d0976d9f53 quartz: Fix gdkevents-quartz.c 2010-12-22 17:47:02 +01:00
Matthias Clasen
b2ff02332f Implement event_data_{copy,free} for quartz 2010-12-22 17:47:00 +01:00
Matthias Clasen
3232be603a Implement has_pending and queue_events vfuncs for quartz 2010-12-22 17:46:59 +01:00
Matthias Clasen
733c8fc8e7 Derive GdkDisplayManager for quartz 2010-12-22 17:46:59 +01:00
Matthias Clasen
8a9c604b8a Adapt quartz device code to new ways
We will need to rename the Core implementations in X11/Quartz
to not clash, later.
2010-12-22 17:46:59 +01:00
Matthias Clasen
41352f24d6 Convert all GdkScreen methods to vtable calls, quartz backend 2010-12-22 17:46:59 +01:00
Matthias Clasen
acd99409b8 Make display method vtable calls, quartz backend 2010-12-22 17:46:59 +01:00
Matthias Clasen
31cd046cd0 Move gdk_add_client_message_filter to common code 2010-12-21 12:06:55 -05:00
Kristian Rietveld
fd6e57687d Port Quartz backend to latest rendering-cleanup changes 2010-12-06 14:15:47 +01:00
John Ralls
c0aae6644a Replace references to sealed GdkDevice private variables with accessor calls in quartz. 2010-11-23 16:53:45 -08:00
William Jon McCann
323df2b280 Make gdk_event_apply_filters safe against changes in filter list
An event filter may add or remove filters itself.  This patch does
two things to address this case.  The first is to take a temporary
reference to the filter while it is being used.  The second is
to wait until after the filter function is run before determining
the next node in the list to process.  This guards against
changes to the next node.  It also does not run functions
that have been marked as removed.  Though I'm not sure if this
case can arise.

https://bugzilla.gnome.org/show_bug.cgi?id=635380
2010-11-22 13:16:24 -05:00
Benjamin Otte
b5097de481 gdk: gdk_drawable_get_display() => gdk_window_get_display() 2010-09-26 15:11:33 +02:00
Kristian Rietveld
234d750bb3 Update Quartz backend for GDK key name changes 2010-09-13 16:26:02 +02:00
Kristian Rietveld
bde0f9a8f6 quartz: Misc. fixes for getting offscreen windows to work
Mainly fixes to properly differentiate between toplevel and offscreen
windows, since these sometimes need different treatment.  Furthermore,
usage of gdk_window_get_effective_foo() instead of gdk_window_get_foo()
where applicable.
2010-08-10 21:02:31 +02:00
Kristian Rietveld
be27fba3f3 Remove dummy for gdk_event_get_graphics_expose()
This was a deprecated function that has been removed.
2010-06-30 21:43:25 +02:00
Matthias Clasen
bd4609b140 Merge the xi2-for-master branch 2010-05-25 18:38:44 -04:00
Javier Jardón
7894951cee Remove deprecated code from GdkEvent 2010-05-03 01:48:45 +02:00
Kristian Rietveld
66207cf13e Improve enter/motion notify semantics
On X11 we receive enter notify and motion notify events for a window
regardless of its focus state.  On Mac OS X this is not the case.  This
commit improves the semantics to overcome this difference.  It improves
on my earlier patch that sent a motion notify event when a window became
main.

Instead of sending a motion notify when a window becomes main, we now
send one when a window becomes key, which comes closest to a window
getting focus in X11.  This motion notify is needed because Mac OS X does
not send motion events when an application is inactive (none of its
windows have focus), these events are sent in X11.  This dummy motion
notify event (with current coordinates of the mouse cursor) allows an
application to get its prelight and other state right when it gets focus
and thus user attention.

Another change is to send an enter notify event when updating the
tracking rectangle of a GdkQuartView and the mouse cursor is currently in
this rectangle.  This rectangle is at least updated on window creation.
This enter notify event is important for the case where a new window
appears right below the mouse cursor.  The window has to receive an enter
notify event for the subsequent events to be processed correctly.  Mac
OS X does not send one in this case, so we generate it ourselves.

Both of these synthesized events have to go through
_gdk_windowing_got_event() for updating statekeeping, etc.
append_event() has a boolean flag now to make this convenient.
2010-01-30 20:36:28 +01:00
Kristian Rietveld
b2b70e5a8d Start using NSInteger and NSUInteger
These have been introduced in Leopard and default to int and unsigned int.
In 64-bit Snow Leopard they are long and unsigned long.  This caused issues
with the getRectsBeingDrawn message which needs a pointer to a NSInteger
(long on 64-bit!) but we passed in an integer.  Surprisingly this problem
was visible when compiling with -O0 (segfault), but *not* when compiling
with -O1.  Other messages were NSInteger is now needed have also been
adapted.

Since NSInteger and NSUInteger are not available on Tiger, a define
has been added to add typedefs for these when they have not been defined
by the system headers.
2009-12-27 19:28:56 +01:00
Kristian Rietveld
8846012c6d Rework coordinate transformation to be based on root window
The root window contains all the monitors attached to a Mac.  The
coordinate transformation now both translates the x and y coordinate,
translating it from the Cocoa monitor coordinate space to the GDK
coordinate space.  How monitors are laid out in the root window differs
between Cocoa and GDK, which is why it is important to translate based
on the root window to get multi monitor setups to work properly.

We have replaced the old y coordinate transformation function with
new functions that translate both the x and y coordinate.

When creating new toplevels, we have to determine the Cocoa screen on
which the toplevel should appear and translate the coordinates according
to that screen.

This change also fixes event handling in case there is a monitor left
of the screen containing the menu bar.  In such a case all coordinates
on the left monitor are negative.  Event handling broke, because of
_gdk_quartz_window_find_child() checking bounds.  Now that coordinates
are always properly translated to GDK coordinate space, in which negative
coordinates do never occur, the checks here will work properly.
2009-10-26 09:52:54 +01:00
Christian Hergert
17130a8ec9 Bug 517394 - Native resize grip steals button release ...
Explicitly handle resizing by leaving all events in the lower right 15x15
corner to Cocoa, if the window shows a resizing indicator.  Some
applications may have widgets allocated in this area.  Generally, these
widgets are likely larger than 15x15 so they can still be hit.  Often
scroll bars are found in this area and these can also be manipulated by
other means.  Since this is the only way of resizing windows on Mac OS X,
it is too important to keep it broken.
2009-09-25 21:52:13 +02:00
Kristian Rietveld
cf80feb3dd Do not test the event mask of implicit grabs
The quartz backend simulates the semantics of XGrabPointer, as a part of
this it checks the event mask of the grab.  However, implicit grabs on X
do not go through XGrabPointer and thus the quartz backend should not check
the event mask for these.  This fixes various "the UI got stuck" cases.
2009-09-16 08:48:49 +02:00
Richard Hult
52ca2f29cc Update _gdk_windowing_pointer_grab 2009-06-20 11:50:10 +02:00
Richard Hult
730a44a516 Tweak the click-through handling so active apps get it (but not inactive ones) 2009-04-02 10:16:30 +02:00