Commit Graph

3511 Commits

Author SHA1 Message Date
Alan McGovern
776fc82bd5 quartz: Null check title before setting it
This avoids a crash in objective-c.

https://bugzilla.gnome.org/show_bug.cgi?id=695278
2013-03-06 12:40:23 +01:00
Aleksander Morgado
461c3835aa win32: fix possible memleak if GlobalAlloc() fails
Also remove the unused 'buf' variable.

https://bugzilla.gnome.org/show_bug.cgi?id=694742
2013-02-26 15:14:35 +01:00
Kristian Rietveld
184407309f quartz: retain content view when switching over toplevel. 2012-12-28 22:12:18 +01:00
Kristian Rietveld
30deba453a quartz: Make sure the old toplevel is closed on recreation 2012-12-28 22:12:18 +01:00
Kristian Rietveld
a8008b796f quartz: make sure all old properties are set on the new toplevel
Apply patch by Paul Davies; part of bug 669808.
2012-12-28 22:12:18 +01:00
Kristian Rietveld
62f1d871b7 quartz: ensure window being (un)fullscreened is visible
Patch by Paul Davis; part of bug 669808.
2012-12-28 22:12:18 +01:00
Matthias Clasen
1f0f399469 Move single-include guards inside include guards
gcc has optimizations for include guards that only work
if they are outermost in the the header.
https://bugzilla.gnome.org/show_bug.cgi?id=689810
2012-12-28 11:26:46 -05:00
John Ralls
e8535149e4 Bug 689982: Random Crash
Update Cairo_Win32 error handling to respond correctly to
cairo_win32_foo_create() functions returning a "nil" surface.
2012-12-10 09:32:00 -08:00
Alan McGovern
5637ef1f97 Fix broken function pointer declarations on windows
Both flashing a window and setting the window opacity were using
incorrect declarations for function pointers. They were missing the
WINAPI annotation as defined in windows.h. As a result, the stack
could be corrupted when these functions were invoked.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=689235
2012-11-29 15:06:02 +01:00
Michael Natterer
9644e910a8 quartz: add mountain lion as version 8 to enum GdkOSXVersion
Also use GDK_OSX_UNSUPPORTED instead of 0 in gdk_quartz_osx_version().
2012-11-29 14:51:59 +01:00
Michael Natterer
d6533ffc44 quartz: call Gestalt() only once per session in gdk_quartz_osx_version()
Thanks to Paul Davis for pointing this out.
2012-11-29 14:44:04 +01:00
Daniel Sabo
ffd949132a Bug 663990 - Tablet pressure is broken on MacOSX
Add extended input support to GDK Quartz.
2012-11-25 19:41:07 +01:00
Camillo Lugaresi
0596f5591f Bug 688710 - splashscreen shouldn't be always on top on OS X
Activate the "hides on deactivate" behavior for splashscreens,
torn-off menus, utility windows, tooltips and notifications: when
another application is brought to the front, these windows are hidden
so as not to obscure it. This is the expected behavior for
application-specific floating windows on OS X.
2012-11-20 22:01:13 +01:00
Michael Natterer
27f3fcf12c quartz: fix the mapping of GDK_KP_Enter in known_numeric_keys[]
so it will actually be used, instead of delivering GDK_Return
when it should be GDK_KP_Enter.
2012-11-20 19:12:17 +01:00
Michael Natterer
35a9322e45 quartz: always send GDK_NOTIFY_NONLINEAR crossing events
so GtkMenu works properly. This is not right, but not more
wrong than always sending GDK_NOTIFY_ANCESTOR either.
2012-11-20 10:02:02 +01:00
Michael Natterer
979e5061a0 Bug 672193 - windows (including menus) shown multiple times don't...
Based on a patch from Paul Davis, inject synthetic enter events directly
into the Quartz event stream, instead of trying to synthesize them in GDK.

This seems to magically fix most combo box popup weirdness, I guess
some code is relying on a specfic order of events, or any other state
imposed by the "proper" code path of events coming in the usual way.

The patch also removes _gdk_quartz_events_send_enter_notify_event()
which is now obsolete.
2012-11-20 10:01:08 +01:00
Michael Natterer
b4a30877a9 quartz: use the real current event time for generated motion events 2012-11-18 20:15:45 +01:00
Michael Natterer
1a2509a6ab quartz: move tooltips window to the topmost level
so they can appear on top of popup menus. Also, reorder the switch()
statement in window_type_hint_to_level() so it resembles the stacking
order, to avoid confision like this in the future.
2012-11-18 17:45:12 +01:00
Kristian Rietveld
e982461ad6 quartz: correct deficiencies in the gdk_draw_drawable() implementation
The call to scrollRect: must be accompanied by a call to redraw the
newly exposed area, otherwise the scrollRect: will have no effect.
Secondly, compute the newly exposed area correctly.
Thirdly, also expose the lower window border or the area moved from
the lower window border if applicable, to make sure rounded corners
are properly drawn or don't leave garbage.
2012-11-15 14:59:11 +01:00
Kristian Rietveld
4d01c56d89 quartz: add _gdk_quartz_window_set_needs_display_in_region
It's needed for the next commit, which is an actual fix.
2012-11-15 14:49:25 +01:00
Michael Natterer
43e1354b71 quartz: filter out button press events on the window frame
Don't try to handle button press events on the window frame, they
have out-of-window coordinates. Also, break grabs on such events
so popup menus go away.
Patch from Kristian Rietveld, fixes bug 684419.
2012-11-15 11:34:15 +01:00
Michael Natterer
47f0e3f1e1 quartz: move SPLASHSCREEN-hinted windows to NSStatusWindowLevel
which does not really have a different effect than the previously
used NSPopUpMenuWindowLevel, but is what all code examples I found
are using, and it does make more sense.
2012-11-13 20:01:05 +01:00
Michael Natterer
5934ad2e22 quartz: _gdk_quartz_gc_update_cg_context(): the minimum line width is 1.0
not G_MINFLOAT. Patch from Kristian Rietveld.
2012-11-08 15:00:38 +01:00
Alexander Larsson
bb867e9406 win32: Don't leak the pixmap cairo_surface
GdkPixmapWin32 allocates a cairo_surface manually for non-foreign
pixmaps, instead of letting GdkDrawableWin32 create on on-demand.
However, the pixmap created surface is a strong ref, rather than the
weak ref created by gdk_win32_ref_cairo_surface() so we can't rely
on _gdk_win32_drawable_finish to actually free it. So, we have to
manually free it when we finalize or we leak it.

https://bugzilla.gnome.org/show_bug.cgi?id=685959
2012-10-24 12:43:27 +02:00
Kristian Rietveld
0e42cf81f1 quartz: Actually use the window background PATTERN color
Before we used a window's background color, which resulted in corrupted
display in some cases, presumably because we didn't reset the active
pattern. This patch seems to eliminate the observed corruption.
2012-10-09 16:16:42 +02:00
Kristian Rietveld
92ea94af5f Fix garbage content when windows are initially mapped
The garbage would be visible if any widget enabled the toplevel
NSView's CALayer in order to do custom native rendering.
2012-09-28 10:07:59 +02:00
Michael Natterer
79b3326eaa quartz: Bug 674108 - Hard crash due to wrong NSAutoreleasePool stacking
Apply patch from Kristian Rietveld which addresses two issues
in gdkeventloop-quartz.c:

This patch moves the autorelease pool drain and introduces protection against
the invalidated ufds. Basically, when we suspect ufds has been invalidated by a
recursive main loop instance, we refrain from calling the collect function.
2012-09-14 15:18:33 +02:00
Matthias Clasen
1533e67ae4 Try harder to discriminate Shift-F10 and F10
A change in xkeyboard-config 2.4.1 made it so that function keys
now have a shift level which has the same symbol, but 'eats' the
shift modifier. This would ordinarily make it impossible for us
to discriminate between these key combinations.

This commit tries harder to discriminate in 2 ways:
- XKB has a mechanism to tell us when a modifier should not be
  consumed even though it was used in determining the level.
  We now respect such 'preserved' modifiers. This does not fix
  the Shift-F10 vs F10 problem yet, since xkeyboard-config does
  not currently mark Shift as preserved for function keys.
- Don't consume modifiers that do not change the symbol. For
  the function keys, the symbol on the shift level is the same
  as the base level, so we don't consider Shift consumed.

For more background on the xkeyboard-config change, see
https://bugs.freedesktop.org/show_bug.cgi?id=45008

https://bugzilla.gnome.org/show_bug.cgi?id=661973
2012-09-09 18:49:18 -04:00
Kristian Rietveld
b4ddf24234 Implement gtk-primary-button-warps-slider GtkSetting
It replaces the recently added GtkRange:primary-button-warps-slider
style property. Implement the setting in the quartz backend,
it proxies the "click in the scroll bar to" property from the
OS X PrefPane.
2012-09-07 16:46:08 +02:00
Kristian Rietveld
3d5cd6e055 quartz: fix corruption during scrolling in some cases
A call to scrollRect must be followed by a call to set that the offset
rect needs display for the changes to "take effect". This was not
done prior to this patch which, in some cases, caused corruption during
scrolling.
2012-08-26 15:45:46 +02:00
Michael Natterer
c0c3085128 quartz: add evil casting to make sure time wraps correctly on 32bit machines
get_time_from_ns_event(): apply patch from Michael Hutchinson which
makes sure the returned guint32 wraps correctly on 32 bit machines
when the uptime exceeds 2^32 ms.
(cherry picked from commit 78506bd604)
2012-08-23 09:32:20 +02:00
John Ralls
48547aadef Bug 681784 Colorspaces used in gtk+ and cairo quartz backends do not
match

Changes inspired by parafin <help@imtrappedininternet.com>
Replace colorspace creation calls to match those used by Cairo.
2012-08-21 16:21:28 -07:00
Matthias Clasen
a9fb816a3f Fix a case of 'stuck grab'
This was showing up when using a combo box in list mode. After popping
up the list, the keyboard grab appeared stuck. What was stuck here is
only the client-side grab, since we forgot to clean up our grabs
when receiving an UnmapNotify.

This bug was introduced in 3f6592f60f.

[ Alexandre Rostovtsev <tetromino@gentoo.org>: backport to 2.24 ]

https://bugzilla.gnome.org/show_bug.cgi?id=680346
2012-07-20 20:02:33 -04:00
Daniel Sabo
da324fa2d5 [Bug 676362] _gdk_quartz_image_copy_to_image always returns black for
the root window

Revised patch which doesn't depend upon NSRect being typdeffed from
CGRect (64-bit only).
2012-06-13 17:37:35 +01:00
Daniel Sabo
2f706868ff Bug 676362 - _gdk_quartz_image_copy_to_image always returns black...
Implement a special case for the root window, which has to be handled
differently on OS X.

Contains some bit fiddling corrections by Kristian Rietveld.
2012-06-11 21:10:19 +02:00
Kristian Rietveld
860499ce90 quartz: delay emission of EnterNotify until window position is known
Beforehand, the check whether or not emission is necessary was done
based on the "uninitialized" window position in the top left corner.
We now wait until the window size is set for the first time, to avoid
emitting EnterNotify when it is not necessary.
2012-06-11 21:10:19 +02:00
Kristian Rietveld
194d5544b4 quartz: Ignore events from all mouse buttons past the resize boundary
Before, right click events were still let through into GDK. In this
case, also middle/right button events with x-coordinates in the range
[-3, 0] are processed, resulting in failures/crashes in the window
finding code because no GdkWindows are present in this range.
2012-05-13 18:00:47 +02:00
Michael Natterer
b738cf85d9 quartz: handle yet another dead tilde variant
which is delivered by the US-International keyboard layout.
2012-05-08 15:52:52 +02:00
Kristian Rietveld
5f25687104 [quartz] Fix manual resizing of windows
In the Quartz backend, there are two methods by which windows are
resized. The first method is fully handled by Quartz and does not appear
in the event stream the application resizes. The second method is when
we resize windows by ourselves. In OS X this happens when a GTK+ resize
grip is used. This resize grip is larger than the Quartz resize grip.
When the resize is started outside the "Quartz area", we have to handle
it by ourselves.

This patch fixes this manual window resizing by ignoring events while we
are in the process of resizing (such that the events actually arrive at
the sendEvent handler of GdkQuartzWindow where this resize is handled).
When the resize has finished we break all grabs such that GDK is not
stuck thinking the cursor is still in the resize window.
2012-04-10 21:22:07 +02:00
Kristian Rietveld
ac4f3be6a5 Export break_all_grabs() within Quartz backend
Function was renamed to _gdk_quartz_events_break_all_grabs().
2012-04-10 21:22:07 +02:00
Mikael Magnusson
3f6592f60f Iconification using _NET_WM_STATE_HIDDEN hint if supported by WM
If the Window Manager supports the _NET_WM_STATE_HIDDEN, we use it to use
the _NET_WM_STATE protocol when de-iconifying windows (iconification is
unchanged, via XIconifyWindow). Additionally, we no longer interpret all
UnmapNotify events for our window as the result of iconification.

(Based on patch by Tomas Frydrych <tf@linux.intel.com>)
2012-03-02 20:37:32 +01:00
Michael Natterer
dca75f3b93 quartz: remove excess initializers in the new modifier_keys array 2012-02-23 13:53:51 +01:00
Michael Natterer
0b24f16241 quartz: make function keys work (again?)
The F keys have no unicode mapping, and UCKeyTranslate() returns
a bogus 0x10 as mapping to unicode. Instead of checking for this
random and undocumented return value, simply assign all function
keys explicitly. This patch also splits the ill-named "known_keys"
array into "modifier_keys" and "function_keys" which is much
more obvious.
2012-02-23 13:34:01 +01:00
Bastien Nocera
2ab1526467 x11: Fix first call to _gdk_x11_keymap_key_is_modifier()
_gdk_x11_keymap_key_is_modifier() never tries to set min/max_keycode
if they haven't been set before, meaning that until another function
sets those, all the keys will be seen as non-modifiers.

This causes GdkKeyEvents to be wrongly tagged with "->is_modifier = 0"
when in actual fact the key is a modifier. This fixes keyboard
shortcuts captured with GtkCellRendererAccel in "raw" mode thinking
a modifier without any actual keys is a valid shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=670400

Conflicts:

	gdk/x11/gdkkeys-x11.c
2012-02-19 17:42:19 +01:00
Javier Jardón
0b2fd066b9 gdk/gdkwindow: Add missins "Since:2.24"
Reported by Mike Massonnet in bug
https://bugzilla.gnome.org/show_bug.cgi?id=670093
2012-02-14 19:40:17 +00:00
Michael Natterer
5f48cfe491 Bug 667691 - implement gdk_window_restack() for Quartz
Apply patch from Paul Davis which implements this missing function.
2012-01-26 10:15:27 +01:00
Dieter Verfaillie
fb87d9c901 win32: fix gdk_win32_window_raise
When calling gtk_window_present(), gdk_win32_window_raise did not
actually raise the window anymore. Replacing BringWindowToTop() with
SetForegroundWindow() fixes this.

During testing, we also discovered that sometimes SetForeGroundWindow()
will (correctly) refuse to raise the window and fail(for example: sometimes
when dragging a different application at the time of a gtk_window_present()
call). To prevent a GdkWarning from being produced, usage of the API_CALL
macro has been removed for this case.

Additional goodies of SetForeGroundWindow:
- it brings the window to the front when the process owning the
  window to raise is the foreground process (for example when
  gtk_window_present is called from a GtkStatusIcon's activate
  signal handler)
- it limits itself to flashing the task bar button associated
  with the window if the process owning the window to raise
  is *not* the foreground process (for example when gtk_window_present
  is called from a g_timeout_add callback function)

https://bugzilla.gnome.org/show_bug.cgi?id=665760
2012-01-25 12:47:04 +01:00
Michael Natterer
0488c28488 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.
2012-01-19 16:17:13 +01:00
Ryan Lortie
986072b361 introspection: Fix srcdir != builddir builds
https://bugzilla.gnome.org/show_bug.cgi?id=667458
2012-01-09 17:08:12 +01:00
Matthias Clasen
2a9bf2619a Fix problems with DND on some X servers
When the X server does not support the shape extension (as some
vnc implementations seem to), our DND code was always seeing
an empty input shape, so drops always missed their target.

http://bugzilla.gnome.org/show_bug.cgi?id=620240
2012-01-03 11:03:45 -05:00