Commit Graph

3481 Commits

Author SHA1 Message Date
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
Alexander Larsson
e9b0f9e81a [win32] Fix win32 theme crash on offscreen windows
We add _gdk_offscreen_window_get_real_drawable to get the real
pixmap impl for offscreen windows, then we use this
in gdkgc-win32.c:get_impl_drawable() for offscreen windows
This fixes a crash when rendering win32 theme parts on
offscreen windows (bug #623563)
2011-12-16 09:11:59 +01:00
Alexander Larsson
f8170ee873 Move GdkOffscreenWindow basic type info to gdkinternals.h
This is needed to handle runtime checks for GdkOffscreenWindows
outside of gdkoffscreenwindow.c
2011-12-16 09:11:58 +01:00
Dieter Verfaillie
3df3cafdbb win32: Make all GDK_WINDOW_TEMP always on top
This makes menus, popups and tooltips show above the windows
task bar.

Backported from commit 62b505174f
on master branch.
2011-12-07 20:00:35 +01:00
Alexander Larsson
ba8c4bb049 win32: Fix 16bit pixmaps
This reverts to the old dibsection creation code for 16bit depth.
This makes the non-cairo stuff work, we then access the bits as
a cairo image surface, which isn't 100% right, but might be good
enough.

Fixes bug 665013
2011-12-06 11:29:00 +01:00
Michael Natterer
2e06f63743 Bug 663856 - Make option-foo accelerators use the right symbol
If the keyboard group shifting modifier is *also* a normal
accelerator modifier, we need to special case it when calling
gdk_keymap_translate_keyboard_state(), so we get the right
key symbol for accelerators (for example we want Option-O,
not Option-Ø displayed in menu items). This patch should only
affect quartz where the Alt key both shifts the group and can
be used as accel modifier, and not X11 or Win32 where AltGr
is not used for accelerators.

- fix quartz' gdk_keymap_translate_keyboard_state() to return
  the right consumed_modifiers
- add _gtk_translate_keyboard_accel_state() which does the
  special casing
- use it everywhere instead of gdk_keymap_translate_keyboard_state()
2011-11-18 12:25:03 +01:00
Michael Natterer
0729cdc9a1 quartz: fix a race condition when waking up the CGRunLoop
Wake up the run loop unconditionally (don't check if it is waiting) because
it might go into waiting state right after we checked for it. Fixes GIMP
startup (which has a lot of GIOChannel I/O but zero NSEvents) from several
minutes to a few seconds.
2011-11-11 23:54:23 +01:00
Dieter Verfaillie
1b58117bbf win32: fix GDK_DEBUG="draw" crasher
When running with GDK_DUBUG="draw", gdk_win32_draw_rectangle
calls _gdk_win32_drawable_description, which calls
gdk_drawable_get_size for a GdkWindowImplWin32.

gdk_drawable_get_size then tries to call
GDK_DRAWABLE_GET_CLASS (drawable)->get_size, which points
to NULL for GdkWindowImplWin32.

Adding the missing drawable_class->get_size implementation
fixes this.
2011-11-09 14:52:04 +01:00
Alexander Larsson
2ae574ab6d win32: Let cairo create DIBs for GdkPixmap
The win32 code for GdkPixmap dib creation workes as such, but
when creating a cairo surface for it with cairo_win32_surface_create
from the HDC it fails for any bitmap format than RGB24, due to
assumptions in cairo.

In order to create a cairo surface for e.g. A1 formats we need
to let cairo create the surface via cairo_win32_surface_create_with_dib.
Additionally, we must then make sure to use this surface in
gdk_drawable_ref_cairo_surface, and to not create a new HDC for
it but reuse the cairo one (as only one HDC can write to a bitmap).

Even with this fixed there are some issues with current cairo, as
cairo A1 format isn't quite the same as win32 monochrome bitmaps.
Fixes for cairo will be submitted.
2011-11-09 13:33:19 +01:00
Alexander Larsson
36f2f822f2 win32: Make sure to set is_foreign for foreign pixmaps 2011-11-09 13:33:19 +01:00
Alexander Larsson
a9b127660b win32: Fix up error message 2011-11-09 13:33:18 +01:00
Alexander Larsson
b2f91bcb8f win32: GDIFlush before accessing pixmap bits 2011-11-09 13:33:18 +01:00
Michael Natterer
3b5c5710da quartz: include all buttons' state in GdkEventMotion.state 2011-11-09 00:34:45 +01:00
Michael Natterer
a381e8ea62 quartz: include all buttons' states in GdkEventButton.state 2011-11-09 00:25:01 +01:00
Michael Natterer
d8cf87983e 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:46:30 +01:00
Matthias Clasen
e4cee92e22 Don't use deprecated Pango api 2011-11-08 12:40:48 -05:00
Richard Hughes
6a4a78d6a2 Fix a segfault if the GAppInfo does not have an icon
This fixes the following backtrace:

 0  g_logv (log_domain=0x7ffff60461a4 "GLib-GObject", log_level=<optimized out>,
    format=0x7ffff599c322 "%s: assertion `%s' failed", args1=0x7fffffffc418) at gmessages.c:577
 1  0x00007ffff59312d2 in g_log (log_domain=<optimized out>, log_level=<optimized out>,
    format=<optimized out>) at gmessages.c:591
 2  0x00007ffff601c3c7 in g_object_ref (_object=0x0) at gobject.c:2648
 3  0x00007ffff7721e22 in gdk_x11_app_launch_context_get_startup_notify_id (context=<optimized out>,
    info=0x7fffe8004b40, files=<optimized out>) at gdkapplaunchcontext-x11.c:331
 4  0x00007ffff62e60d0 in _g_desktop_app_info_launch_uris_internal (appinfo=0x7fffe8004b40, uris=0x0,
    launch_context=0x7fffe401c800, spawn_flags=G_SPAWN_SEARCH_PATH, user_setup=0, user_setup_data=0x0,
    pid_callback=0, pid_callback_data=0x0, error=0x7fffffffc848) at gdesktopappinfo.c:1269
 5  0x00007ffff62e630a in g_desktop_app_info_launch_uris (appinfo=<optimized out>, uris=<optimized out>,
    launch_context=<optimized out>, error=<optimized out>) at gdesktopappinfo.c:1341
 6  0x00007ffff62e636b in g_desktop_app_info_launch (appinfo=0x7fffe8004b40, files=<optimized out>,
    launch_context=0x7fffe401c800, error=0x7fffffffc848) at gdesktopappinfo.c:1388
2011-11-08 12:29:11 -05:00
Michael Natterer
32b70a56d1 gdk: exclude MOD1 from the virtual modifier mapping
which effectively nails down the MOD1 == ALT assumption that is valid
in all other parts of GTK+. After the modifier abstraction fixes for
OSX, the virtual mapping is now (correctly) used in more places, and
caused problems with the common default PC keyboard layout on X11 that
colocates ALT and META on the same key.
(cherry picked from commit ac943bf69a)
2011-11-07 20:19:05 +01:00
Alexander Larsson
c3601481b7 Merge branch 'gtk-2-24-win32' into gtk-2-24 2011-11-07 15:07:01 +01:00
Dieter Verfaillie
fe67f04a16 win32: fix scrolling artifacts
When scrolling a window partially obscured by another window,
artifacts of the obsuring window where being blitted into
the newly scrolled position. In other words, BitBlt copies
the covered region (basically garbage instead of what we want)
and does not cause a repaint (unlike how XCopyArea behaves).

Replacing BitBlt() with the old ScrollDC gymnastics (removed from
blit_inside_window() in commit e96a41be45)
when being passed a Window for blit_inside_drawable() makes these
artifacts go away.

Thanks to Alexander Larsson for figuring out the cause and
pointing out possible solutions.
2011-11-07 14:56:38 +01:00
Michael Natterer
6f4a6b4936 quartz: handle recursive CFRunLoops
Fixes e.g. crashs when dropping from finder.

Turn the "getting_events" boolean into a counter to handle poll_func()
being called recursively, and track the loop depth correctly by
changing its counter before bailing out in run_loop_observer_callback().
This way we reallocate our autorelease pool at the right time, and
don't kill memory that is still in use by outer run loops.

Also drain, not release the pool, just for some defensive forward
compatibility.
2011-11-06 23:12:57 +01:00
Kristian Rietveld
5123ad079e quartz: make gdk_quartz_osx_version conform to coding style 2011-11-06 09:34:39 +01:00
Kristian Rietveld
ff75900b53 quartz: make test_resize () conform to coding style 2011-11-06 09:33:50 +01:00
Kristian Rietveld
6725dee3aa 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 09:25:16 +01:00
Kristian Rietveld
d0e5025694 quartz: Factor out toplevel from NSEvent code into function 2011-11-05 22:53:22 +01:00
Kristian Rietveld
cca1621e71 quartz: Separate out screen_point conversion in function
Reduces code duplication and confusion.
2011-11-05 22:45:05 +01:00
Kristian Rietveld
0f7c96b619 quartz: remove unused variable 2011-11-05 22:39:57 +01:00
Dieter Verfaillie
a37c466698 win32: fix pasting screenshots taken with PrintScreen or Alt+PrintScreen
These are found on the clipboard in the biCompression == BI_BITFIELDS &&
biBitCount >= 16 format. In this case the BITMAPINFOHEADER is followed
by three DWORD specifying the masks of the red green and blue components,
but bfOffBits was not being adjusted accordingly.

Based on Massimo's comment on bug 631384 and verified on
http://msdn.microsoft.com/en-us/library/dd183386%28v=VS.85%29.aspx

https://bugzilla.gnome.org/show_bug.cgi?id=631384
2011-11-04 15:37:52 +01:00
Dieter Verfaillie
a8e820aa75 win32: fix some typos 2011-11-04 15:37:51 +01:00
Alexander Larsson
985fff354d win32: Fix some warnings 2011-11-02 16:49:55 +01:00
Alexander Larsson
3cd9920e14 win32: Ensure newly mapped toplevels are inside the workarea
This is what e.g. metacity does, and its needed to e.g. get the inital
position of the gimp dock window right.
2011-11-02 14:30:23 +01:00