Hide Objective-C from outside GdkQuartz.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1737

Don't export any functions taking or returning MacOS types in
gdkquartz.h, gdkprivate-quartz.h, or any header that either includes.

The GdkQuartz internal functions are moved to a new header
gdkinternal-quartz.h, the functions used by quartz-specific
Gtk files are moved to another new header gdkquartz-gtk-only.h, and
the key and event enums to a new header gdkkeys-quartz.h.
This commit is contained in:
John Ralls 2019-03-16 16:45:44 -07:00
parent 3ffd71cf35
commit ef72fe750a
35 changed files with 460 additions and 345 deletions

View File

@ -222,7 +222,6 @@ libgdk_3_la_LIBADD += x11/libgdk-x11.la
endif # USE_X11
if USE_QUARTZ
libgdk_3_la_CFLAGS += -xobjective-c
libgdk_3_la_LIBADD += quartz/libgdk-quartz.la
endif # USE_QUARTZ

View File

@ -38,12 +38,6 @@
#endif
#ifdef GDK_WINDOWING_QUARTZ
/* When the gdk_quartz_display_open function is removed We can
* immediately include gdkquartzdisplaymanager.h here instead of
* gdkprivate-quartz.h so that we wont have to enable -xobjective-c
* for the generic GDK source code.
* #include "quartz/gdkquartzdisplaymanager.h"
*/
#include "quartz/gdkprivate-quartz.h"
#endif

View File

@ -21,6 +21,8 @@
#include "gdkquartzwindow.h"
#include "gdkdnd-quartz.h"
#include "gdkprivate-quartz.h"
#include "gdkinternal-quartz.h"
#include "gdkquartzdnd.h"
@implementation GdkQuartzNSWindow

View File

@ -23,6 +23,7 @@
#include "gdkquartzwindow.h"
#include "gdkprivate-quartz.h"
#include "gdkquartz.h"
#include "gdkinternal-quartz.h"
@implementation GdkQuartzView

View File

@ -38,7 +38,9 @@ libgdk_quartz_la_SOURCES = \
gdkglcontext-quartz.c \
gdkglcontext-quartz.h \
gdkglobals-quartz.c \
gdkinternal-quartz.h \
gdkkeys-quartz.c \
gdkkeys-quartz.h \
gdkmonitor-quartz.c \
gdkmonitor-quartz.h \
gdkprivate-quartz.h \

View File

@ -23,6 +23,7 @@
#include "gdkcursorprivate.h"
#include "gdkquartzcursor.h"
#include "gdkprivate-quartz.h"
#include "gdkinternal-quartz.h"
#include "xcursors.h"

View File

@ -26,6 +26,7 @@
#include "gdkquartzcursor.h"
#include "gdkprivate-quartz.h"
#include "gdkquartzdevice-core.h"
#include "gdkinternal-quartz.h"
struct _GdkQuartzDeviceCore
{

View File

@ -25,6 +25,7 @@
#include "gdkwindow.h"
#include "gdkinternals.h"
#include "gdkmain.h"
#include "gdkinternal-quartz.h"
G_BEGIN_DECLS

View File

@ -20,7 +20,8 @@
#include "gdkdnd.h"
#include "gdkquartzdnd.h"
#include "gdkprivate-quartz.h"
#include "gdkinternal-quartz.h"
#include "gdkquartz-gtk-only.h"
G_DEFINE_TYPE (GdkQuartzDragContext, gdk_quartz_drag_context, GDK_TYPE_DRAG_CONTEXT)

View File

@ -21,7 +21,6 @@
#define __GDK_QUARTZ_DND__
#include <gdkdndprivate.h>
#include "gdkquartzdnd.h"
#include <AppKit/AppKit.h>

View File

@ -7,6 +7,7 @@
#include <unistd.h>
#include "gdkprivate-quartz.h"
#include "gdkinternal-quartz.h"
#include <gdk/gdkdisplayprivate.h>
/*
@ -152,6 +153,18 @@ static const char *const state_names[] = {
};
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
typedef enum
{
GDK_QUARTZ_EVENT_MASK_ANY = NSAnyEventMask,
} GdkQuartzEventMask;
#else
typedef enum
{
GDK_QUARTZ_EVENT_MASK_ANY = NSEventMaskAny,
} GdkQuartzEventMask;
#endif
static SelectThreadState select_thread_state = BEFORE_START;
static pthread_t select_thread;

View File

@ -34,8 +34,10 @@
#include "gdkquartz.h"
#include "gdkquartzdisplay.h"
#include "gdkprivate-quartz.h"
#include "gdkinternal-quartz.h"
#include "gdkquartzdevicemanager-core.h"
#include "gdkquartzkeys.h"
#include "gdkkeys-quartz.h"
#define GRIP_WIDTH 15
#define GRIP_HEIGHT 15
@ -46,6 +48,7 @@
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
/* This is the window corresponding to the key window */
static GdkWindow *current_keyboard_window;
@ -1312,14 +1315,16 @@ _gdk_quartz_events_get_current_keyboard_modifiers (void)
GdkModifierType
_gdk_quartz_events_get_current_mouse_modifiers (void)
{
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060
if (gdk_quartz_osx_version () >= GDK_OSX_SNOW_LEOPARD)
{
return get_mouse_button_modifiers_from_ns_buttons ([NSClassFromString(@"NSEvent") pressedMouseButtons]);
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
else
{
#endif
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
return get_mouse_button_modifiers_from_ns_buttons (GetCurrentButtonState ());
}
#endif
}
/* Detect window resizing */

View File

@ -20,6 +20,7 @@
#include "gdktypes.h"
#include "gdkprivate.h"
#include "gdkquartz.h"
#include "gdkinternal-quartz.h"
GdkDisplay *_gdk_display = NULL;
GdkScreen *_gdk_screen = NULL;

View File

@ -0,0 +1,265 @@
/* gdkinternal-quartz.h
*
* Copyright (C) 2005-2007 Imendio AB
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_INTERNAL_QUARTZ_H__
#define __GDK_INTERNAL_QUARTZ_H__
#include <AppKit/AppKit.h>
/* This is mostly a pot of function prototypes to avoid having
* separate include file for each implementation file that exports
* functions to one other file in GdkQuartz.
*/
/* NSInteger only exists in Leopard and newer. This check has to be
* done after inclusion of the system headers. If NSInteger has not
* been defined, we know for sure that we are on 32-bit.
*/
#ifndef NSINTEGER_DEFINED
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#ifndef CGFLOAT_DEFINED
typedef float CGFloat;
#endif
#define GDK_QUARTZ_ALLOC_POOL NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
#define GDK_QUARTZ_RELEASE_POOL [pool release]
#include <gdk/gdkprivate.h>
#include <gdk/quartz/gdkquartz.h>
#include <gdk/quartz/gdkdevicemanager-core-quartz.h>
#include <gdk/quartz/gdkdnd-quartz.h>
#include <gdk/quartz/gdkscreen-quartz.h>
#include <gdk/quartz/gdkwindow-quartz.h>
#include <gdk/gdk.h>
#include "config.h"
extern GdkDisplay *_gdk_display;
extern GdkScreen *_gdk_screen;
extern GdkWindow *_gdk_root;
extern GdkDragContext *_gdk_quartz_drag_source_context;
#define GDK_WINDOW_IS_QUARTZ(win) (GDK_IS_WINDOW_IMPL_QUARTZ (((GdkWindow *)win)->impl))
/* Initialization */
void _gdk_quartz_window_init_windowing (GdkDisplay *display,
GdkScreen *screen);
void _gdk_quartz_events_init (void);
void _gdk_quartz_event_loop_init (void);
/* Cursor */
NSCursor *_gdk_quartz_cursor_get_ns_cursor (GdkCursor *cursor);
/* Events */
typedef enum {
GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP
} GdkQuartzEventSubType;
void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
gboolean got_focus);
void _gdk_quartz_events_send_map_event (GdkWindow *window);
GdkModifierType _gdk_quartz_events_get_current_keyboard_modifiers (void);
GdkModifierType _gdk_quartz_events_get_current_mouse_modifiers (void);
void _gdk_quartz_events_break_all_grabs (guint32 time);
/* Event loop */
gboolean _gdk_quartz_event_loop_check_pending (void);
NSEvent * _gdk_quartz_event_loop_get_pending (void);
void _gdk_quartz_event_loop_release_event (NSEvent *event);
/* Keys */
GdkEventType _gdk_quartz_keys_event_type (NSEvent *event);
gboolean _gdk_quartz_keys_is_modifier (guint keycode);
void _gdk_quartz_synthesize_null_key_event (GdkWindow *window);
/* Drag and Drop */
void _gdk_quartz_window_register_dnd (GdkWindow *window);
GdkDragContext * _gdk_quartz_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets,
gint x_root,
gint y_root);
/* Display */
GdkDisplay * _gdk_quartz_display_open (const gchar *name);
/* Display methods - events */
void _gdk_quartz_display_queue_events (GdkDisplay *display);
gboolean _gdk_quartz_display_has_pending (GdkDisplay *display);
void _gdk_quartz_display_event_data_copy (GdkDisplay *display,
const GdkEvent *src,
GdkEvent *dst);
void _gdk_quartz_display_event_data_free (GdkDisplay *display,
GdkEvent *event);
/* Display methods - cursor */
GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType type);
GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name);
GdkCursor *_gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
cairo_surface_t *surface,
gdouble x,
gdouble y);
gboolean _gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display);
gboolean _gdk_quartz_display_supports_cursor_color (GdkDisplay *display);
void _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
void _gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
/* Display methods - keymap */
GdkKeymap * _gdk_quartz_display_get_keymap (GdkDisplay *display);
/* Display methods - selection */
gboolean _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
GdkWindow *owner,
GdkAtom selection,
guint32 time,
gboolean send_event);
GdkWindow * _gdk_quartz_display_get_selection_owner (GdkDisplay *display,
GdkAtom selection);
gint _gdk_quartz_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format);
void _gdk_quartz_display_convert_selection (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time);
gint _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
GdkAtom encoding,
gint format,
const guchar *text,
gint length,
gchar ***list);
gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
const gchar *str);
/* Screen */
GdkScreen *_gdk_quartz_screen_new (void);
void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);
/* Screen methods - visual */
GdkVisual * _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen);
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
gint _gdk_quartz_screen_visual_get_best_depth (GdkScreen *screen);
GdkVisualType _gdk_quartz_screen_visual_get_best_type (GdkScreen *screen);
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
GdkVisual* _gdk_quartz_screen_visual_get_best (GdkScreen *screen);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type);
void _gdk_quartz_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count);
void _gdk_quartz_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count);
void _gdk_quartz_screen_init_visuals (GdkScreen *screen);
GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen);
/* Screen methods - events */
void _gdk_quartz_screen_broadcast_client_message (GdkScreen *screen,
GdkEvent *event);
gboolean _gdk_quartz_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value);
gboolean _gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
GdkWindow *window);
void _gdk_quartz_window_gdk_xy_to_xy (gint gdk_x,
gint gdk_y,
gint *ns_x,
gint *ns_y);
void _gdk_quartz_window_xy_to_gdk_xy (gint ns_x,
gint ns_y,
gint *gdk_x,
gint *gdk_y);
void _gdk_quartz_window_nspoint_to_gdk_xy (NSPoint point,
gint *x,
gint *y);
GdkWindow *_gdk_quartz_window_find_child (GdkWindow *window,
gint x,
gint y,
gboolean get_toplevel);
void _gdk_quartz_window_attach_to_parent (GdkWindow *window);
void _gdk_quartz_window_detach_from_parent (GdkWindow *window);
void _gdk_quartz_window_did_become_main (GdkWindow *window);
void _gdk_quartz_window_did_resign_main (GdkWindow *window);
void _gdk_quartz_window_debug_highlight (GdkWindow *window,
gint number);
void _gdk_quartz_window_update_position (GdkWindow *window);
void _gdk_quartz_window_update_fullscreen_state (GdkWindow *window);
/* Window methods - testing */
void _gdk_quartz_window_sync_rendering (GdkWindow *window);
gboolean _gdk_quartz_window_simulate_key (GdkWindow *window,
gint x,
gint y,
guint keyval,
GdkModifierType modifiers,
GdkEventType key_pressrelease);
gboolean _gdk_quartz_window_simulate_button (GdkWindow *window,
gint x,
gint y,
guint button,
GdkModifierType modifiers,
GdkEventType button_pressrelease);
/* Window methods - property */
gboolean _gdk_quartz_window_get_property (GdkWindow *window,
GdkAtom property,
GdkAtom type,
gulong offset,
gulong length,
gint pdelete,
GdkAtom *actual_property_type,
gint *actual_format_type,
gint *actual_length,
guchar **data);
void _gdk_quartz_window_change_property (GdkWindow *window,
GdkAtom property,
GdkAtom type,
gint format,
GdkPropMode mode,
const guchar *data,
gint nelements);
void _gdk_quartz_window_delete_property (GdkWindow *window,
GdkAtom property);
#endif /* __GDK_INTERNAL_QUARTZ_H__ */

View File

@ -55,6 +55,8 @@
#include "gdkquartzkeys.h"
#include "gdkkeysprivate.h"
#include "gdkkeysyms.h"
#include "gdkkeys-quartz.h"
#include "gdkinternal-quartz.h"
#define NUM_KEYCODES 128
#define KEYVALS_PER_KEYCODE 4

View File

@ -0,0 +1,85 @@
/* gdkkeys-quartz.h
*
* Copyright (C) 2005-2007 Imendio AB
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_KEYS_QUARTZ_H__
#define __GDK_KEYS_QUARTZ_H__
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
typedef enum
{
GDK_QUARTZ_FLAGS_CHANGED = NSFlagsChanged,
GDK_QUARTZ_KEY_UP = NSKeyUp,
GDK_QUARTZ_KEY_DOWN = NSKeyDown,
GDK_QUARTZ_MOUSE_ENTERED = NSMouseEntered,
GDK_QUARTZ_MOUSE_EXITED = NSMouseExited,
GDK_QUARTZ_SCROLL_WHEEL = NSScrollWheel,
GDK_QUARTZ_MOUSE_MOVED = NSMouseMoved,
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSOtherMouseDragged,
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSRightMouseDragged,
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSLeftMouseDragged,
GDK_QUARTZ_OTHER_MOUSE_UP = NSOtherMouseUp,
GDK_QUARTZ_RIGHT_MOUSE_UP = NSRightMouseUp,
GDK_QUARTZ_LEFT_MOUSE_UP = NSLeftMouseUp,
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSOtherMouseDown,
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSRightMouseDown,
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSLeftMouseDown,
} GdkQuartzEventType;
typedef enum
{
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSAlternateKeyMask,
GDK_QUARTZ_CONTROL_KEY_MASK = NSControlKeyMask,
GDK_QUARTZ_SHIFT_KEY_MASK = NSShiftKeyMask,
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSAlphaShiftKeyMask,
GDK_QUARTZ_COMMAND_KEY_MASK = NSCommandKeyMask,
GDK_QUARTZ_ANY_EVENT_MASK = NSAnyEventMask,
} GdkQuartzEventModifierFlags;
#else
typedef enum
{
GDK_QUARTZ_FLAGS_CHANGED = NSEventTypeFlagsChanged,
GDK_QUARTZ_KEY_UP = NSEventTypeKeyUp,
GDK_QUARTZ_KEY_DOWN = NSEventTypeKeyDown,
GDK_QUARTZ_MOUSE_ENTERED = NSEventTypeMouseEntered,
GDK_QUARTZ_MOUSE_EXITED = NSEventTypeMouseExited,
GDK_QUARTZ_SCROLL_WHEEL = NSEventTypeScrollWheel,
GDK_QUARTZ_MOUSE_MOVED = NSEventTypeMouseMoved,
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSEventTypeOtherMouseDragged,
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSEventTypeRightMouseDragged,
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSEventTypeLeftMouseDragged,
GDK_QUARTZ_OTHER_MOUSE_UP = NSEventTypeOtherMouseUp,
GDK_QUARTZ_RIGHT_MOUSE_UP = NSEventTypeRightMouseUp,
GDK_QUARTZ_LEFT_MOUSE_UP = NSEventTypeLeftMouseUp,
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSEventTypeOtherMouseDown,
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSEventTypeRightMouseDown,
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSEventTypeLeftMouseDown,
} GdkQuartzEventType;
typedef enum
{
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSEventModifierFlagOption,
GDK_QUARTZ_CONTROL_KEY_MASK = NSEventModifierFlagControl,
GDK_QUARTZ_SHIFT_KEY_MASK = NSEventModifierFlagShift,
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSEventModifierFlagCapsLock,
GDK_QUARTZ_COMMAND_KEY_MASK = NSEventModifierFlagCommand,
} GdkQuartzEventModifierFlags;
#endif
#endif /* __GDK_KEYS_QUARTZ_H__ */

View File

@ -23,7 +23,6 @@
#include "gdkmonitor-quartz.h"
#include "gdkdisplay-quartz.h"
G_DEFINE_TYPE (GdkQuartzMonitor, gdk_quartz_monitor, GDK_TYPE_MONITOR)
static void

View File

@ -25,6 +25,7 @@
#include "gdkquartzmonitor.h"
#include "gdkprivate-quartz.h"
#include "gdkinternal-quartz.h"
struct _GdkQuartzMonitor
{

View File

@ -1,4 +1,4 @@
/* gdkwindow-quartz.c
/* gdkprivate-quartz.h
*
* Copyright (C) 2005-2007 Imendio AB
*
@ -19,15 +19,6 @@
#ifndef __GDK_PRIVATE_QUARTZ_H__
#define __GDK_PRIVATE_QUARTZ_H__
#define GDK_QUARTZ_ALLOC_POOL NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
#define GDK_QUARTZ_RELEASE_POOL [pool release]
#include <gdk/gdkprivate.h>
#include <gdk/quartz/gdkquartz.h>
#include <gdk/quartz/gdkdevicemanager-core-quartz.h>
#include <gdk/quartz/gdkdnd-quartz.h>
#include <gdk/quartz/gdkscreen-quartz.h>
#include <gdk/quartz/gdkwindow-quartz.h>
#include <gdk/gdk.h>
@ -35,215 +26,12 @@
#include "config.h"
extern GdkDisplay *_gdk_display;
extern GdkScreen *_gdk_screen;
extern GdkWindow *_gdk_root;
extern GdkDragContext *_gdk_quartz_drag_source_context;
#define GDK_WINDOW_IS_QUARTZ(win) (GDK_IS_WINDOW_IMPL_QUARTZ (((GdkWindow *)win)->impl))
/* Initialization */
void _gdk_quartz_window_init_windowing (GdkDisplay *display,
GdkScreen *screen);
void _gdk_quartz_events_init (void);
void _gdk_quartz_event_loop_init (void);
/* Cursor */
NSCursor *_gdk_quartz_cursor_get_ns_cursor (GdkCursor *cursor);
/* Events */
typedef enum {
GDK_QUARTZ_EVENT_SUBTYPE_EVENTLOOP
} GdkQuartzEventSubType;
void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
gboolean got_focus);
void _gdk_quartz_events_send_map_event (GdkWindow *window);
GdkModifierType _gdk_quartz_events_get_current_keyboard_modifiers (void);
GdkModifierType _gdk_quartz_events_get_current_mouse_modifiers (void);
void _gdk_quartz_events_break_all_grabs (guint32 time);
/* Event loop */
gboolean _gdk_quartz_event_loop_check_pending (void);
NSEvent * _gdk_quartz_event_loop_get_pending (void);
void _gdk_quartz_event_loop_release_event (NSEvent *event);
/* Keys */
GdkEventType _gdk_quartz_keys_event_type (NSEvent *event);
gboolean _gdk_quartz_keys_is_modifier (guint keycode);
void _gdk_quartz_synthesize_null_key_event (GdkWindow *window);
/* Drag and Drop */
void _gdk_quartz_window_register_dnd (GdkWindow *window);
GdkDragContext * _gdk_quartz_window_drag_begin (GdkWindow *window,
GdkDevice *device,
GList *targets,
gint x_root,
gint y_root);
/* Display */
GdkDisplay * _gdk_quartz_display_open (const gchar *name);
/* Display methods - events */
void _gdk_quartz_display_queue_events (GdkDisplay *display);
gboolean _gdk_quartz_display_has_pending (GdkDisplay *display);
void _gdk_quartz_display_event_data_copy (GdkDisplay *display,
const GdkEvent *src,
GdkEvent *dst);
void _gdk_quartz_display_event_data_free (GdkDisplay *display,
GdkEvent *event);
/* Display methods - cursor */
GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType type);
GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name);
GdkCursor *_gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
cairo_surface_t *surface,
gdouble x,
gdouble y);
gboolean _gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display);
gboolean _gdk_quartz_display_supports_cursor_color (GdkDisplay *display);
void _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
void _gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display,
guint *width,
guint *height);
/* Display methods - keymap */
GdkKeymap * _gdk_quartz_display_get_keymap (GdkDisplay *display);
/* Display methods - selection */
gboolean _gdk_quartz_display_set_selection_owner (GdkDisplay *display,
GdkWindow *owner,
GdkAtom selection,
guint32 time,
gboolean send_event);
GdkWindow * _gdk_quartz_display_get_selection_owner (GdkDisplay *display,
GdkAtom selection);
gint _gdk_quartz_display_get_selection_property (GdkDisplay *display,
GdkWindow *requestor,
guchar **data,
GdkAtom *ret_type,
gint *ret_format);
void _gdk_quartz_display_convert_selection (GdkDisplay *display,
GdkWindow *requestor,
GdkAtom selection,
GdkAtom target,
guint32 time);
gint _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay *display,
GdkAtom encoding,
gint format,
const guchar *text,
gint length,
gchar ***list);
gchar * _gdk_quartz_display_utf8_to_string_target (GdkDisplay *displayt,
const gchar *str);
/* Screen */
GdkScreen *_gdk_quartz_screen_new (void);
void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);
/* Screen methods - visual */
GdkVisual * _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen);
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
gint _gdk_quartz_screen_visual_get_best_depth (GdkScreen *screen);
GdkVisualType _gdk_quartz_screen_visual_get_best_type (GdkScreen *screen);
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
GdkVisual* _gdk_quartz_screen_visual_get_best (GdkScreen *screen);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type);
void _gdk_quartz_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count);
void _gdk_quartz_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count);
void _gdk_quartz_screen_init_visuals (GdkScreen *screen);
GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen);
/* Screen methods - events */
void _gdk_quartz_screen_broadcast_client_message (GdkScreen *screen,
GdkEvent *event);
gboolean _gdk_quartz_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value);
/* Window */
gboolean _gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
GdkWindow *window);
void _gdk_quartz_window_gdk_xy_to_xy (gint gdk_x,
gint gdk_y,
gint *ns_x,
gint *ns_y);
void _gdk_quartz_window_xy_to_gdk_xy (gint ns_x,
gint ns_y,
gint *gdk_x,
gint *gdk_y);
void _gdk_quartz_window_nspoint_to_gdk_xy (NSPoint point,
gint *x,
gint *y);
GdkWindow *_gdk_quartz_window_find_child (GdkWindow *window,
gint x,
gint y,
gboolean get_toplevel);
void _gdk_quartz_window_attach_to_parent (GdkWindow *window);
void _gdk_quartz_window_detach_from_parent (GdkWindow *window);
void _gdk_quartz_window_did_become_main (GdkWindow *window);
void _gdk_quartz_window_did_resign_main (GdkWindow *window);
void _gdk_quartz_window_debug_highlight (GdkWindow *window,
gint number);
void _gdk_quartz_window_update_position (GdkWindow *window);
void _gdk_quartz_window_update_fullscreen_state (GdkWindow *window);
/* Window methods - testing */
void _gdk_quartz_window_sync_rendering (GdkWindow *window);
gboolean _gdk_quartz_window_simulate_key (GdkWindow *window,
gint x,
gint y,
guint keyval,
GdkModifierType modifiers,
GdkEventType key_pressrelease);
gboolean _gdk_quartz_window_simulate_button (GdkWindow *window,
gint x,
gint y,
guint button,
GdkModifierType modifiers,
GdkEventType button_pressrelease);
/* Window methods - property */
gboolean _gdk_quartz_window_get_property (GdkWindow *window,
GdkAtom property,
GdkAtom type,
gulong offset,
gulong length,
gint pdelete,
GdkAtom *actual_property_type,
gint *actual_format_type,
gint *actual_length,
guchar **data);
void _gdk_quartz_window_change_property (GdkWindow *window,
GdkAtom property,
GdkAtom type,
gint format,
GdkPropMode mode,
const guchar *data,
gint nelements);
void _gdk_quartz_window_delete_property (GdkWindow *window,
GdkAtom property);
#endif /* __GDK_PRIVATE_QUARTZ_H__ */

View File

@ -0,0 +1,50 @@
/* gdkquartz-gtk-only.h
*
* Copyright (C) 2005-2007 Imendio AB
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GDK_QUARTZ_GTK_ONLY_H__
#define __GDK_QUARTZ_GTK_ONLY_H__
#if !(defined (GTK_COMPILATION) || defined (GDK_COMPILATION))
#error "This API is for use only in Gtk internal code."
#endif
#include <Appkit/Appkit.h>
#include <gdk/gdk.h>
#include <gdk/quartz/gdkquartz.h>
/* Drag and Drop/Clipboard */
GDK_AVAILABLE_IN_ALL
GdkAtom gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type);
GDK_AVAILABLE_IN_ALL
NSString *gdk_quartz_target_to_pasteboard_type_libgtk_only (const gchar *target);
GDK_AVAILABLE_IN_ALL
NSString *gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom);
/* Utilities */
GDK_AVAILABLE_IN_ALL
NSImage *gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_ALL
NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
/* Window */
GDK_AVAILABLE_IN_ALL
NSWindow *gdk_quartz_window_get_nswindow (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
NSView *gdk_quartz_window_get_nsview (GdkWindow *window);
#endif

View File

@ -20,26 +20,11 @@
#ifndef __GDK_QUARTZ_H__
#define __GDK_QUARTZ_H__
#include <AppKit/AppKit.h>
#include <gdk/gdk.h>
#include <gdk/gdkprivate.h>
G_BEGIN_DECLS
/* NSInteger only exists in Leopard and newer. This check has to be
* done after inclusion of the system headers. If NSInteger has not
* been defined, we know for sure that we are on 32-bit.
*/
#ifndef NSINTEGER_DEFINED
typedef int NSInteger;
typedef unsigned int NSUInteger;
#endif
#ifndef CGFLOAT_DEFINED
typedef float CGFloat;
#endif
typedef enum
{
GDK_OSX_UNSUPPORTED = 0,
@ -62,13 +47,6 @@ typedef enum
GDK_AVAILABLE_IN_ALL
GdkOSXVersion gdk_quartz_osx_version (void);
GDK_AVAILABLE_IN_ALL
GdkAtom gdk_quartz_pasteboard_type_to_atom_libgtk_only (NSString *type);
GDK_AVAILABLE_IN_ALL
NSString *gdk_quartz_target_to_pasteboard_type_libgtk_only (const gchar *target);
GDK_AVAILABLE_IN_ALL
NSString *gdk_quartz_atom_to_pasteboard_type_libgtk_only (GdkAtom atom);
G_END_DECLS
#define __GDKQUARTZ_H_INSIDE__
@ -78,7 +56,6 @@ G_END_DECLS
#include <gdk/quartz/gdkquartzdevicemanager-core.h>
#include <gdk/quartz/gdkquartzdisplay.h>
#include <gdk/quartz/gdkquartzdisplaymanager.h>
#include <gdk/quartz/gdkquartzdnd.h>
#include <gdk/quartz/gdkquartzkeys.h>
#include <gdk/quartz/gdkquartzmonitor.h>
#include <gdk/quartz/gdkquartzscreen.h>

View File

@ -19,8 +19,8 @@
#ifndef __GDK_QUARTZ_DND_H__
#define __GDK_QUARTZ_DND_H__
#if !defined(__GDKQUARTZ_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdkquartz.h> can be included directly."
#if !defined (GTK_COMPILATION) && !defined (GDK_COMPILATION)
#error "gdkquartzdnd.h is for Gtk's internal use only"
#endif
#include <gdk/gdk.h>

View File

@ -45,79 +45,6 @@ typedef struct _GdkQuartzKeymapClass GdkQuartzKeymapClass;
GDK_AVAILABLE_IN_ALL
GType gdk_quartz_keymap_get_type (void);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
typedef enum
{
GDK_QUARTZ_FLAGS_CHANGED = NSFlagsChanged,
GDK_QUARTZ_KEY_UP = NSKeyUp,
GDK_QUARTZ_KEY_DOWN = NSKeyDown,
GDK_QUARTZ_MOUSE_ENTERED = NSMouseEntered,
GDK_QUARTZ_MOUSE_EXITED = NSMouseExited,
GDK_QUARTZ_SCROLL_WHEEL = NSScrollWheel,
GDK_QUARTZ_MOUSE_MOVED = NSMouseMoved,
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSOtherMouseDragged,
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSRightMouseDragged,
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSLeftMouseDragged,
GDK_QUARTZ_OTHER_MOUSE_UP = NSOtherMouseUp,
GDK_QUARTZ_RIGHT_MOUSE_UP = NSRightMouseUp,
GDK_QUARTZ_LEFT_MOUSE_UP = NSLeftMouseUp,
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSOtherMouseDown,
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSRightMouseDown,
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSLeftMouseDown,
} GdkQuartzEventType;
typedef enum
{
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSAlternateKeyMask,
GDK_QUARTZ_CONTROL_KEY_MASK = NSControlKeyMask,
GDK_QUARTZ_SHIFT_KEY_MASK = NSShiftKeyMask,
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSAlphaShiftKeyMask,
GDK_QUARTZ_COMMAND_KEY_MASK = NSCommandKeyMask,
GDK_QUARTZ_ANY_EVENT_MASK = NSAnyEventMask,
} GdkQuartzEventModifierFlags;
typedef enum
{
GDK_QUARTZ_EVENT_MASK_ANY = NSAnyEventMask,
} GdkQuartzEventMask;
#else
typedef enum
{
GDK_QUARTZ_FLAGS_CHANGED = NSEventTypeFlagsChanged,
GDK_QUARTZ_KEY_UP = NSEventTypeKeyUp,
GDK_QUARTZ_KEY_DOWN = NSEventTypeKeyDown,
GDK_QUARTZ_MOUSE_ENTERED = NSEventTypeMouseEntered,
GDK_QUARTZ_MOUSE_EXITED = NSEventTypeMouseExited,
GDK_QUARTZ_SCROLL_WHEEL = NSEventTypeScrollWheel,
GDK_QUARTZ_MOUSE_MOVED = NSEventTypeMouseMoved,
GDK_QUARTZ_OTHER_MOUSE_DRAGGED = NSEventTypeOtherMouseDragged,
GDK_QUARTZ_RIGHT_MOUSE_DRAGGED = NSEventTypeRightMouseDragged,
GDK_QUARTZ_LEFT_MOUSE_DRAGGED = NSEventTypeLeftMouseDragged,
GDK_QUARTZ_OTHER_MOUSE_UP = NSEventTypeOtherMouseUp,
GDK_QUARTZ_RIGHT_MOUSE_UP = NSEventTypeRightMouseUp,
GDK_QUARTZ_LEFT_MOUSE_UP = NSEventTypeLeftMouseUp,
GDK_QUARTZ_OTHER_MOUSE_DOWN = NSEventTypeOtherMouseDown,
GDK_QUARTZ_RIGHT_MOUSE_DOWN = NSEventTypeRightMouseDown,
GDK_QUARTZ_LEFT_MOUSE_DOWN = NSEventTypeLeftMouseDown,
} GdkQuartzEventType;
typedef enum
{
GDK_QUARTZ_ALTERNATE_KEY_MASK = NSEventModifierFlagOption,
GDK_QUARTZ_CONTROL_KEY_MASK = NSEventModifierFlagControl,
GDK_QUARTZ_SHIFT_KEY_MASK = NSEventModifierFlagShift,
GDK_QUARTZ_ALPHA_SHIFT_KEY_MASK = NSEventModifierFlagCapsLock,
GDK_QUARTZ_COMMAND_KEY_MASK = NSEventModifierFlagCommand,
} GdkQuartzEventModifierFlags;
typedef enum
{
GDK_QUARTZ_EVENT_MASK_ANY = NSEventMaskAny,
} GdkQuartzEventMask;
#endif
G_END_DECLS
#endif /* __GDK_QUARTZ_KEYS_H__ */

View File

@ -28,10 +28,6 @@
G_BEGIN_DECLS
GDK_AVAILABLE_IN_ALL
NSImage *gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf);
GDK_AVAILABLE_IN_ALL
NSEvent *gdk_quartz_event_get_nsevent (GdkEvent *event);
GDK_AVAILABLE_IN_3_12
gunichar gdk_quartz_get_key_equivalent (guint key);

View File

@ -45,11 +45,6 @@ typedef struct _GdkQuartzWindowClass GdkQuartzWindowClass;
GDK_AVAILABLE_IN_ALL
GType gdk_quartz_window_get_type (void);
GDK_AVAILABLE_IN_ALL
NSWindow *gdk_quartz_window_get_nswindow (GdkWindow *window);
GDK_AVAILABLE_IN_ALL
NSView *gdk_quartz_window_get_nsview (GdkWindow *window);
G_END_DECLS
#endif /* __GDK_QUARTZ_WINDOW_H__ */

View File

@ -23,6 +23,7 @@
#include "gdkselection.h"
#include "gdkproperty.h"
#include "gdkquartz.h"
#include "gdkinternal-quartz.h"
gboolean
_gdk_quartz_display_set_selection_owner (GdkDisplay *display,

View File

@ -19,10 +19,11 @@
#include "config.h"
#include <AppKit/AppKit.h>
#include <gdk/gdk.h>
#include <gdkinternals.h>
#include "gdkquartz-gtk-only.h"
#include <gdkquartzutils.h>
#include "gdkprivate-quartz.h"
NSImage *
gdk_quartz_pixbuf_to_ns_image_libgtk_only (GdkPixbuf *pixbuf)

View File

@ -24,11 +24,13 @@
#include <gdk/gdkdisplayprivate.h>
#include "gdkwindowimpl.h"
#include "gdkwindow-quartz.h"
#include "gdkprivate-quartz.h"
#include "gdkglcontext-quartz.h"
#include "gdkquartzglcontext.h"
#include "gdkquartzscreen.h"
#include "gdkquartzcursor.h"
#include "gdkquartz-gtk-only.h"
#include <Carbon/Carbon.h>
#include <AvailabilityMacros.h>

View File

@ -22,6 +22,7 @@
#import <gdk/quartz/GdkQuartzView.h>
#import <gdk/quartz/GdkQuartzNSWindow.h>
#include "gdk/gdkwindowimpl.h"
#include "gdkinternal-quartz.h"
G_BEGIN_DECLS
@ -108,7 +109,6 @@ struct _GdkRootWindowImplQuartzClass
GType _gdk_root_window_impl_quartz_get_type (void);
G_END_DECLS
#endif /* __GDK_WINDOW_QUARTZ_H__ */

View File

@ -22,7 +22,9 @@
*/
#import <Cocoa/Cocoa.h>
#include <quartz/gdkquartz.h>
#define __GTK_H_INSIDE__
#include <quartz/gdkquartz-gtk-only.h>
#undef __GTK_H_INSIDE__
#define QUARTZ_POOL_ALLOC NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]
#define QUARTZ_POOL_RELEASE [pool release]

View File

@ -31,7 +31,7 @@
#include "gtktextbuffer.h"
#include "gtkselectionprivate.h"
#include "gtkquartz.h"
#include "../gdk/quartz/gdkquartz.h"
#include "quartz/gdkquartz-gtk-only.h"
enum {
OWNER_CHANGE,

View File

@ -42,6 +42,8 @@
#include "gtkintl.h"
#include "gtkquartz.h"
#include "gdk/quartz/gdkquartz.h"
#include "gdk/quartz/gdkquartz-gtk-only.h"
#include "gdk/quartz/gdkquartzdnd.h"
#include "gtkselectionprivate.h"
#include "gtksettings.h"
#include "gtkiconhelperprivate.h"

View File

@ -40,8 +40,7 @@
#include "gtklabel.h"
#include "gtkfilechooserentry.h"
#include "gtkfilefilterprivate.h"
#include "quartz/gdkquartz.h"
#include <quartz/gdkquartz-gtk-only.h>
typedef struct {
GtkFileChooserNative *self;

View File

@ -20,7 +20,7 @@
#include "gtkquartz.h"
#include "gtkselectionprivate.h"
#include <gdk/quartz/gdkquartz.h>
#include <gdk/quartz/gdkquartz-gtk-only.h>
static gboolean

View File

@ -25,7 +25,10 @@
#include "gtk/gtkintl.h"
#include "gtk/gtkimmodule.h"
#include "gdk/quartz/gdkquartz.h"
#define GTK_COMPILATION 1 // For gdkquartz-gtk-only.h
#include "gdk/quartz/gdkinternal-quartz.h"
#include "gdk/quartz/gdkquartz-gtk-only.h"
#include "gdk/quartz/GdkQuartzView.h"
#define GTK_IM_CONTEXT_TYPE_QUARTZ (type_quartz)