gtk2/gdk/broadway/gdkdisplay-broadway.c

801 lines
22 KiB
C
Raw Normal View History

2010-11-12 12:18:58 +00:00
/* GDK - The GIMP Drawing Kit
* gdkdisplay-broadway.c
2010-11-12 12:18:58 +00:00
*
* Copyright 2001 Sun Microsystems Inc.
* Copyright (C) 2004 Nokia Corporation
*
* Erwann Chenede <erwann.chenede@sun.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library 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.
*/
#include "config.h"
#include "gdkdisplay-broadway.h"
#include "gdkdisplay.h"
#include "gdkeventsource.h"
#include "gdkscreen.h"
#include "gdkscreen-broadway.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include "gdkdevicemanager-broadway.h"
2010-11-12 12:18:58 +00:00
#include <glib.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
static void gdk_broadway_display_dispose (GObject *object);
static void gdk_broadway_display_finalize (GObject *object);
2010-11-12 12:18:58 +00:00
G_DEFINE_TYPE (GdkBroadwayDisplay, gdk_broadway_display, GDK_TYPE_DISPLAY)
2010-11-12 12:18:58 +00:00
static void
gdk_broadway_display_init (GdkBroadwayDisplay *display)
2010-11-12 12:18:58 +00:00
{
_gdk_broadway_display_manager_add_display (gdk_display_manager_get (),
GDK_DISPLAY_OBJECT (display));
2010-11-20 21:38:34 +00:00
display->id_ht = g_hash_table_new (NULL, NULL);
2010-11-12 12:18:58 +00:00
}
static void
gdk_event_init (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
GdkBroadwayDisplay *broadway_display;
2010-11-12 12:18:58 +00:00
broadway_display = GDK_BROADWAY_DISPLAY (display);
broadway_display->event_source = _gdk_broadway_event_source_new (display);
broadway_display->saved_serial = 1;
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_init_input (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
GdkBroadwayDisplay *broadway_display;
2010-11-12 12:18:58 +00:00
GdkDeviceManager *device_manager;
GdkDevice *device;
GList *list, *l;
broadway_display = GDK_BROADWAY_DISPLAY (display);
2010-11-12 12:18:58 +00:00
device_manager = gdk_display_get_device_manager (display);
/* For backwards compatibility, just add
* floating devices that are not keyboards.
*/
list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_FLOATING);
for (l = list; l; l = l->next)
{
device = l->data;
if (gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD)
continue;
broadway_display->input_devices = g_list_prepend (broadway_display->input_devices,
2010-11-12 12:18:58 +00:00
g_object_ref (l->data));
}
g_list_free (list);
/* Now set "core" pointer to the first
* master device that is a pointer.
*/
list = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);
for (l = list; l; l = l->next)
{
device = list->data;
if (gdk_device_get_source (device) != GDK_SOURCE_MOUSE)
continue;
display->core_pointer = device;
break;
}
/* Add the core pointer to the devices list */
broadway_display->input_devices = g_list_prepend (broadway_display->input_devices,
2010-11-12 12:18:58 +00:00
g_object_ref (display->core_pointer));
g_list_free (list);
}
2010-11-25 12:03:52 +00:00
struct HttpRequest {
2010-11-18 12:17:23 +00:00
GdkDisplay *display;
GSocketConnection *connection;
GDataInputStream *data;
GString *request;
2010-11-25 12:03:52 +00:00
};
2010-11-18 12:17:23 +00:00
static void
http_request_free (HttpRequest *request)
{
g_object_unref (request->connection);
g_object_unref (request->data);
g_string_free (request->request, TRUE);
g_free (request);
}
#include <unistd.h>
#include <fcntl.h>
static void
set_fd_blocking (int fd)
{
glong arg;
if ((arg = fcntl (fd, F_GETFL, NULL)) < 0)
arg = 0;
arg = arg & ~O_NONBLOCK;
fcntl (fd, F_SETFL, arg);
}
2010-11-19 13:13:13 +00:00
static char *
parse_line (char *line, char *key)
{
char *p;
if (!g_str_has_prefix (line, key))
return NULL;
p = line + strlen (key);
if (*p != ':')
return NULL;
p++;
/* Skip optional initial space */
if (*p == ' ')
p++;
return p;
}
static void
got_input (GInputStream *stream,
GAsyncResult *result,
HttpRequest *request)
{
GError *error;
char *message;
2010-11-19 13:13:13 +00:00
gsize len;
error = NULL;
2010-11-19 13:13:13 +00:00
message = g_data_input_stream_read_upto_finish (G_DATA_INPUT_STREAM (stream), result, &len, &error);
if (message == NULL)
{
GDK_BROADWAY_DISPLAY (request->display)->input = NULL;
http_request_free (request);
return;
2010-11-19 13:13:13 +00:00
}
2010-11-19 13:13:13 +00:00
g_assert (message[0] == 0);
_gdk_broadway_events_got_input (request->display, message + 1);
2010-11-19 13:13:13 +00:00
/* Skip past ending 0xff */
g_data_input_stream_read_byte (request->data, NULL, NULL);
g_data_input_stream_read_upto_async (request->data, "\xff", 1, 0, NULL,
(GAsyncReadyCallback)got_input, request);
}
2010-11-25 12:08:13 +00:00
static void
send_error (HttpRequest *request,
int error_code,
const char *reason)
{
char *res;
res = g_strdup_printf ("HTTP/1.0 %d %s\r\n\r\n"
"<html><head><title>%d %s</title></head>"
"<body>%s</body></html>",
error_code, reason,
error_code, reason,
reason);
/* TODO: This should really be async */
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
res, strlen (res), NULL, NULL, NULL);
g_free (res);
http_request_free (request);
}
2010-11-19 13:13:13 +00:00
static void
start_input (HttpRequest *request)
{
char **lines;
char *p;
int num_key1, num_key2;
guint64 key1, key2;
int num_space;
int i;
guint8 challenge[16];
char *res;
gsize len;
GChecksum *checksum;
char *origin, *host;
GdkBroadwayDisplay *broadway_display;
2010-11-25 12:03:52 +00:00
broadway_display = GDK_BROADWAY_DISPLAY (request->display);
2010-11-19 13:13:13 +00:00
if (broadway_display->input != NULL)
{
send_error (request, 409, "Input already handled");
return;
}
2010-11-19 13:13:13 +00:00
lines = g_strsplit (request->request->str, "\n", 0);
num_key1 = 0;
num_key2 = 0;
key1 = 0;
key2 = 0;
origin = NULL;
host = NULL;
for (i = 0; lines[i] != NULL; i++)
{
if ((p = parse_line (lines[i], "Sec-WebSocket-Key1")))
{
num_space = 0;
while (*p != 0)
{
if (g_ascii_isdigit (*p))
key1 = key1 * 10 + g_ascii_digit_value (*p);
else if (*p == ' ')
num_space++;
p++;
}
key1 /= num_space;
num_key1++;
}
else if ((p = parse_line (lines[i], "Sec-WebSocket-Key2")))
{
num_space = 0;
while (*p != 0)
{
if (g_ascii_isdigit (*p))
key2 = key2 * 10 + g_ascii_digit_value (*p);
else if (*p == ' ')
num_space++;
p++;
}
key2 /= num_space;
num_key2++;
}
else if ((p = parse_line (lines[i], "Origin")))
{
origin = p;
}
else if ((p = parse_line (lines[i], "Host")))
{
host = p;
}
}
if (num_key1 != 1 || num_key2 != 1 || origin == NULL || host == NULL)
{
g_strfreev (lines);
send_error (request, 400, "Bad websocket request");
return;
2010-11-19 13:13:13 +00:00
}
challenge[0] = (key1 >> 24) & 0xff;
challenge[1] = (key1 >> 16) & 0xff;
challenge[2] = (key1 >> 8) & 0xff;
challenge[3] = (key1 >> 0) & 0xff;
challenge[4] = (key2 >> 24) & 0xff;
challenge[5] = (key2 >> 16) & 0xff;
challenge[6] = (key2 >> 8) & 0xff;
challenge[7] = (key2 >> 0) & 0xff;
if (!g_input_stream_read_all (G_INPUT_STREAM (request->data), challenge+8, 8, NULL, NULL, NULL))
{
g_strfreev (lines);
send_error (request, 400, "Bad websocket request");
return;
2010-11-19 13:13:13 +00:00
}
checksum = g_checksum_new (G_CHECKSUM_MD5);
g_checksum_update (checksum, challenge, 16);
len = 16;
g_checksum_get_digest (checksum, challenge, &len);
g_checksum_free (checksum);
res = g_strdup_printf ("HTTP/1.1 101 WebSocket Protocol Handshake\r\n"
"Upgrade: WebSocket\r\n"
"Connection: Upgrade\r\n"
"Sec-WebSocket-Origin: %s\r\n"
"Sec-WebSocket-Location: ws://%s/input\r\n"
"Sec-WebSocket-Protocol: broadway\r\n"
"\r\n",
origin, host);
/* TODO: This should really be async */
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
res, strlen (res), NULL, NULL, NULL);
g_free (res);
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
challenge, 16, NULL, NULL, NULL);
broadway_display->input = request;
2010-11-25 12:03:52 +00:00
2010-11-19 13:13:13 +00:00
g_data_input_stream_read_upto_async (request->data, "\xff", 1, 0, NULL,
(GAsyncReadyCallback)got_input, request);
g_strfreev (lines);
2010-11-19 13:13:13 +00:00
}
static void
start_output (HttpRequest *request)
{
GSocket *socket;
GdkBroadwayDisplay *broadway_display;
int fd;
socket = g_socket_connection_get_socket (request->connection);
broadway_display = GDK_BROADWAY_DISPLAY (request->display);
fd = g_socket_get_fd (socket);
set_fd_blocking (fd);
2010-11-24 21:12:50 +00:00
/* We dup this because otherwise it'll be closed with the request SocketConnection */
if (broadway_display->output)
{
broadway_display->saved_serial = broadway_output_get_next_serial (broadway_display->output);
broadway_output_free (broadway_display->output);
}
broadway_display->output = broadway_output_new (dup(fd), broadway_display->saved_serial);
_gdk_broadway_resync_windows ();
http_request_free (request);
}
static void
send_data (HttpRequest *request,
const char *mimetype,
const char *data, gsize len)
{
char *res;
res = g_strdup_printf ("HTTP/1.0 200 OK\r\n"
"Content-Type: %s\r\n"
"Content-Length: %"G_GSIZE_FORMAT"\r\n"
"\r\n",
mimetype, len);
/* TODO: This should really be async */
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
res, strlen (res), NULL, NULL, NULL);
g_free (res);
g_output_stream_write_all (g_io_stream_get_output_stream (G_IO_STREAM (request->connection)),
data, len, NULL, NULL, NULL);
http_request_free (request);
}
#include "clienthtml.h"
#include "broadwayjs.h"
2010-11-18 12:17:23 +00:00
static void
got_request (HttpRequest *request)
{
char *start, *escaped, *tmp, *version;
if (!g_str_has_prefix (request->request->str, "GET "))
{
send_error (request, 501, "Only GET implemented");
return;
}
start = request->request->str + 4; /* Skip "GET " */
while (*start == ' ')
start++;
for (tmp = start; *tmp != 0 && *tmp != ' ' && *tmp != '\n'; tmp++)
;
escaped = g_strndup (start, tmp - start);
version = NULL;
if (*tmp == ' ')
{
start = tmp;
while (*start == ' ')
start++;
for (tmp = start; *tmp != 0 && *tmp != ' ' && *tmp != '\n'; tmp++)
;
version = g_strndup (start, tmp - start);
}
if (strcmp (escaped, "/client.html") == 0 || strcmp (escaped, "/") == 0)
send_data (request, "text/html", client_html, G_N_ELEMENTS(client_html) - 1);
else if (strcmp (escaped, "/broadway.js") == 0)
send_data (request, "text/javascript", broadway_js, G_N_ELEMENTS(broadway_js) - 1);
else if (strcmp (escaped, "/output") == 0)
start_output (request);
2010-11-19 13:13:13 +00:00
else if (strcmp (escaped, "/input") == 0)
start_input (request);
else
send_error (request, 404, "File not found");
2010-11-18 12:17:23 +00:00
}
static void
2010-11-19 13:13:13 +00:00
got_http_request_line (GInputStream *stream,
2010-11-18 12:17:23 +00:00
GAsyncResult *result,
HttpRequest *request)
{
char *line;
line = g_data_input_stream_read_line_finish (G_DATA_INPUT_STREAM (stream), result, NULL, NULL);
if (line == NULL)
{
http_request_free (request);
g_printerr ("Error reading request lines\n");
return;
}
if (strlen (line) == 0)
got_request (request);
else
{
/* Protect against overflow in request length */
if (request->request->len > 1024 * 5)
{
send_error (request, 400, "Request to long");
}
else
{
g_string_append_printf (request->request, "%s\n", line);
g_data_input_stream_read_line_async (request->data, 0, NULL,
(GAsyncReadyCallback)got_http_request_line, request);
}
}
g_free (line);
}
static gboolean
handle_incoming_connection (GSocketService *service,
GSocketConnection *connection,
GObject *source_object)
{
HttpRequest *request;
GInputStream *in;
request = g_new0 (HttpRequest, 1);
request->connection = g_object_ref (connection);
request->display = (GdkDisplay *) source_object;
request->request = g_string_new ("");
in = g_io_stream_get_input_stream (G_IO_STREAM (connection));
request->data = g_data_input_stream_new (in);
g_filter_input_stream_set_close_base_stream (G_FILTER_INPUT_STREAM (request->data), FALSE);
2010-11-18 12:17:23 +00:00
/* Be tolerant of input */
g_data_input_stream_set_newline_type (request->data, G_DATA_STREAM_NEWLINE_TYPE_ANY);
g_data_input_stream_read_line_async (request->data, 0, NULL,
(GAsyncReadyCallback)got_http_request_line, request);
return TRUE;
}
2010-11-12 12:18:58 +00:00
GdkDisplay *
_gdk_broadway_display_open (const gchar *display_name)
2010-11-12 12:18:58 +00:00
{
GdkDisplay *display;
GdkBroadwayDisplay *broadway_display;
2010-11-18 12:17:23 +00:00
GError *error;
display = g_object_new (GDK_TYPE_BROADWAY_DISPLAY, NULL);
broadway_display = GDK_BROADWAY_DISPLAY (display);
2010-11-12 12:18:58 +00:00
broadway_display->output = NULL;
2010-11-15 19:08:18 +00:00
/* initialize the display's screens */
broadway_display->screens = g_new (GdkScreen *, 1);
broadway_display->screens[0] = _gdk_broadway_screen_new (display, 0);
2010-11-12 12:18:58 +00:00
/* We need to initialize events after we have the screen
* structures in places
*/
_gdk_broadway_screen_events_init (broadway_display->screens[0]);
2010-11-12 12:18:58 +00:00
/*set the default screen */
broadway_display->default_screen = broadway_display->screens[0];
2010-11-12 12:18:58 +00:00
display->device_manager = _gdk_broadway_device_manager_new (display);
2010-11-12 12:18:58 +00:00
gdk_event_init (display);
2010-11-12 12:18:58 +00:00
gdk_broadway_display_init_input (display);
_gdk_broadway_display_init_dnd (display);
2010-11-12 12:18:58 +00:00
_gdk_broadway_screen_setup (broadway_display->screens[0]);
2010-11-12 12:18:58 +00:00
broadway_display->service = g_socket_service_new ();
if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (broadway_display->service),
2010-11-18 12:17:23 +00:00
8080,
G_OBJECT (display),
&error))
{
g_printerr ("Unable to listen to port %d: %s\n", 8080, error->message);
g_error_free (error);
return NULL;
}
g_signal_connect (broadway_display->service, "incoming", G_CALLBACK (handle_incoming_connection), NULL);
2010-11-18 12:17:23 +00:00
2010-11-12 12:18:58 +00:00
g_signal_emit_by_name (display, "opened");
g_signal_emit_by_name (gdk_display_manager_get (), "display-opened", display);
return display;
}
static G_CONST_RETURN gchar *
gdk_broadway_display_get_name (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
2010-11-15 19:08:18 +00:00
return (gchar *) "Broadway";
2010-11-12 12:18:58 +00:00
}
static gint
gdk_broadway_display_get_n_screens (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
2010-11-15 19:08:18 +00:00
return 1;
2010-11-12 12:18:58 +00:00
}
static GdkScreen *
gdk_broadway_display_get_screen (GdkDisplay *display,
gint screen_num)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
2010-11-15 19:08:18 +00:00
g_return_val_if_fail (screen_num == 0, NULL);
return GDK_BROADWAY_DISPLAY (display)->screens[screen_num];
2010-11-12 12:18:58 +00:00
}
static GdkScreen *
gdk_broadway_display_get_default_screen (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_BROADWAY_DISPLAY (display)->default_screen;
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_beep (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_if_fail (GDK_IS_DISPLAY (display));
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_sync (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_if_fail (GDK_IS_DISPLAY (display));
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_flush (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_if_fail (GDK_IS_DISPLAY (display));
2010-11-15 19:08:18 +00:00
2010-11-12 12:18:58 +00:00
}
static gboolean
gdk_broadway_display_has_pending (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
return FALSE;
2010-11-12 12:18:58 +00:00
}
static GdkWindow *
gdk_broadway_display_get_default_group (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
2010-11-15 19:08:18 +00:00
return NULL;
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_dispose (GObject *object)
2010-11-12 12:18:58 +00:00
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
2010-11-12 12:18:58 +00:00
_gdk_broadway_display_manager_remove_display (gdk_display_manager_get (),
GDK_DISPLAY_OBJECT (object));
2010-11-12 12:18:58 +00:00
g_list_foreach (broadway_display->input_devices, (GFunc) g_object_run_dispose, NULL);
2010-11-12 12:18:58 +00:00
_gdk_screen_close (broadway_display->screens[0]);
if (broadway_display->event_source)
2010-11-12 12:18:58 +00:00
{
g_source_destroy (broadway_display->event_source);
g_source_unref (broadway_display->event_source);
broadway_display->event_source = NULL;
2010-11-12 12:18:58 +00:00
}
G_OBJECT_CLASS (gdk_broadway_display_parent_class)->dispose (object);
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_finalize (GObject *object)
2010-11-12 12:18:58 +00:00
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (object);
2010-11-12 12:18:58 +00:00
/* Keymap */
if (broadway_display->keymap)
g_object_unref (broadway_display->keymap);
2010-11-12 12:18:58 +00:00
_gdk_broadway_cursor_display_finalize (GDK_DISPLAY_OBJECT(broadway_display));
2010-11-12 12:18:58 +00:00
/* Atom Hashtable */
g_hash_table_destroy (broadway_display->atom_from_virtual);
g_hash_table_destroy (broadway_display->atom_to_virtual);
2010-11-12 12:18:58 +00:00
/* input GdkDevice list */
g_list_foreach (broadway_display->input_devices, (GFunc) g_object_unref, NULL);
g_list_free (broadway_display->input_devices);
2010-11-12 12:18:58 +00:00
/* Free all GdkScreens */
g_object_unref (broadway_display->screens[0]);
g_free (broadway_display->screens);
2010-11-12 12:18:58 +00:00
G_OBJECT_CLASS (gdk_broadway_display_parent_class)->finalize (object);
2010-11-12 12:18:58 +00:00
}
void
_gdk_broadway_display_make_default (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
}
static void
gdk_broadway_display_notify_startup_complete (GdkDisplay *display,
const gchar *startup_id)
2010-11-12 12:18:58 +00:00
{
}
static gboolean
gdk_broadway_display_supports_selection_notification (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
return FALSE;
2010-11-12 12:18:58 +00:00
}
static gboolean
gdk_broadway_display_request_selection_notification (GdkDisplay *display,
GdkAtom selection)
2010-11-12 12:18:58 +00:00
{
return FALSE;
}
static gboolean
gdk_broadway_display_supports_clipboard_persistence (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
return FALSE;
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_store_clipboard (GdkDisplay *display,
GdkWindow *clipboard_window,
guint32 time_,
const GdkAtom *targets,
gint n_targets)
2010-11-12 12:18:58 +00:00
{
}
static gboolean
gdk_broadway_display_supports_shapes (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
return FALSE;
2010-11-12 12:18:58 +00:00
}
static gboolean
gdk_broadway_display_supports_input_shapes (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
return FALSE;
2010-11-12 12:18:58 +00:00
}
static gboolean
gdk_broadway_display_supports_composite (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
2010-11-15 19:08:18 +00:00
return FALSE;
2010-11-12 12:18:58 +00:00
}
static GList *
gdk_broadway_display_list_devices (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_BROADWAY_DISPLAY (display)->input_devices;
2010-11-12 12:18:58 +00:00
}
static gulong
gdk_broadway_display_get_next_serial (GdkDisplay *display)
2010-11-12 12:18:58 +00:00
{
GdkBroadwayDisplay *broadway_display;
broadway_display = GDK_BROADWAY_DISPLAY (display);
if (broadway_display->output)
return broadway_output_get_next_serial (broadway_display->output);
return broadway_display->saved_serial;
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_event_data_copy (GdkDisplay *display,
const GdkEvent *src,
GdkEvent *dst)
2010-11-12 12:18:58 +00:00
{
}
2010-11-12 12:18:58 +00:00
static void
gdk_broadway_display_event_data_free (GdkDisplay *display,
GdkEvent *event)
{
2010-11-12 12:18:58 +00:00
}
static void
gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
2010-11-12 12:18:58 +00:00
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GdkDisplayClass *display_class = GDK_DISPLAY_CLASS (class);
object_class->dispose = gdk_broadway_display_dispose;
object_class->finalize = gdk_broadway_display_finalize;
display_class->window_type = GDK_TYPE_BROADWAY_WINDOW;
display_class->get_name = gdk_broadway_display_get_name;
display_class->get_n_screens = gdk_broadway_display_get_n_screens;
display_class->get_screen = gdk_broadway_display_get_screen;
display_class->get_default_screen = gdk_broadway_display_get_default_screen;
display_class->beep = gdk_broadway_display_beep;
display_class->sync = gdk_broadway_display_sync;
display_class->flush = gdk_broadway_display_flush;
display_class->has_pending = gdk_broadway_display_has_pending;
display_class->queue_events = _gdk_broadway_display_queue_events;
display_class->get_default_group = gdk_broadway_display_get_default_group;
display_class->supports_selection_notification = gdk_broadway_display_supports_selection_notification;
display_class->request_selection_notification = gdk_broadway_display_request_selection_notification;
display_class->supports_clipboard_persistence = gdk_broadway_display_supports_clipboard_persistence;
display_class->store_clipboard = gdk_broadway_display_store_clipboard;
display_class->supports_shapes = gdk_broadway_display_supports_shapes;
display_class->supports_input_shapes = gdk_broadway_display_supports_input_shapes;
display_class->supports_composite = gdk_broadway_display_supports_composite;
display_class->list_devices = gdk_broadway_display_list_devices;
display_class->get_cursor_for_type = _gdk_broadway_display_get_cursor_for_type;
display_class->get_cursor_for_name = _gdk_broadway_display_get_cursor_for_name;
display_class->get_cursor_for_pixbuf = _gdk_broadway_display_get_cursor_for_pixbuf;
display_class->get_default_cursor_size = _gdk_broadway_display_get_default_cursor_size;
display_class->get_maximal_cursor_size = _gdk_broadway_display_get_maximal_cursor_size;
display_class->supports_cursor_alpha = _gdk_broadway_display_supports_cursor_alpha;
display_class->supports_cursor_color = _gdk_broadway_display_supports_cursor_color;
display_class->before_process_all_updates = _gdk_broadway_display_before_process_all_updates;
display_class->after_process_all_updates = _gdk_broadway_display_after_process_all_updates;
display_class->get_next_serial = gdk_broadway_display_get_next_serial;
display_class->notify_startup_complete = gdk_broadway_display_notify_startup_complete;
display_class->event_data_copy = gdk_broadway_display_event_data_copy;
display_class->event_data_free = gdk_broadway_display_event_data_free;
display_class->create_window_impl = _gdk_broadway_display_create_window_impl;
display_class->get_keymap = _gdk_broadway_display_get_keymap;
display_class->get_selection_owner = _gdk_broadway_display_get_selection_owner;
display_class->set_selection_owner = _gdk_broadway_display_set_selection_owner;
display_class->send_selection_notify = _gdk_broadway_display_send_selection_notify;
display_class->get_selection_property = _gdk_broadway_display_get_selection_property;
display_class->convert_selection = _gdk_broadway_display_convert_selection;
display_class->text_property_to_utf8_list = _gdk_broadway_display_text_property_to_utf8_list;
display_class->utf8_to_string_target = _gdk_broadway_display_utf8_to_string_target;
2010-11-12 12:18:58 +00:00
}