Commit Graph

395 Commits

Author SHA1 Message Date
Kristian Rietveld
77b703c2fc quartz: stop offscreen windows code from crashing.
This is an adapted version of commit
bde0f9a8f6 on master.

Mainly fixes to properly differentiate bewteen 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.

There is an drawing issue left when scrolling e.g. tree views in
offscreen windows.  I think this is likely an issue with
gdk_quartz_draw_drawable() which is used for the copy area code in
offscreen windows.  It works fine in master, since this was converted
to Cairo.
2010-08-15 17:34:33 +02:00
John Stowers
dc2fea413b Add gdk_device_get_n_axes
https://bugzilla.gnome.org/show_bug.cgi?id=624221
2010-07-25 12:32:43 +12:00
Kristian Rietveld
e634f3fbe0 Move Leopard-specific type definitions to gdkquartz.h
Update includes subsequently where it matters.  Fixes build on Mac OS
X 10.4.
2010-06-27 10:41:15 +02:00
Kristian Rietveld
3770d914ec Refactor to use API that's available in OS X 10.4 as well 2010-06-27 10:41:15 +02:00
John Ralls
093a867e51 Bug 622333 - Crash in gdk_window_impl_quartz_begin_paint_region 2010-06-27 10:41:15 +02:00
Kristian Rietveld
9f5f47f8be Flip clip mask image when setting clip mask on GC 2010-06-27 10:41:15 +02:00
Kristian Rietveld
49f72c1fb4 Rework color translation to support gray scale and bitmaps 2010-06-27 10:41:15 +02:00
Kristian Rietveld
42d07ad6ce Add gray visual, implement "get_best" functions 2010-06-27 10:41:15 +02:00
Colin Walters
c8262d39fa Use g_source_set_name for all custom GSources in GTK+
Naming the sources allows easier debugging with e.g. SystemTap
probes.

https://bugzilla.gnome.org/show_bug.cgi?id=620511
2010-06-03 21:32:06 -04:00
Javier Jardón
cfb988ab38 Seal gdk
Add G_SEAL annotation for struct members, and add accessors for
the (useful) fields. Patch based on work by Garrett Regier,
see bug #592580.
2010-05-27 16:25:54 +02:00
Benjamin Otte
fd20ac0751 Revert "Deprecate the GdkRegion API"
This reverts commit 821dd33918.
2010-05-26 09:25:35 +02:00
Benjamin Otte
821dd33918 Deprecate the GdkRegion API
Includes fixing all callers to use the cairo region API instead. This is
usually just replacing the function names, the only difference is
gdk_region_get_rectangles() being replaced by
cairo_region_num_rectangles() and cairo_region_get_rectangle() which
required a bit more work.

https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-05-23 23:27:15 +02:00
Paul Davis
7d61c9fff5 Remove arbitrary limit on number of redraw rectangles
The aim of this limit was to not degrade performance too much, however,
it actually did degrade performance to a large extent.
2010-05-12 12:20:16 +02:00
Matthias Clasen
13d69e552d Fix a compatibility problem
It turns out that my attempt at handling Super, Hyper and Meta better
is causing problems, mostly because Alt and Meta are commonly colocated
in the modmap, and apps do a check for the Alt modifier regularly.

See e.g bug 607697.
2010-02-12 18:55:42 -05: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
0912a113dd Release view after setting it as contentView
Fixes GdkQuartzView being leaked.
2009-12-30 14:14:21 +01:00
Kristian Rietveld
255c2739e2 Fix memleak in get_nsscreen_for_point()
One codepath did not go through GDK_QUARTZ_RELEASE_POOL, refactored
the code to fix this.
2009-12-30 14:12:42 +01:00
Kristian Rietveld
3887838244 Fix memory leak in GdkQuartzView
Should remove the tracking rect in dealloc.
2009-12-30 14:11:14 +01:00
Kristian Rietveld
ee62948b83 Use CGFLOAT_DEFINED, don't rely on NSINTEGER_DEFINED for this 2009-12-28 23:01:42 +01:00
Kristian Rietveld
e22de4a88e Add gdk_keymap_map_virtual_modifiers() to Quartz backend 2009-12-28 21:18:57 +01:00
Kristian Rietveld
c8fef502e2 Start using CGFloat
Fixes a bunch of compiler warnings.  Since CGFloat does not exist on
Tiger and earlier, we have added a typedef likewise as was done for
NSInteger.
2009-12-28 21:18:57 +01:00
Kristian Rietveld
f3a5bf48d4 Fix compile warning in gdk_cursor_new_from_pixmap 2009-12-28 21:18:57 +01:00
Kristian Rietveld
dd415881be initWithContentRect: has a NSUInteger parameter now
The typedef in place for Tiger and earlier systems should change this
to unsigned int without problems.
2009-12-28 21:18:56 +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
Matthias Clasen
182108c68e Implement gdk_screen_get_primary_monitor in all GDK backends
The implementations are all trivial, just returning 0. At least
for Quartz, we could probably do better than that. Bug 604459.
2009-12-13 20:40:02 -05:00
Kristian Rietveld
cffddd2adc Document how Cocoa coordinate and monitor layout transforms to GDK work 2009-11-15 15:29:45 +01:00
Nicola Fontana
1e1131c959 Do not use static GTypeInfo and GInterfaceInfo
Either g_type_register_static_simple (used by G_DEFINE_TYPE_EXTENDED)
and G_IMPLEMENT_INTERFACE use automatic variables for GTypeInfo and
GInterfaceInfo structs, while tutorials and source code often use
static variables. This commit consistently adopts the former method.

https://bugzilla.gnome.org/show_bug.cgi?id=600158
2009-11-06 01:21:09 +01:00
Kristian Rietveld
a338c7e929 Update copyright 2009-10-26 09:57:11 +01:00
Kristian Rietveld
fa8fa48ef1 Update position of toplevels after display reconfiguration
We have to do this, especially after the screen containing the menubar
has changed.  Such more larger changes in monitor geometry will cause
changes to how monitors are laid out in the root window.  The position
coordinates of the windows will have to be updated to reflect their
position in the new layout.
2009-10-26 09:52:54 +01:00
Kristian Rietveld
a4d932cc64 Fixup get_nsscreen_for_x() 2009-10-26 09:52:54 +01:00
Kristian Rietveld
221883dd31 Remove unused variable (fix compiler warning) 2009-10-26 09:52:54 +01:00
Kristian Rietveld
93530675de Update size of root window after display reconfiguration 2009-10-26 09:52:54 +01:00
Kristian Rietveld
959a9437e6 Support arbitrary screen layouts
The Quartz port now supports arbitrary multiple monitor layouts instead
of only monitors are were laid out horizontally.  This builds on the
reworked coordinate translation done in a previous commit.
2009-10-26 09:52:54 +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
Kristian Rietveld
d26dd103b2 Be consistent with X11: emit monitors-changed first, then size-changed 2009-10-26 09:52:53 +01:00
Kristian Rietveld
e36872da38 Use screen when emitting signal, not _gdk_screen 2009-10-26 09:52:53 +01:00
Kristian Rietveld
63e2f54516 Emit monitors-changed signal when appropriate 2009-10-26 09:52:53 +01:00
Kristian Rietveld
12dc617dc2 Move screen resolution setup to GdkScreenQuartz initializer 2009-10-26 09:52:53 +01:00
Kristian Rietveld
d47772f002 Create a proper subclass of GdkScreen: GdkScreenQuartz 2009-10-26 09:52:52 +01:00
Kristian Rietveld
73b55ae8f5 Register and handle a display reconfiguration callback
Using this we can update our internal monitor/screen layout state
and emit the GdkScreen::size-changed signal.  Work has not
completely finished on this yet, see bug 596238.
2009-10-26 09:52:52 +01:00
Kristian Rietveld
ce3c861c2a Setup monitor rects during screen initialization and re-use data 2009-10-26 09:52:52 +01:00
Kristian Rietveld
ca20b04b58 Move screen initialization to gdkscreen-quartz.c 2009-10-26 09:52:52 +01:00
Kristian Rietveld
42ac226877 Bug 598881 - Unimplemented GdkWindowImplIface methods crash gimp on OSX
Add dummy for _gdk_input_window_crossing ().  Set both input_window_destroy
and input_window_crossing pointers in the Impl struct.

Reported by John Ralls.
2009-10-23 13:53:57 +02:00
Kristian Rietveld
a4145bfeef Bug 588449 - DnD doesn't work on GDK/Quartz
Patch from Paul Davis.  This gets the basics of drag and drop properly
working on Mac OS X.
2009-09-30 15:07:37 +02:00
Alexander Larsson
5ebb32d1ff Extend _gdk_windowing_window_at_pointer to be able to get toplevels only
This has two advantages:
1) In many backends, this is faster as we can terminate the window
hierarchy traversal earlier
2) When used in gdkdisplay.c::get_current_toplevel() to get the
current toplevel that has the pointer we now correctly return
a toplevel with the pointer in it where the pointer is inside
some foreign subwindow of a toplevel window.

The second advantage fixes some bugs in client side event generation
when the pointer is inside such a foreign child window.
2009-09-28 15:21:54 +02:00
Kristian Rietveld
f2d9f5a9e6 Remove unused variable 2009-09-27 13:44:10 +02:00
Kristian Rietveld
2f782de1b7 Bug 596012 - popup menu position is horribly off on gdk quartz with ...
Based on first patches by Christian Hergert.  Change
screen_get_monitor_geometry() so that it translates the layout of the screens
from Cocoa layout to GDK layout.  In Cocoa, the screen locations
are specified in Cocoa geometry, as well as that GDK uses a different way
to place individual monitors in the root window.  For now only monitors
that are laid out horizontally are supported (see the FIXMEs in the source),
in bug 596238 we will track future work to get things fully right.

Modify _gdk_quartz_window_get_inverted_screen_y() to take the differences
in screen layout between Cocoa and GDK into account.  Also this function
is subject to future work.
2009-09-27 13:44:10 +02: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
785e55f87d Bug 596250 - Gdkcursor-quartz.c doesn't implement GDK_BLANK_CURSOR
Support GDK_BLANK_CURSOR.  Patch by John Ralls.
2009-09-25 18:51:55 +02:00
Kristian Rietveld
cdec2caaf3 Send a motion-notify when a (new) main window became active
This motion-notify even will make sure that things like highlights are
set up correctly now that the window has become active.
2009-09-25 18:51:54 +02:00