2005-11-22 10:03:32 +00:00
|
|
|
/* gdkdisplay-quartz.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005 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, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
#include "config.h"
|
2005-11-22 10:03:32 +00:00
|
|
|
|
|
|
|
#include "gdk.h"
|
2010-12-22 02:13:02 +00:00
|
|
|
#include "gdkdisplay-quartz.h"
|
2005-11-22 10:03:32 +00:00
|
|
|
#include "gdkprivate-quartz.h"
|
2009-10-24 09:48:39 +00:00
|
|
|
#include "gdkscreen-quartz.h"
|
2010-05-25 22:38:44 +00:00
|
|
|
#include "gdkdevicemanager-core.h"
|
2005-11-22 10:03:32 +00:00
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
|
|
|
|
static GdkWindow *
|
|
|
|
gdk_quartz_display_get_default_group (GdkDisplay *display)
|
2006-03-27 10:47:29 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
|
|
|
|
|
|
|
/* FIXME: Implement */
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
GdkDeviceManager *
|
|
|
|
_gdk_device_manager_new (GdkDisplay *display)
|
|
|
|
{
|
|
|
|
return g_object_new (GDK_TYPE_DEVICE_MANAGER_CORE,
|
|
|
|
"display", display,
|
|
|
|
NULL);
|
|
|
|
}
|
|
|
|
|
2005-11-22 10:03:32 +00:00
|
|
|
GdkDisplay *
|
2010-12-17 16:38:02 +00:00
|
|
|
_gdk_quartz_display_open (const gchar *display_name)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
|
|
|
if (_gdk_display != NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2007-05-21 19:40:43 +00:00
|
|
|
/* Initialize application */
|
|
|
|
[NSApplication sharedApplication];
|
|
|
|
|
2010-12-17 16:38:02 +00:00
|
|
|
_gdk_display = g_object_new (_gdk_quartz_display_get_type (), NULL);
|
2010-05-25 22:38:44 +00:00
|
|
|
_gdk_display->device_manager = _gdk_device_manager_new (_gdk_display);
|
2009-10-24 09:48:39 +00:00
|
|
|
|
|
|
|
_gdk_screen = _gdk_screen_quartz_new ();
|
2005-11-22 10:03:32 +00:00
|
|
|
|
2010-12-17 16:05:53 +00:00
|
|
|
_gdk_quartz_visual_init (_gdk_screen);
|
|
|
|
|
2005-11-22 10:03:32 +00:00
|
|
|
_gdk_windowing_window_init ();
|
|
|
|
|
2010-12-17 16:38:02 +00:00
|
|
|
_gdk_quartz_events_init ();
|
2010-05-25 22:38:44 +00:00
|
|
|
|
2010-12-17 16:38:02 +00:00
|
|
|
_gdk_quartz_input_init ();
|
2006-07-17 14:48:10 +00:00
|
|
|
|
2005-11-22 10:03:32 +00:00
|
|
|
#if 0
|
|
|
|
/* FIXME: Remove the #if 0 when we have these functions */
|
2010-12-17 15:53:00 +00:00
|
|
|
_gdk_quartz_dnd_init ();
|
2005-11-22 10:03:32 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
g_signal_emit_by_name (gdk_display_manager_get (),
|
|
|
|
"display_opened", _gdk_display);
|
|
|
|
|
|
|
|
return _gdk_display;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static const gchar *
|
|
|
|
gdk_quartz_display_get_name (GdkDisplay *display)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
2006-08-24 19:41:40 +00:00
|
|
|
static gchar *display_name = NULL;
|
|
|
|
|
2007-03-10 21:04:05 +00:00
|
|
|
if (!display_name)
|
|
|
|
{
|
|
|
|
GDK_QUARTZ_ALLOC_POOL;
|
|
|
|
display_name = g_strdup ([[[NSHost currentHost] name] UTF8String]);
|
|
|
|
GDK_QUARTZ_RELEASE_POOL;
|
|
|
|
}
|
2006-08-24 19:41:40 +00:00
|
|
|
|
|
|
|
return display_name;
|
2005-11-22 10:03:32 +00:00
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static gint
|
|
|
|
gdk_quartz_display_get_n_screens (GdkDisplay *display)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static GdkScreen *
|
|
|
|
gdk_quartz_display_get_screen (GdkDisplay *display,
|
|
|
|
gint screen_num)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
|
|
|
g_return_val_if_fail (screen_num == 0, NULL);
|
|
|
|
|
|
|
|
return _gdk_screen;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static GdkScreen *
|
|
|
|
gdk_quartz_display_get_default_screen (GdkDisplay *display)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
|
|
|
return _gdk_screen;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static void
|
|
|
|
gdk_quartz_display_beep (GdkDisplay *display)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GDK_IS_DISPLAY (display));
|
|
|
|
|
|
|
|
NSBeep();
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_quartz_display_supports_selection_notification (GdkDisplay *display)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
|
|
|
|
|
|
|
/* FIXME: Implement */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_quartz_display_request_selection_notification (GdkDisplay *display,
|
|
|
|
GdkAtom selection)
|
2005-11-22 10:03:32 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
/* FIXME: Implement */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_quartz_display_supports_clipboard_persistence (GdkDisplay *display)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
|
|
|
/* FIXME: Implement */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_quartz_display_supports_shapes (GdkDisplay *display)
|
2006-02-20 11:57:12 +00:00
|
|
|
{
|
|
|
|
/* FIXME: Implement */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_quartz_display_supports_input_shapes (GdkDisplay *display)
|
2006-02-20 11:57:12 +00:00
|
|
|
{
|
|
|
|
/* FIXME: Implement */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static void
|
|
|
|
gdk_quartz_display_store_clipboard (GdkDisplay *display,
|
|
|
|
GdkWindow *clipboard_window,
|
|
|
|
guint32 time_,
|
|
|
|
const GdkAtom *targets,
|
|
|
|
gint n_targets)
|
2005-11-22 10:03:32 +00:00
|
|
|
{
|
|
|
|
/* FIXME: Implement */
|
|
|
|
}
|
2007-06-01 12:16:12 +00:00
|
|
|
|
|
|
|
|
2010-12-22 02:13:02 +00:00
|
|
|
static gboolean
|
|
|
|
gdk_quartz_display_supports_composite (GdkDisplay *display)
|
2007-06-01 12:16:12 +00:00
|
|
|
{
|
|
|
|
/* FIXME: Implement */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2009-01-24 09:03:25 +00:00
|
|
|
|
|
|
|
gulong
|
|
|
|
_gdk_windowing_window_get_next_serial (GdkDisplay *display)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2010-12-22 02:13:02 +00:00
|
|
|
|
|
|
|
G_DEFINE_TYPE (GdkDisplayQuartz, _gdk_display_quartz, GDK_TYPE_DISPLAY)
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gdk_display_quartz_init (GdkDisplayQuartz *display)
|
|
|
|
{
|
2010-12-17 17:01:54 +00:00
|
|
|
gdk_quartz_display_manager_add_display (gdk_display_nmanager_get (),
|
2010-12-17 16:38:02 +00:00
|
|
|
GDK_DISPLAY_OBJECT (display));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gdk_display_quartz_dispose (GObject *object)
|
|
|
|
{
|
|
|
|
_gdk_quartz_display_manager_remove_display (gdk_display_manager_get (),
|
|
|
|
GDK_DISPLAY_OBJECT (object));
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (_gdk_display_quartz_parent_class)->dispose (object);
|
2010-12-22 02:13:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gdk_display_quartz_finalize (GObject *object)
|
|
|
|
{
|
|
|
|
G_OBJECT_CLASS (_gdk_display_quartz_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_gdk_display_quartz_class_init (GdkDisplayQuartz *class)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
|
|
|
GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class);
|
|
|
|
|
|
|
|
object_class->finalize = _gdk_display_quartz_finalize;
|
|
|
|
|
|
|
|
display_class->get_name = gdk_quartz_display_get_name;
|
|
|
|
display_class->get_n_screens = gdk_quartz_display_get_n_screens;
|
|
|
|
display_class->get_screen = gdk_quartz_display_get_screen;
|
|
|
|
display_class->get_default_screen = gdk_quartz_display_get_default_screen;
|
|
|
|
display_class->beep = gdk_quartz_display_beep;
|
|
|
|
display_class->sync = _gdk_quartz_display_sync;
|
|
|
|
display_class->flush = _gdk_quartz_display_flush;
|
2010-12-17 16:46:22 +00:00
|
|
|
display_class->queue_events = _gdk_quartz_display_queue_events;
|
|
|
|
display_class->has_pending = _gdk_quartz_display_has_pending;
|
2010-12-22 02:13:02 +00:00
|
|
|
display_class->get_default_group = gdk_quartz_display_get_default_group;
|
|
|
|
display_class->supports_selection_notification = gdk_quartz_display_supports_selection_notification;
|
|
|
|
display_class->request_selection_notification = gdk_quartz_display_request_selection_notification;
|
|
|
|
display_class->supports_clipboard_persistence = gdk_quartz_display_supports_clipboard_persistence;
|
|
|
|
display_class->store_clipboard = gdk_quartz_display_store_clipboard;
|
|
|
|
display_class->supports_shapes = gdk_quartz_display_supports_shapes;
|
|
|
|
display_class->supports_input_shapes = gdk_quartz_display_supports_input_shapes;
|
|
|
|
display_class->supports_composite = gdk_quartz_display_supports_composite;
|
|
|
|
display_class->list_devices = _gdk_quartz_display_list_devices;
|
|
|
|
display_class->send_client_message = _gdk_quartz_display_send_client_message;
|
|
|
|
display_class->add_client_message_filter = _gdk_quartz_display_add_client_message_filter;
|
2010-12-17 15:52:14 +00:00
|
|
|
display_class->get_drag_protocol = _gdk_quartz_display_get_drag_protocol;
|
2010-12-17 17:01:54 +00:00
|
|
|
display_class->get_cursor_for_type = _gdk_quartz_display_get_cursor_for_type;
|
|
|
|
display_class->get_cursor_for_name = _gdk_quartz_display_get_cursor_for_name;
|
|
|
|
display_class->get_cursor_for_pixbuf = _gdk_quartz_display_get_cursor_for_pixbuf;
|
|
|
|
display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size;
|
|
|
|
display_class->get_maximal_cursor_size = _gdk_quartz_display_get_maximal_cursor_size;
|
|
|
|
display_class->supports_cursor_alpha = _gdk_quartz_display_supports_cursor_alpha;
|
|
|
|
display_class->supports_cursor_color = _gdk_quartz_display_supports_cursor_color;
|
2010-12-22 02:13:02 +00:00
|
|
|
}
|