Commit Graph

55 Commits

Author SHA1 Message Date
Kristian Rietveld
f7a8bac5e6 quartz: Make backend compile again 2010-08-10 21:02:29 +02:00
Benjamin Otte
6a48a042c7 API: remove GdkGC
XXX: Some traces in the win32 code are left. I suppose they'd best be
replaced using Cairo.
2010-08-10 21:02:29 +02:00
Benjamin Otte
6f5084551a API: remove gdk_drawable_copy_to_image() 2010-08-10 21:02:26 +02:00
Kristian Rietveld
03a313d2a9 Implement gdk_drag_context_{get,set}_device in Quartz backend 2010-06-30 10:56:44 +02:00
Benjamin Otte
300e6b84cd s/GdkRegion/cairo_region_t/ in all of gtk
https://bugzilla.gnome.org/show_bug.cgi?id=613284
2010-06-29 16:06:38 +02:00
Benjamin Otte
3e96cfe8fc 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-06-29 16:06:38 +02:00
Javier Jardón
c3987f9ee2 [GdkGC] Remove deprecated GdkFont from GdkGCValues structure 2010-06-28 23:38:03 +02:00
Kristian Rietveld
7f2e4c38a9 Move Leopard-specific type definitions to gdkquartz.h
Update includes subsequently where it matters.  Fixes build on Mac OS
X 10.4.

(cherry picked from commit e634f3fbe0)
2010-06-27 11:00:42 +02:00
Kristian Rietveld
88cae1769b Rework color translation to support gray scale and bitmaps
(cherry picked from commit 49f72c1fb4)
2010-06-27 10:59:46 +02:00
Matthias Clasen
bd4609b140 Merge the xi2-for-master branch 2010-05-25 18:38:44 -04: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
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
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
93530675de Update size of root window after display reconfiguration 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
d47772f002 Create a proper subclass of GdkScreen: GdkScreenQuartz 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
3043155796 Bug 550939 - GtkFileChooser listbox does not refresh selection
Make the quartz backend support the new queued translations.  We do this
by keeping our own copy of the region that has been set to need display.
Using this region we can intersect by the given area, translate this and also
set needs display for the resulting area.
2009-09-21 20:41:35 +02:00
Alexander Larsson
939e55223c Ensure that queue_translation is paired with the right X operation
The X11 queue_translation operation uses NextRequest to get the serial
of the XCopyArea operation where the translation should end. However,
if the gc passed to gdk_draw_drawable has a non-flushed clip region
(which it commonly has now for the window clipping) then the next
operation will be the GC flush, not the XCopyArea.

To handle this right we now pass in the GC to be used to
queue_translation and ensure that it is flushed before calling
NextRequest().
2009-08-13 14:46:02 +02:00
Richard Hult
255756cfc8 Improve explicit drawing and flushing (fixes GtkRuler)
Use the same code path to get a CGContext for both gdk_draw_* and
gdk_cairo_create and make sure we unlockFocus in both cases. This
fixes the broken rendering in GtkRuler. Also use an average of flush
intervals when checking whether we can flush or not, since otherwise
we get too sensitive and block almost all explicit flushes that are
caused by mouse movements for example.
2009-04-02 10:16:30 +02:00
Richard Hult
0092c1ebf0 Limit manual flushing so we don't get hit by quartz' fps limiting 2009-04-02 10:16:29 +02:00
Richard Hult
651335bc7e Remove workaround for missing enter events on newly popped up windows
The reason for the issue was that we got entered/exited events for the
title bar buttons. Now we properly ignore those instead.
2009-04-02 10:15:32 +02:00
Richard Hult
77ee2feda2 Remove tracking of "current mouse window", this is handled in the common code now 2009-04-02 10:15:32 +02:00
Richard Hult
3c7a37d10d Remove old cursor setting and make it work with client-side windows 2009-04-02 10:15:32 +02:00
Richard Hult
a180f7588f Replace quartz specific keyboard grab code with common code 2009-04-02 10:15:31 +02:00
Richard Hult
2ea8ea2f0d Remove unused function _gdk_quartz_window_scroll 2009-04-02 10:15:24 +02:00
Richard Hult
330e790fb2 Rename _gdk_quartz_events_send_map_events to ..._event 2009-04-02 10:15:24 +02:00
Richard Hult
0e1f51ecd1 Add quartz window check macro 2009-04-02 10:15:23 +02:00
Kristian Rietveld
cf3542155f adapt to use GdkWindowImpl interface.
2008-06-27  Kristian Rietveld  <kris@imendio.com>

	* gdk/quartz/gdkgeometry-quartz.c:
	* gdk/quartz/gdkwindow-quartz.c:
	* gdk/quartz/gdkprivate-quartz.h: adapt to use GdkWindowImpl
	interface.


svn path=/trunk/; revision=20697
2008-06-27 17:06:06 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00
Richard Hult
a63c87c5da Defer the generated event to the mainloop and don't generate one at all if
2008-03-28  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkevents-quartz.c: (gdk_event_translate),
	(_gdk_quartz_events_trigger_crossing_events): Defer the generated
	event to the mainloop and don't generate one at all if the
	toplevel didn't change. Use the actual window and not the toplevel
	as event window. These changes make the generated crossing events
	match the X11 behavior and fixes issues with e.g. tooltips,
	comboboxes and menus.

	* gdk/quartz/GdkQuartzView.c: Don't update the tracking rect if
	the view has no window, it will be updated as soon as it's put
	inside a window.

	* gdk/quartz/gdkwindow-quartz.c:
	(_gdk_quartz_window_debug_highlight): Make it possible to track
	multiple windows with debug highlighting.
	(show_window_internal): Remove workaround for tooltips and popups
	that is no longer needed with the above changes.

svn path=/trunk/; revision=19951
2008-03-31 13:15:15 +00:00
Richard Hult
4dbd9d23d7 Use the subtype field for the custom event that is used to wake up the
2008-02-24  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkeventloop-quartz.c: (got_fd_activity), (poll_func):
	Use the subtype field for the custom event that is used to wake up
	the mainloop so we can have other custom event types.

	* gdk/quartz/gdkevents-quartz.c:
	(_gdk_quartz_events_trigger_crossing_events):
	* gdk/quartz/gdkwindow-quartz.c: (show_window_internal): Create
	crossing events after showing a window if necessary, to work
	around problems with the tracking rect API.

svn path=/trunk/; revision=19637
2008-02-24 17:45:29 +00:00
Richard Hult
2dd5dd6340 Add debugging code to highlight a gdkwindow.
2008-02-16  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkwindow-quartz.c: Add debugging code to highlight a
	gdkwindow.

svn path=/trunk/; revision=19587
2008-02-16 00:27:29 +00:00
Richard Hult
fd8c2c01a9 Fix a bug where we could end up trying to handle the same event more than
2007-12-10  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h: 
	* gdk/quartz/gdkeventloop-quartz.c:
	(_gdk_quartz_event_loop_get_pending),
	(_gdk_quartz_event_loop_check_pending),
	(_gdk_quartz_event_loop_release_event), (gdk_event_prepare),
	(gdk_event_check), (gdk_event_dispatch):
	* gdk/quartz/gdkevents-quartz.c: (gdk_events_pending)
	(_gdk_events_queue): Fix a bug where we could end up trying to
	handle the same event more than once. Based on patch from Paul
	Davis.

svn path=/trunk/; revision=19143
2007-12-10 19:00:23 +00:00
Richard Hult
ed82448b9a Move from here... ...to here. (_gdk_windowing_window_destroy): Update the
2007-07-13  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkevents-quartz.c: (gdk_window_is_ancestor): Move
	from here...
	* gdk/quartz/gdkwindow-quartz.c: (_gdk_quartz_window_is_ancestor):
	...to here.
	(_gdk_windowing_window_destroy): Update the mouse window if the
	destroyed window is an ancestor of the current one, not only if
	they are the same.
	(gdk_window_hide): Update the mouse window here too.

svn path=/trunk/; revision=18467
2007-07-13 19:09:10 +00:00
Richard Hult
8b9cbdb2b6 ]) ([GdkQuartzWindow -windowDidBecomeMain:]): Keep a stack of main windows
2007-07-07  Richard Hult  <richard@imendio.com>

	* gdk/quartz/GdkQuartzWindow.c ([GdkQuartzWindow -windowDidResignMain:]) 
	([GdkQuartzWindow -windowDidBecomeMain:]): 
	* gdk/quartz/gdkwindow-quartz.c (_gdk_quartz_window_did_resign_main)
	(_gdk_quartz_window_did_become_main, gdk_window_hide)
	(_gdk_windowing_window_destroy): Keep a stack of main windows and
	select the most recent one when hiding/closing the current one.

svn path=/trunk/; revision=18396
2007-07-07 16:19:40 +00:00
Richard Hult
5a4ed10fae Fix (de)miniaturizing transient windows, by (un)setting the parent before
2007-07-06  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkwindow-quartz.c:
	* gdk/quartz/GdkQuartzWindow.c: Fix (de)miniaturizing transient
	windows, by (un)setting the parent before and after miniaturizing.

svn path=/trunk/; revision=18388
2007-07-06 19:49:42 +00:00
Richard Hult
be540c29ac Make function naming consistent for the various functions that retrieve
2007-06-01  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkevents-quartz.[ch]: Make function naming
	consistent for the various functions that retrieve data from an
	event.

	* gdk/quartz/gdkprivate-quartz.h: 
	* gdk/quartz/gdkwindow-quartz.[ch]: Remove the now unused
	_gdk_quartz_window_find_child_by_point() function.

svn path=/trunk/; revision=18006
2007-06-01 21:03:34 +00:00
Richard Hult
6ecae9e5eb Refactored version of _gdk_quartz_window_find_child_by_point, that doesn't
2007-05-28  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkwindow-quartz.c (find_child_window_helper)
	(_gdk_quartz_window_find_child): Refactored version of
	_gdk_quartz_window_find_child_by_point, that doesn't return any
	coordinates as the users of this function already have the
	coordinates and need to translate them differently.
	(_gdk_windowing_window_get_pointer): Fixup coordinate translation.
	(_gdk_windowing_window_at_pointer): Likewise.

svn path=/trunk/; revision=17968
2007-05-28 20:42:51 +00:00
Richard Hult
9e2114e629 Clean up namespaces to make the code more maintainable.
2007-04-06  Richard Hult  <richard@imendio.com>

	* gdk/quartz/: Clean up namespaces to make the code more
	maintainable.

	* gdk/quartz/gdkdrawable-quartz.c:
	* gdk/quartz/gdkgc-quartz.c: Fix bug #418384, alignment of tiled
	images, by setting the pattern phase for the CG pattern.

svn path=/trunk/; revision=17584
2007-04-06 21:12:48 +00:00
Richard Hult
d7a33adeda Update for the new quartz cairo surface API (#410442). Don't lock focus
2007-03-10  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkdrawable-quartz.c:
	(gdk_quartz_drawable_get_context): Update for the new quartz cairo 
	surface API (#410442). Don't lock focus unless called outside of an 
	expose event.
	(gdk_quartz_drawable_release_context): Only flush the CG context and 
	unlock focus if called outside of expose.
	(gdk_quartz_ref_cairo_surface): Reuse the surface during its lifetime.
	(_gdk_quartz_drawable_finish): New function, used to free the cached
	cairo surface.

	* gdk/quartz/gdkwindow-quartz.c:
	(gdk_window_impl_quartz_begin_paint_region): A few small style changes.
	(gdk_window_quartz_process_all_updates): Move the autorelease pool
	allocation and freeing outside the loop.
	(_gdk_windowing_window_destroy): Finish the drawable.
	(move_resize_window_internal): Small cleanup and remove comment.
	(_gdk_window_impl_quartz_get_type): No need to make the type info
	static.

	* gdk/quartz/gdkpixmap-quartz.c: Finish the drawable.

svn path=/trunk/; revision=17463
2007-03-10 21:58:49 +00:00
Richard Hult
9493e135c7 Add missing function signature to fix a build warning.
2007-03-10  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkprivate-quartz.h: Add missing function signature to fix
	a build warning.

svn path=/trunk/; revision=17462
2007-03-10 21:35:20 +00:00
Richard Hult
fe5f64ecbc Add stub for gdk_display_add_client_message_filter, patch from Taybin
2007-02-18  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkevents-quartz.c: Add stub for 
	gdk_display_add_client_message_filter, patch from Taybin Rutkin. Fixes
	bug #405870.

	* gdk/quartz/gdkprivate-quartz.h: Add prototypes to fix build warnings.

svn path=/trunk/; revision=17324
2007-02-18 10:56:13 +00:00
Mikael Hallendal
7c92045621 Splitted out the GdkPixbuf to NSImage routine so that it can be used from
2006-12-19  Mikael Hallendal  <micke@imendio.com>

	* gdk/quartz/gdkcursor-quartz.c: Splitted out the GdkPixbuf to NSImage
	routine so that it can be used from libgtk as well (needed for
	upcoming GtkStatusIcon support in the Quartz port).
	* gdk/quartz/gdkevents-quartz.c: Don't assume that all NSWindows are
	created from GDK, this is not true for the status icon.
	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkquartz.h: Added
	gdk_quartz_pixbuf_to_ns_image_libgtk_only so that it is available to
	the status icon code.
2006-12-19 15:53:44 +00:00
Michael Natterer
2f50232a42 Implement lots of value setters for GdkGC, based on a heavily modified
2006-09-21  Michael Natterer  <mitch@imendio.com>

       Implement lots of value setters for GdkGC, based on a heavily
       modified patch from Thomas Broyer (bug #328853):

	* gdk/quartz/gdkcolor-quartz.c: removed functions which set colors
	on the CGContext. Instead, added gdk_quartz_get_rgba_from_pixel()
	which simply returns RGBA values from a GdkColor's pixel value.
	See gdk_quartz_update_context_from_gc() below.

	* gdk/quartz/gdkprivate-quartz.h (struct GdkGCQuartz): added lots
	of members for the newly suppored GC values. Added enum
	GdkQuartzContextValuesMask which is used for setting up the
	CGContext for filling and/or stroking.

	* gdk/quartz/gdkgc-quartz.c (gdk_quartz_gc_get_values)
	(gdk_quartz_gc_set_values)
	(_gdk_windowing_gc_copy): support a lot more GC values.

	(gdk_quartz_update_context_from_gc): added
	GdkQuartzContextValuesMask parameter and set filling/stroking
	parameters accordingly. This function also gained full control
	over the FG and BG colors (they can't be set separately any more).

	The stipple mask part of the patch doesn't work but seems to take
	the right approach and doesn't make things worse, so I applied it.

	Did *not* apply the clipping part of the patch since I don't
	understand it (I don't understand the version in CVS either, but
	it at least works :-)

	* gdk/quartz/gdkdrawable-quartz.c: pass the right masks to
	gdk_quartz_update_context_from_gc() and removed separate color
	setting calls. Some minor fixes.

	* gdk/quartz/gdkwindow-quartz.c
	(gdk_window_impl_quartz_begin_paint_region): set the CGContext's
	fill color manually. We don't have/need a GC here.
2006-09-21 17:05:33 +00:00
Richard Hult
382ef872b4 Add GDK button mask for NS dragging events. (create_scroll_event): Remove
2006-08-15  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkevents-quartz.c: (get_event_mask_from_ns_event):
	Add GDK button mask for NS dragging events.
	(create_scroll_event): Remove obsolete comment.
	(_gdk_quartz_get_current_event_mask), (gdk_event_translate): Keep
	track of the latest event mask here...

	* gdk/quartz/gdkwindow-quartz.c:
	(_gdk_windowing_window_get_pointer): And use it here. Patch from
	Kristian Rietveld.
	(gdk_window_quartz_update_idle): Rename to make things clearer.
2006-08-15 20:13:13 +00:00
Richard Hult
571c460503 Always set success to TRUE. (gdk_color_change): Implement.
2006-07-29  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkcolor-quartz.c (gdk_colormap_alloc_colors): Always
	set success to TRUE.
	(gdk_color_change): Implement.

	* gdk/quartz/GdkQuartzWindow.c
	([GdkQuartzWindow -canBecomeKeyWindow]): Add comment.

	* gdk/quartz/gdkevents-quartz.c (gdk_screen_get_setting): Make the
	default font a bit smaller until we have made this get the system
	setting.

	* gdk/quartz/gdkwindow-quartz.c (gdk_window_set_type_hint): Enable
	shadows for the right window types.

	* gdk/quartz/gdkprivate-quartz.h:
	* gdk/quartz/gdkgc-quartz.c:
	* gdk/quartz/gdkdrawable-quartz.c:
	* gdk/quartz/gdkcolor-quartz.c: Expose the CGContext functions,
	update callers.

	* gdk/quartz/gdkmain-quartz.c: (_gdk_windowing_init): No need to
	get the current process ID, use the right constant instead.
2006-07-29 11:05:15 +00:00
Richard Hult
7a3c18ab7b Set the window level depending on the type hint.
2006-07-24  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkwindow-quartz.c (gdk_window_set_type_hint): Set the
	window level depending on the type hint.

	* gdk/quartz/gdkevents-quartz.c (gdk_keyboard_grab,
	pointer_ungrab_internal): Only break the grab if the new window is
	a different one.
	(gdk_event_translate): Catch the case where the entire app loses
	focus and break any grabs. Only do implicit grabs when the event
	mask has both press and release.

	* gdk/quartz/gdkkeys-quartz.c (translate_keysym):
	* gdk/quartz/gdkselection-quartz.c:

        * gdk/quartz/GdkQuartzWindow.c
	([GdkQuartzWindow -windowDidResignKey:]): Use this to update the
	focus window instead of resignMain, fixes the case where other apps
	uses focus follows mouse (like the terminal can).
2006-07-24 10:46:21 +00:00
Richard Hult
cb5f9e62e9 Append the event to the queue instead of using gdk_event_put.
2006-07-20  Richard Hult  <richard@imendio.com>

	* gdk/quartz/gdkevents-quartz.c: (generate_grab_broken_event):
	Append the event to the queue instead of using gdk_event_put.
	(_gdk_quartz_get_mouse_window, find_current_keyboard_window):
	Handle grabs.
	(get_event_mask_from_ns_event, create_focus_event)
	(convert_window_coordinates_to_root, find_window_for_event)
	(gdk_event_translate): Improve readability (style changes).
	(gdk_flush, gdk_display_sync, gdk_display_flush)
	(gdk_event_send_client_message_for_display),
	(gdk_screen_broadcast_client_message): Remove FIXMEs.
	(gdk_screen_get_setting): Reindent.
	Also move find_child_window_by_point to gdkwindow-quartz.c.

	* gdk/quartz/gdkwindow-quartz.c:
	(find_child_window_by_point_helper),
	(_gdk_quartz_find_child_window_by_point): Move here from
	gdkevents-quartz.c
	(_gdk_windowing_window_get_pointer): Handle destroyed windows and
	imlement the return value.
	(_gdk_windowing_window_at_pointer): Implement.
2006-07-20 08:06:54 +00:00
Richard Hult
d3973cb865 ]): Listen to windowDidResignMain notifications and properly update the
2006-07-19  Richard Hult  <richard@imendio.com>

	* gdk/quartz/GdkQuartzWindow.c
	([GdkQuartzWindow -windowDidResignMain:]):
	* gdk/quartz/gdkevents-quartz.c (_gdk_quartz_update_focus_window):
	Listen to windowDidResignMain notifications and properly update the
	focus window when windows are unfocused.
2006-07-19 17:06:40 +00:00