[gtk+] broadway: Use "surface" instead of window/toplevel for browser object
- From: Alexander Larsson <alexl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] broadway: Use "surface" instead of window/toplevel for browser object
- Date: Tue, 5 Dec 2017 16:11:37 +0000 (UTC)
commit d141bd412109521b29067fdc4b134ceb54cfa14c
Author: Alexander Larsson <alexl redhat com>
Date: Tue Dec 5 14:38:57 2017 +0100
broadway: Use "surface" instead of window/toplevel for browser object
Als fixes indentation/tabs and removes some unused code.
gdk/broadway/broadway-output.c | 46 ++--
gdk/broadway/broadway-output.h | 110 +++---
gdk/broadway/broadway-protocol.h | 42 +-
gdk/broadway/broadway-server.c | 791 +++++++++++++++++--------------------
gdk/broadway/broadway-server.h | 164 ++++----
gdk/broadway/broadway.js | 98 +++---
gdk/broadway/broadwayd.c | 98 +++---
gdk/broadway/gdkbroadway-server.c | 152 ++++----
gdk/broadway/gdkbroadway-server.h | 22 +-
gdk/broadway/gdkeventsource.c | 280 +++++++-------
gdk/broadway/gdkwindow-broadway.c | 36 +-
11 files changed, 889 insertions(+), 950 deletions(-)
---
diff --git a/gdk/broadway/broadway-output.c b/gdk/broadway/broadway-output.c
index d74be05..6ee3229 100644
--- a/gdk/broadway/broadway-output.c
+++ b/gdk/broadway/broadway-output.c
@@ -22,8 +22,8 @@ struct BroadwayOutput {
static void
broadway_output_send_cmd (BroadwayOutput *output,
- gboolean fin, BroadwayWSOpCode code,
- const void *buf, gsize count)
+ gboolean fin, BroadwayWSOpCode code,
+ const void *buf, gsize count)
{
gboolean mask = FALSE;
guchar header[16];
@@ -102,7 +102,7 @@ broadway_output_get_next_serial (BroadwayOutput *output)
void
broadway_output_set_next_serial (BroadwayOutput *output,
- guint32 serial)
+ guint32 serial)
{
output->serial = serial;
}
@@ -178,8 +178,8 @@ write_header(BroadwayOutput *output, char op)
void
broadway_output_grab_pointer (BroadwayOutput *output,
- int id,
- gboolean owner_event)
+ int id,
+ gboolean owner_event)
{
write_header (output, BROADWAY_OP_GRAB_POINTER);
append_uint16 (output, id);
@@ -199,8 +199,8 @@ broadway_output_ungrab_pointer (BroadwayOutput *output)
void
broadway_output_new_surface(BroadwayOutput *output,
- int id, int x, int y, int w, int h,
- gboolean is_temp)
+ int id, int x, int y, int w, int h,
+ gboolean is_temp)
{
write_header (output, BROADWAY_OP_NEW_SURFACE);
append_uint16 (output, id);
@@ -272,13 +272,13 @@ broadway_output_set_show_keyboard (BroadwayOutput *output,
void
broadway_output_move_resize_surface (BroadwayOutput *output,
- int id,
- gboolean has_pos,
- int x,
- int y,
- gboolean has_size,
- int w,
- int h)
+ int id,
+ gboolean has_pos,
+ int x,
+ int y,
+ gboolean has_size,
+ int w,
+ int h)
{
int val;
@@ -303,8 +303,8 @@ broadway_output_move_resize_surface (BroadwayOutput *output,
void
broadway_output_set_transient_for (BroadwayOutput *output,
- int id,
- int parent_id)
+ int id,
+ int parent_id)
{
write_header (output, BROADWAY_OP_SET_TRANSIENT_FOR);
append_uint16 (output, id);
@@ -389,10 +389,10 @@ append_node (BroadwayOutput *output,
}
void
-broadway_output_window_set_nodes (BroadwayOutput *output,
- int id,
- BroadwayNode *root,
- BroadwayNode *old_root)
+broadway_output_surface_set_nodes (BroadwayOutput *output,
+ int id,
+ BroadwayNode *root,
+ BroadwayNode *old_root)
{
gsize size_pos, start, end;
@@ -419,8 +419,8 @@ broadway_output_window_set_nodes (BroadwayOutput *output,
void
broadway_output_upload_texture (BroadwayOutput *output,
- guint32 id,
- GBytes *texture)
+ guint32 id,
+ GBytes *texture)
{
gsize len = g_bytes_get_size (texture);
write_header (output, BROADWAY_OP_UPLOAD_TEXTURE);
@@ -431,7 +431,7 @@ broadway_output_upload_texture (BroadwayOutput *output,
void
broadway_output_release_texture (BroadwayOutput *output,
- guint32 id)
+ guint32 id)
{
write_header (output, BROADWAY_OP_RELEASE_TEXTURE);
append_uint32 (output, id);
diff --git a/gdk/broadway/broadway-output.h b/gdk/broadway/broadway-output.h
index 4f18b6e..7270f18 100644
--- a/gdk/broadway/broadway-output.h
+++ b/gdk/broadway/broadway-output.h
@@ -17,61 +17,61 @@ typedef enum {
BROADWAY_WS_CNX_PONG = 0xa
} BroadwayWSOpCode;
-BroadwayOutput *broadway_output_new (GOutputStream *out,
- guint32 serial);
-void broadway_output_free (BroadwayOutput *output);
-int broadway_output_flush (BroadwayOutput *output);
-int broadway_output_has_error (BroadwayOutput *output);
-void broadway_output_set_next_serial (BroadwayOutput *output,
- guint32 serial);
-guint32 broadway_output_get_next_serial (BroadwayOutput *output);
-void broadway_output_new_surface (BroadwayOutput *output,
- int id,
- int x,
- int y,
- int w,
- int h,
- gboolean is_temp);
-void broadway_output_disconnected (BroadwayOutput *output);
-void broadway_output_show_surface (BroadwayOutput *output,
- int id);
-void broadway_output_hide_surface (BroadwayOutput *output,
- int id);
-void broadway_output_raise_surface (BroadwayOutput *output,
- int id);
-void broadway_output_lower_surface (BroadwayOutput *output,
- int id);
-void broadway_output_destroy_surface (BroadwayOutput *output,
- int id);
-void broadway_output_roundtrip (BroadwayOutput *output,
- int id,
- guint32 tag);
+BroadwayOutput *broadway_output_new (GOutputStream *out,
+ guint32 serial);
+void broadway_output_free (BroadwayOutput *output);
+int broadway_output_flush (BroadwayOutput *output);
+int broadway_output_has_error (BroadwayOutput *output);
+void broadway_output_set_next_serial (BroadwayOutput *output,
+ guint32 serial);
+guint32 broadway_output_get_next_serial (BroadwayOutput *output);
+void broadway_output_new_surface (BroadwayOutput *output,
+ int id,
+ int x,
+ int y,
+ int w,
+ int h,
+ gboolean is_temp);
+void broadway_output_disconnected (BroadwayOutput *output);
+void broadway_output_show_surface (BroadwayOutput *output,
+ int id);
+void broadway_output_hide_surface (BroadwayOutput *output,
+ int id);
+void broadway_output_raise_surface (BroadwayOutput *output,
+ int id);
+void broadway_output_lower_surface (BroadwayOutput *output,
+ int id);
+void broadway_output_destroy_surface (BroadwayOutput *output,
+ int id);
+void broadway_output_roundtrip (BroadwayOutput *output,
+ int id,
+ guint32 tag);
void broadway_output_move_resize_surface (BroadwayOutput *output,
- int id,
- gboolean has_pos,
- int x,
- int y,
- gboolean has_size,
- int w,
- int h);
-void broadway_output_set_transient_for (BroadwayOutput *output,
- int id,
- int parent_id);
-void broadway_output_window_set_nodes (BroadwayOutput *output,
- int id,
- BroadwayNode *root,
- BroadwayNode *old_root);
-void broadway_output_upload_texture (BroadwayOutput *output,
- guint32 id,
- GBytes *texture);
-void broadway_output_release_texture (BroadwayOutput *output,
- guint32 id);
-void broadway_output_grab_pointer (BroadwayOutput *output,
- int id,
- gboolean owner_event);
-guint32 broadway_output_ungrab_pointer (BroadwayOutput *output);
-void broadway_output_pong (BroadwayOutput *output);
-void broadway_output_set_show_keyboard (BroadwayOutput *output,
- gboolean show);
+ int id,
+ gboolean has_pos,
+ int x,
+ int y,
+ gboolean has_size,
+ int w,
+ int h);
+void broadway_output_set_transient_for (BroadwayOutput *output,
+ int id,
+ int parent_id);
+void broadway_output_surface_set_nodes (BroadwayOutput *output,
+ int id,
+ BroadwayNode *root,
+ BroadwayNode *old_root);
+void broadway_output_upload_texture (BroadwayOutput *output,
+ guint32 id,
+ GBytes *texture);
+void broadway_output_release_texture (BroadwayOutput *output,
+ guint32 id);
+void broadway_output_grab_pointer (BroadwayOutput *output,
+ int id,
+ gboolean owner_event);
+guint32 broadway_output_ungrab_pointer (BroadwayOutput *output);
+void broadway_output_pong (BroadwayOutput *output);
+void broadway_output_set_show_keyboard (BroadwayOutput *output,
+ gboolean show);
#endif /* __BROADWAY_H__ */
diff --git a/gdk/broadway/broadway-protocol.h b/gdk/broadway/broadway-protocol.h
index 4ad6edc..68911ad 100644
--- a/gdk/broadway/broadway-protocol.h
+++ b/gdk/broadway/broadway-protocol.h
@@ -73,7 +73,7 @@ typedef enum {
BROADWAY_OP_REQUEST_AUTH = 'l',
BROADWAY_OP_AUTH_OK = 'L',
BROADWAY_OP_DISCONNECTED = 'D',
- BROADWAY_OP_WINDOW_UPDATE = 'b',
+ BROADWAY_OP_SURFACE_UPDATE = 'b',
BROADWAY_OP_SET_SHOW_KEYBOARD = 'k',
BROADWAY_OP_UPLOAD_TEXTURE = 't',
BROADWAY_OP_RELEASE_TEXTURE = 'T',
@@ -89,8 +89,8 @@ typedef struct {
typedef struct {
BroadwayInputBaseMsg base;
- guint32 mouse_window_id; /* The real window, not taking grabs into account */
- guint32 event_window_id;
+ guint32 mouse_surface_id; /* The real surface, not taking grabs into account */
+ guint32 event_surface_id;
gint32 root_x;
gint32 root_y;
gint32 win_x;
@@ -116,7 +116,7 @@ typedef struct {
typedef struct {
BroadwayInputBaseMsg base;
guint32 touch_type;
- guint32 event_window_id;
+ guint32 event_surface_id;
guint32 sequence_id;
guint32 is_emulated;
gint32 root_x;
@@ -128,7 +128,7 @@ typedef struct {
typedef struct {
BroadwayInputBaseMsg base;
- guint32 window_id;
+ guint32 surface_id;
guint32 state;
gint32 key;
} BroadwayInputKeyMsg;
@@ -188,18 +188,18 @@ typedef union {
} BroadwayInputMsg;
typedef enum {
- BROADWAY_REQUEST_NEW_WINDOW,
+ BROADWAY_REQUEST_NEW_SURFACE,
BROADWAY_REQUEST_FLUSH,
BROADWAY_REQUEST_SYNC,
BROADWAY_REQUEST_QUERY_MOUSE,
- BROADWAY_REQUEST_DESTROY_WINDOW,
- BROADWAY_REQUEST_SHOW_WINDOW,
- BROADWAY_REQUEST_HIDE_WINDOW,
+ BROADWAY_REQUEST_DESTROY_SURFACE,
+ BROADWAY_REQUEST_SHOW_SURFACE,
+ BROADWAY_REQUEST_HIDE_SURFACE,
BROADWAY_REQUEST_SET_TRANSIENT_FOR,
BROADWAY_REQUEST_MOVE_RESIZE,
BROADWAY_REQUEST_GRAB_POINTER,
BROADWAY_REQUEST_UNGRAB_POINTER,
- BROADWAY_REQUEST_FOCUS_WINDOW,
+ BROADWAY_REQUEST_FOCUS_SURFACE,
BROADWAY_REQUEST_SET_SHOW_KEYBOARD,
BROADWAY_REQUEST_UPLOAD_TEXTURE,
BROADWAY_REQUEST_RELEASE_TEXTURE,
@@ -216,7 +216,7 @@ typedef struct {
typedef struct {
BroadwayRequestBase base;
guint32 id;
-} BroadwayRequestDestroyWindow, BroadwayRequestShowWindow, BroadwayRequestHideWindow,
BroadwayRequestFocusWindow;
+} BroadwayRequestDestroySurface, BroadwayRequestShowSurface, BroadwayRequestHideSurface,
BroadwayRequestFocusSurface;
typedef struct {
BroadwayRequestBase base;
@@ -269,7 +269,7 @@ typedef struct {
guint32 width;
guint32 height;
guint32 is_temp;
-} BroadwayRequestNewWindow;
+} BroadwayRequestNewSurface;
typedef struct {
BroadwayRequestBase base;
@@ -288,19 +288,19 @@ typedef struct {
typedef union {
BroadwayRequestBase base;
- BroadwayRequestNewWindow new_window;
+ BroadwayRequestNewSurface new_surface;
BroadwayRequestFlush flush;
BroadwayRequestSync sync;
BroadwayRequestRoundtrip roundtrip;
BroadwayRequestQueryMouse query_mouse;
- BroadwayRequestDestroyWindow destroy_window;
- BroadwayRequestShowWindow show_window;
- BroadwayRequestHideWindow hide_window;
+ BroadwayRequestDestroySurface destroy_surface;
+ BroadwayRequestShowSurface show_surface;
+ BroadwayRequestHideSurface hide_surface;
BroadwayRequestSetTransientFor set_transient_for;
BroadwayRequestMoveResize move_resize;
BroadwayRequestGrabPointer grab_pointer;
BroadwayRequestUngrabPointer ungrab_pointer;
- BroadwayRequestFocusWindow focus_window;
+ BroadwayRequestFocusSurface focus_surface;
BroadwayRequestSetShowKeyboard set_show_keyboard;
BroadwayRequestUploadTexture upload_texture;
BroadwayRequestReleaseTexture release_texture;
@@ -311,7 +311,7 @@ typedef enum {
BROADWAY_REPLY_EVENT,
BROADWAY_REPLY_SYNC,
BROADWAY_REPLY_QUERY_MOUSE,
- BROADWAY_REPLY_NEW_WINDOW,
+ BROADWAY_REPLY_NEW_SURFACE,
BROADWAY_REPLY_GRAB_POINTER,
BROADWAY_REPLY_UNGRAB_POINTER
} BroadwayReplyType;
@@ -325,7 +325,7 @@ typedef struct {
typedef struct {
BroadwayReplyBase base;
guint32 id;
-} BroadwayReplyNewWindow;
+} BroadwayReplyNewSurface;
typedef struct {
BroadwayReplyBase base;
@@ -334,7 +334,7 @@ typedef struct {
typedef struct {
BroadwayReplyBase base;
- guint32 toplevel;
+ guint32 surface;
gint32 root_x;
gint32 root_y;
guint32 mask;
@@ -349,7 +349,7 @@ typedef union {
BroadwayReplyBase base;
BroadwayReplyEvent event;
BroadwayReplyQueryMouse query_mouse;
- BroadwayReplyNewWindow new_window;
+ BroadwayReplyNewSurface new_surface;
BroadwayReplyGrabPointer grab_pointer;
BroadwayReplyUngrabPointer ungrab_pointer;
} BroadwayReply;
diff --git a/gdk/broadway/broadway-server.c b/gdk/broadway/broadway-server.c
index 6984e72..33bfa5c 100644
--- a/gdk/broadway/broadway-server.c
+++ b/gdk/broadway/broadway-server.c
@@ -42,7 +42,7 @@ typedef struct {
} BroadwayOutstandingRoundtrip;
typedef struct BroadwayInput BroadwayInput;
-typedef struct BroadwayWindow BroadwayWindow;
+typedef struct BroadwaySurface BroadwaySurface;
struct _BroadwayServer {
GObject parent_instance;
@@ -60,9 +60,9 @@ struct _BroadwayServer {
guint process_input_idle;
GHashTable *id_ht;
- GList *toplevels;
- BroadwayWindow *root;
- gint32 focused_window_id; /* -1 => none */
+ GList *surfaces;
+ BroadwaySurface *root;
+ gint32 focused_surface_id; /* -1 => none */
gint show_keyboard;
guint32 next_texture_id;
@@ -71,13 +71,13 @@ struct _BroadwayServer {
guint32 screen_width;
guint32 screen_height;
- gint32 mouse_in_toplevel_id;
+ gint32 mouse_in_surface_id;
int last_x, last_y; /* in root coords */
guint32 last_state;
- gint32 real_mouse_in_toplevel_id; /* Not affected by grabs */
+ gint32 real_mouse_in_surface_id; /* Not affected by grabs */
/* Explicit pointer grabs: */
- gint32 pointer_grab_window_id; /* -1 => none */
+ gint32 pointer_grab_surface_id; /* -1 => none */
gint32 pointer_grab_client_id; /* -1 => none */
guint32 pointer_grab_time;
gboolean pointer_grab_owner_events;
@@ -86,7 +86,7 @@ struct _BroadwayServer {
int future_root_x;
int future_root_y;
guint32 future_state;
- int future_mouse_in_toplevel;
+ int future_mouse_in_surface;
GList *outstanding_roundtrips;
};
@@ -115,7 +115,7 @@ struct BroadwayInput {
gboolean active;
};
-struct BroadwayWindow {
+struct BroadwaySurface {
gint32 id;
gint32 x;
gint32 y;
@@ -128,7 +128,7 @@ struct BroadwayWindow {
BroadwayNode *nodes;
};
-static void broadway_server_resync_windows (BroadwayServer *server);
+static void broadway_server_resync_surfaces (BroadwayServer *server);
static void send_outstanding_roundtrips (BroadwayServer *server);
static GType broadway_server_get_type (void);
@@ -195,18 +195,18 @@ broadway_node_deep_equal (BroadwayNode *a,
static void
broadway_server_init (BroadwayServer *server)
{
- BroadwayWindow *root;
+ BroadwaySurface *root;
server->service = g_socket_service_new ();
- server->pointer_grab_window_id = -1;
+ server->pointer_grab_surface_id = -1;
server->saved_serial = 1;
server->last_seen_time = 1;
server->id_ht = g_hash_table_new (NULL, NULL);
server->id_counter = 0;
server->textures = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL,
- (GDestroyNotify)g_bytes_unref);
+ (GDestroyNotify)g_bytes_unref);
- root = g_new0 (BroadwayWindow, 1);
+ root = g_new0 (BroadwaySurface, 1);
root->id = server->id_counter++;
root->width = 1024;
root->height = 768;
@@ -215,8 +215,8 @@ broadway_server_init (BroadwayServer *server)
server->root = root;
g_hash_table_insert (server->id_ht,
- GINT_TO_POINTER (root->id),
- root);
+ GINT_TO_POINTER (root->id),
+ root);
}
static void
@@ -241,11 +241,11 @@ broadway_server_class_init (BroadwayServerClass * class)
}
static void
-broadway_window_free (BroadwayWindow *window)
+broadway_surface_free (BroadwaySurface *surface)
{
- if (window->nodes)
- broadway_node_free (window->nodes);
- g_free (window);
+ if (surface->nodes)
+ broadway_node_free (surface->nodes);
+ g_free (surface);
}
static void start (BroadwayInput *input);
@@ -271,62 +271,62 @@ broadway_input_free (BroadwayInput *input)
static void
update_event_state (BroadwayServer *server,
- BroadwayInputMsg *message)
+ BroadwayInputMsg *message)
{
- BroadwayWindow *window;
+ BroadwaySurface *surface;
switch (message->base.type) {
case BROADWAY_EVENT_ENTER:
server->last_x = message->pointer.root_x;
server->last_y = message->pointer.root_y;
server->last_state = message->pointer.state;
- server->real_mouse_in_toplevel_id = message->pointer.mouse_window_id;
+ server->real_mouse_in_surface_id = message->pointer.mouse_surface_id;
/* TODO: Unset when it dies */
- server->mouse_in_toplevel_id = message->pointer.event_window_id;
+ server->mouse_in_surface_id = message->pointer.event_surface_id;
break;
case BROADWAY_EVENT_LEAVE:
server->last_x = message->pointer.root_x;
server->last_y = message->pointer.root_y;
server->last_state = message->pointer.state;
- server->real_mouse_in_toplevel_id = message->pointer.mouse_window_id;
+ server->real_mouse_in_surface_id = message->pointer.mouse_surface_id;
- server->mouse_in_toplevel_id = 0;
+ server->mouse_in_surface_id = 0;
break;
case BROADWAY_EVENT_POINTER_MOVE:
server->last_x = message->pointer.root_x;
server->last_y = message->pointer.root_y;
server->last_state = message->pointer.state;
- server->real_mouse_in_toplevel_id = message->pointer.mouse_window_id;
+ server->real_mouse_in_surface_id = message->pointer.mouse_surface_id;
break;
case BROADWAY_EVENT_BUTTON_PRESS:
case BROADWAY_EVENT_BUTTON_RELEASE:
if (message->base.type == BROADWAY_EVENT_BUTTON_PRESS &&
- server->focused_window_id != message->pointer.mouse_window_id &&
- server->pointer_grab_window_id == -1)
+ server->focused_surface_id != message->pointer.mouse_surface_id &&
+ server->pointer_grab_surface_id == -1)
{
- broadway_server_window_raise (server, message->pointer.mouse_window_id);
- broadway_server_focus_window (server, message->pointer.mouse_window_id);
+ broadway_server_surface_raise (server, message->pointer.mouse_surface_id);
+ broadway_server_focus_surface (server, message->pointer.mouse_surface_id);
broadway_server_flush (server);
}
server->last_x = message->pointer.root_x;
server->last_y = message->pointer.root_y;
server->last_state = message->pointer.state;
- server->real_mouse_in_toplevel_id = message->pointer.mouse_window_id;
+ server->real_mouse_in_surface_id = message->pointer.mouse_surface_id;
break;
case BROADWAY_EVENT_SCROLL:
server->last_x = message->pointer.root_x;
server->last_y = message->pointer.root_y;
server->last_state = message->pointer.state;
- server->real_mouse_in_toplevel_id = message->pointer.mouse_window_id;
+ server->real_mouse_in_surface_id = message->pointer.mouse_surface_id;
break;
case BROADWAY_EVENT_TOUCH:
if (message->touch.touch_type == 0 && message->touch.is_emulated &&
- server->focused_window_id != message->touch.event_window_id)
+ server->focused_surface_id != message->touch.event_surface_id)
{
- broadway_server_window_raise (server, message->touch.event_window_id);
- broadway_server_focus_window (server, message->touch.event_window_id);
+ broadway_server_surface_raise (server, message->touch.event_surface_id);
+ broadway_server_focus_surface (server, message->touch.event_surface_id);
broadway_server_flush (server);
}
@@ -346,12 +346,12 @@ update_event_state (BroadwayServer *server,
case BROADWAY_EVENT_UNGRAB_NOTIFY:
break;
case BROADWAY_EVENT_CONFIGURE_NOTIFY:
- window = g_hash_table_lookup (server->id_ht,
- GINT_TO_POINTER (message->configure_notify.id));
- if (window != NULL)
+ surface = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (message->configure_notify.id));
+ if (surface != NULL)
{
- window->x = message->configure_notify.x;
- window->y = message->configure_notify.y;
+ surface->x = message->configure_notify.x;
+ surface->y = message->configure_notify.y;
}
break;
case BROADWAY_EVENT_ROUNDTRIP_NOTIFY:
@@ -369,7 +369,7 @@ update_event_state (BroadwayServer *server,
gboolean
broadway_server_lookahead_event (BroadwayServer *server,
- const char *types)
+ const char *types)
{
BroadwayInputMsg *message;
GList *l;
@@ -378,7 +378,7 @@ broadway_server_lookahead_event (BroadwayServer *server,
{
message = l->data;
if (strchr (types, message->base.type) != NULL)
- return TRUE;
+ return TRUE;
}
return FALSE;
@@ -400,14 +400,14 @@ is_pointer_event (BroadwayInputMsg *message)
static void
process_input_message (BroadwayServer *server,
- BroadwayInputMsg *message)
+ BroadwayInputMsg *message)
{
gint32 client;
update_event_state (server, message);
client = -1;
if (is_pointer_event (message) &&
- server->pointer_grab_window_id != -1)
+ server->pointer_grab_surface_id != -1)
client = server->pointer_grab_client_id;
broadway_events_got_input (message, client);
@@ -422,16 +422,16 @@ process_input_messages (BroadwayServer *server)
{
message = server->input_messages->data;
server->input_messages =
- g_list_delete_link (server->input_messages,
- server->input_messages);
+ g_list_delete_link (server->input_messages,
+ server->input_messages);
if (message->base.serial == 0)
- {
- /* This was sent before we got any requests, but we don't want the
- daemon serials to go backwards, so we fix it up to be the last used
- serial */
- message->base.serial = server->saved_serial - 1;
- }
+ {
+ /* This was sent before we got any requests, but we don't want the
+ daemon serials to go backwards, so we fix it up to be the last used
+ serial */
+ message->base.serial = server->saved_serial - 1;
+ }
process_input_message (server, message);
g_free (message);
@@ -440,18 +440,18 @@ process_input_messages (BroadwayServer *server)
static void
fake_configure_notify (BroadwayServer *server,
- BroadwayWindow *window)
+ BroadwaySurface *surface)
{
BroadwayInputMsg ev = { {0} };
ev.base.type = BROADWAY_EVENT_CONFIGURE_NOTIFY;
ev.base.serial = server->saved_serial - 1;
ev.base.time = server->last_seen_time;
- ev.configure_notify.id = window->id;
- ev.configure_notify.x = window->x;
- ev.configure_notify.y = window->y;
- ev.configure_notify.width = window->width;
- ev.configure_notify.height = window->height;
+ ev.configure_notify.id = surface->id;
+ ev.configure_notify.x = surface->x;
+ ev.configure_notify.y = surface->y;
+ ev.configure_notify.width = surface->width;
+ ev.configure_notify.height = surface->height;
process_input_message (server, &ev);
}
@@ -459,8 +459,8 @@ fake_configure_notify (BroadwayServer *server,
static guint32 *
parse_pointer_data (guint32 *p, BroadwayInputPointerMsg *data)
{
- data->mouse_window_id = ntohl (*p++);
- data->event_window_id = ntohl (*p++);
+ data->mouse_surface_id = ntohl (*p++);
+ data->event_surface_id = ntohl (*p++);
data->root_x = ntohl (*p++);
data->root_y = ntohl (*p++);
data->win_x = ntohl (*p++);
@@ -474,7 +474,7 @@ static guint32 *
parse_touch_data (guint32 *p, BroadwayInputTouchMsg *data)
{
data->touch_type = ntohl (*p++);
- data->event_window_id = ntohl (*p++);
+ data->event_surface_id = ntohl (*p++);
data->sequence_id = ntohl (*p++);
data->is_emulated = ntohl (*p++);
data->root_x = ntohl (*p++);
@@ -492,7 +492,7 @@ update_future_pointer_info (BroadwayServer *server, BroadwayInputPointerMsg *dat
server->future_root_x = data->root_x;
server->future_root_y = data->root_y;
server->future_state = data->state;
- server->future_mouse_in_toplevel = data->mouse_window_id;
+ server->future_mouse_in_surface = data->mouse_surface_id;
}
static void
@@ -524,8 +524,8 @@ parse_input_message (BroadwayInput *input, const unsigned char *message)
if (!input->seen_time) {
input->seen_time = TRUE;
/* Calculate time base so that any following times are normalized to start
- 5 seconds after last_seen_time, to avoid issues that could appear when
- a long hiatus due to a reconnect seems to be instant */
+ 5 seconds after last_seen_time, to avoid issues that could appear when
+ a long hiatus due to a reconnect seems to be instant */
input->time_base = time_ - (server->last_seen_time + 5000);
}
time_ = time_ - input->time_base;
@@ -567,7 +567,7 @@ parse_input_message (BroadwayInput *input, const unsigned char *message)
case BROADWAY_EVENT_KEY_PRESS:
case BROADWAY_EVENT_KEY_RELEASE:
- msg.key.window_id = server->focused_window_id;
+ msg.key.surface_id = server->focused_surface_id;
msg.key.key = ntohl (*p++);
msg.key.state = ntohl (*p++);
break;
@@ -627,21 +627,21 @@ hex_dump (guchar *data, gsize len)
{
fprintf (stderr, "0x%.4x ", j);
for (i = 0; i < 16; i++)
- {
- if ((j + i) < len)
- fprintf (stderr, "%.2x ", data[j+i]);
- else
- fprintf (stderr, " ");
- if (i == 8)
- fprintf (stderr, " ");
- }
+ {
+ if ((j + i) < len)
+ fprintf (stderr, "%.2x ", data[j+i]);
+ else
+ fprintf (stderr, " ");
+ if (i == 8)
+ fprintf (stderr, " ");
+ }
fprintf (stderr, " | ");
for (i = 0; i < 16; i++)
- if ((j + i) < len && g_ascii_isalnum(data[j+i]))
- fprintf (stderr, "%c", data[j+i]);
- else
- fprintf (stderr, ".");
+ if ((j + i) < len && g_ascii_isalnum(data[j+i]))
+ fprintf (stderr, "%c", data[j+i]);
+ else
+ fprintf (stderr, ".");
fprintf (stderr, "\n");
}
#endif
@@ -773,16 +773,16 @@ broadway_server_read_all_input_nonblocking (BroadwayInput *input)
in = g_io_stream_get_input_stream (input->connection);
res = g_pollable_input_stream_read_nonblocking (G_POLLABLE_INPUT_STREAM (in),
- buffer, sizeof (buffer), NULL, &error);
+ buffer, sizeof (buffer), NULL, &error);
if (res <= 0)
{
if (res < 0 &&
- g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
- {
- g_error_free (error);
- return TRUE;
- }
+ g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
+ {
+ g_error_free (error);
+ return TRUE;
+ }
if (input->server->input == input)
{
@@ -792,10 +792,10 @@ broadway_server_read_all_input_nonblocking (BroadwayInput *input)
}
broadway_input_free (input);
if (res < 0)
- {
- g_printerr ("input error %s\n", error->message);
- g_error_free (error);
- }
+ {
+ g_printerr ("input error %s\n", error->message);
+ g_error_free (error);
+ }
return FALSE;
}
@@ -819,7 +819,7 @@ broadway_server_consume_all_input (BroadwayServer *server)
static gboolean
input_data_cb (GObject *stream,
- BroadwayInput *input)
+ BroadwayInput *input)
{
BroadwayServer *server = input->server;
@@ -843,8 +843,8 @@ broadway_server_get_next_serial (BroadwayServer *server)
void
broadway_server_get_screen_size (BroadwayServer *server,
- guint32 *width,
- guint32 *height)
+ guint32 *width,
+ guint32 *height)
{
*width = server->root->width;
*height = server->root->height;
@@ -899,65 +899,6 @@ broadway_server_roundtrip (BroadwayServer *server,
broadway_server_fake_roundtrip_reply (server, id, tag);
}
-#if 0
-/* TODO: This is not used atm, is it needed? */
-/* Note: This may be called while handling a message (i.e. sorta recursively) */
-static BroadwayInputMsg *
-broadway_server_block_for_input (BroadwayServer *server, char op,
- guint32 serial, gboolean remove_message)
-{
- BroadwayInputMsg *message;
- gssize res;
- guint8 buffer[1024];
- BroadwayInput *input;
- GInputStream *in;
- GList *l;
-
- broadway_server_flush (server);
-
- if (server->input == NULL)
- return NULL;
-
- input = server->input;
-
- while (TRUE) {
- /* Check for existing reply in queue */
-
- for (l = server->input_messages; l != NULL; l = l->next)
- {
- message = l->data;
-
- if (message->base.type == op)
- {
- if (message->base.serial == serial)
- {
- if (remove_message)
- server->input_messages =
- g_list_delete_link (server->input_messages, l);
- return message;
- }
- }
- }
-
- /* Not found, read more, blocking */
-
- in = g_io_stream_get_input_stream (input->connection);
-
- res = g_input_stream_read (in, buffer, sizeof (buffer), NULL, NULL);
- if (res <= 0)
- return NULL;
- g_byte_array_append (input->buffer, buffer, res);
-
- parse_input (input);
-
- /* Since we're parsing input but not processing the resulting messages
- we might not get a readable callback on the stream, so queue an idle to
- process the messages */
- queue_process_input_at_idle (server);
- }
-}
-#endif
-
static const char *
parse_line (const char *line, const char *key)
{
@@ -977,17 +918,17 @@ parse_line (const char *line, const char *key)
static void
send_error (HttpRequest *request,
- int error_code,
- const char *reason)
+ 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);
+ "<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 (request->connection),
@@ -1070,15 +1011,15 @@ start_input (HttpRequest *request)
{
char* accept = generate_handshake_response_wsietf_v7 (key);
res = g_strdup_printf ("HTTP/1.1 101 Switching Protocols\r\n"
- "Upgrade: websocket\r\n"
- "Connection: Upgrade\r\n"
- "Sec-WebSocket-Accept: %s\r\n"
- "%s%s%s"
- "Sec-WebSocket-Location: ws://%s/socket\r\n"
- "Sec-WebSocket-Protocol: broadway\r\n"
- "\r\n", accept,
- origin?"Sec-WebSocket-Origin: ":"", origin?origin:"", origin?"\r\n":"",
- host);
+ "Upgrade: websocket\r\n"
+ "Connection: Upgrade\r\n"
+ "Sec-WebSocket-Accept: %s\r\n"
+ "%s%s%s"
+ "Sec-WebSocket-Location: ws://%s/socket\r\n"
+ "Sec-WebSocket-Protocol: broadway\r\n"
+ "\r\n", accept,
+ origin?"Sec-WebSocket-Origin: ":"", origin?origin:"", origin?"\r\n":"",
+ host);
g_free (accept);
#ifdef DEBUG_WEBSOCKETS
@@ -1098,7 +1039,7 @@ start_input (HttpRequest *request)
socket = g_socket_connection_get_socket (request->socket_connection);
setsockopt (g_socket_get_fd (socket), IPPROTO_TCP,
- TCP_NODELAY, (char *) &flag, sizeof(int));
+ TCP_NODELAY, (char *) &flag, sizeof(int));
input = g_new0 (BroadwayInput, 1);
input->server = request->server;
@@ -1178,35 +1119,35 @@ start (BroadwayInput *input)
broadway_output_set_next_serial (server->output, server->saved_serial);
broadway_output_flush (server->output);
- broadway_server_resync_windows (server);
+ broadway_server_resync_surfaces (server);
- if (server->pointer_grab_window_id != -1)
+ if (server->pointer_grab_surface_id != -1)
broadway_output_grab_pointer (server->output,
- server->pointer_grab_window_id,
- server->pointer_grab_owner_events);
+ server->pointer_grab_surface_id,
+ server->pointer_grab_owner_events);
process_input_messages (server);
}
static void
send_data (HttpRequest *request,
- const char *mimetype,
- const char *data, gsize len)
+ 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);
+ "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 (request->connection),
- res, strlen (res), NULL, NULL, NULL);
+ res, strlen (res), NULL, NULL, NULL);
g_free (res);
g_output_stream_write_all (g_io_stream_get_output_stream (request->connection),
- data, len, NULL, NULL, NULL);
+ data, len, NULL, NULL, NULL);
http_request_free (request);
}
@@ -1237,9 +1178,9 @@ got_request (HttpRequest *request)
{
start = tmp;
while (*start == ' ')
- start++;
+ start++;
for (tmp = start; *tmp != 0 && *tmp != ' ' && *tmp != '\n'; tmp++)
- ;
+ ;
version = g_strndup (start, tmp - start);
}
@@ -1262,8 +1203,8 @@ got_request (HttpRequest *request)
static void
got_http_request_line (GInputStream *stream,
- GAsyncResult *result,
- HttpRequest *request)
+ GAsyncResult *result,
+ HttpRequest *request)
{
char *line;
@@ -1280,23 +1221,23 @@ got_http_request_line (GInputStream *stream,
{
/* Protect against overflow in request length */
if (request->request->len > 1024 * 5)
- {
- send_error (request, 400, "Request too long");
- }
+ {
+ send_error (request, 400, "Request too 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_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)
+ GSocketConnection *connection,
+ GObject *source_object)
{
HttpRequest *request;
GInputStream *in;
@@ -1352,7 +1293,7 @@ handle_incoming_connection (GSocketService *service,
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);
+ (GAsyncReadyCallback)got_http_request_line, request);
return TRUE;
}
@@ -1376,44 +1317,44 @@ broadway_server_new (char *address,
if (address == NULL)
{
if (!g_socket_listener_add_inet_port (G_SOCKET_LISTENER (server->service),
- server->port,
- G_OBJECT (server),
- error))
- {
- g_prefix_error (error, "Unable to listen to port %d: ", server->port);
- g_object_unref (server);
- return NULL;
- }
+ server->port,
+ G_OBJECT (server),
+ error))
+ {
+ g_prefix_error (error, "Unable to listen to port %d: ", server->port);
+ g_object_unref (server);
+ return NULL;
+ }
}
else
{
inet_address = g_inet_address_new_from_string (address);
if (inet_address == NULL)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Invalid ip address %s: ", address);
- g_object_unref (server);
- return NULL;
- }
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Invalid ip address %s: ", address);
+ g_object_unref (server);
+ return NULL;
+ }
socket_address = g_inet_socket_address_new (inet_address, port);
g_object_unref (inet_address);
if (!g_socket_listener_add_address (G_SOCKET_LISTENER (server->service),
- socket_address,
- G_SOCKET_TYPE_STREAM,
- G_SOCKET_PROTOCOL_TCP,
- G_OBJECT (server),
- NULL,
- error))
- {
- g_prefix_error (error, "Unable to listen to %s:%d: ", server->address, server->port);
- g_object_unref (socket_address);
- g_object_unref (server);
- return NULL;
- }
+ socket_address,
+ G_SOCKET_TYPE_STREAM,
+ G_SOCKET_PROTOCOL_TCP,
+ G_OBJECT (server),
+ NULL,
+ error))
+ {
+ g_prefix_error (error, "Unable to listen to %s:%d: ", server->address, server->port);
+ g_object_unref (socket_address);
+ g_object_unref (server);
+ return NULL;
+ }
g_object_unref (socket_address);
}
g_signal_connect (server->service, "incoming",
- G_CALLBACK (handle_incoming_connection), NULL);
+ G_CALLBACK (handle_incoming_connection), NULL);
return server;
}
@@ -1439,29 +1380,29 @@ broadway_server_on_unix_socket_new (char *address, GError **error)
socket_address = g_unix_socket_address_new (address);
#endif
if (socket_address == NULL)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Invalid unix domain socket address %s: ",
address);
- g_object_unref (server);
- return NULL;
- }
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Invalid unix domain socket address %s:
", address);
+ g_object_unref (server);
+ return NULL;
+ }
if (!g_socket_listener_add_address (G_SOCKET_LISTENER (server->service),
- socket_address,
- G_SOCKET_TYPE_STREAM,
- G_SOCKET_PROTOCOL_DEFAULT,
- G_OBJECT (server),
- NULL,
- error))
- {
- g_prefix_error (error, "Unable to listen to %s: ", server->address);
- g_object_unref (socket_address);
- g_object_unref (server);
- return NULL;
- }
+ socket_address,
+ G_SOCKET_TYPE_STREAM,
+ G_SOCKET_PROTOCOL_DEFAULT,
+ G_OBJECT (server),
+ NULL,
+ error))
+ {
+ g_prefix_error (error, "Unable to listen to %s: ", server->address);
+ g_object_unref (socket_address);
+ g_object_unref (server);
+ return NULL;
+ }
g_object_unref (socket_address);
}
g_signal_connect (server->service, "incoming",
- G_CALLBACK (handle_incoming_connection), NULL);
+ G_CALLBACK (handle_incoming_connection), NULL);
return server;
}
@@ -1474,22 +1415,22 @@ broadway_server_get_last_seen_time (BroadwayServer *server)
void
broadway_server_query_mouse (BroadwayServer *server,
- guint32 *toplevel,
- gint32 *root_x,
- gint32 *root_y,
- guint32 *mask)
+ guint32 *surface,
+ gint32 *root_x,
+ gint32 *root_y,
+ guint32 *mask)
{
if (server->output)
{
broadway_server_consume_all_input (server);
if (root_x)
- *root_x = server->future_root_x;
+ *root_x = server->future_root_x;
if (root_y)
- *root_y = server->future_root_y;
+ *root_y = server->future_root_y;
if (mask)
- *mask = server->future_state;
- if (toplevel)
- *toplevel = server->future_mouse_in_toplevel;
+ *mask = server->future_state;
+ if (surface)
+ *surface = server->future_mouse_in_surface;
return;
}
@@ -1500,57 +1441,57 @@ broadway_server_query_mouse (BroadwayServer *server,
*root_y = server->last_y;
if (mask)
*mask = server->last_state;
- if (toplevel)
- *toplevel = server->mouse_in_toplevel_id;
+ if (surface)
+ *surface = server->mouse_in_surface_id;
}
void
-broadway_server_destroy_window (BroadwayServer *server,
- gint id)
+broadway_server_destroy_surface (BroadwayServer *server,
+ gint id)
{
- BroadwayWindow *window;
+ BroadwaySurface *surface;
- if (server->mouse_in_toplevel_id == id)
+ if (server->mouse_in_surface_id == id)
{
/* TODO: Send leave + enter event, update cursors, etc */
- server->mouse_in_toplevel_id = 0;
+ server->mouse_in_surface_id = 0;
}
- if (server->pointer_grab_window_id == id)
- server->pointer_grab_window_id = -1;
+ if (server->pointer_grab_surface_id == id)
+ server->pointer_grab_surface_id = -1;
if (server->output)
broadway_output_destroy_surface (server->output,
- id);
+ id);
- window = g_hash_table_lookup (server->id_ht,
- GINT_TO_POINTER (id));
- if (window != NULL)
+ surface = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (id));
+ if (surface != NULL)
{
- server->toplevels = g_list_remove (server->toplevels, window);
+ server->surfaces = g_list_remove (server->surfaces, surface);
g_hash_table_remove (server->id_ht,
GINT_TO_POINTER (id));
- broadway_window_free (window);
+ broadway_surface_free (surface);
}
}
gboolean
-broadway_server_window_show (BroadwayServer *server,
- gint id)
+broadway_server_surface_show (BroadwayServer *server,
+ gint id)
{
- BroadwayWindow *window;
+ BroadwaySurface *surface;
gboolean sent = FALSE;
- window = g_hash_table_lookup (server->id_ht,
- GINT_TO_POINTER (id));
- if (window == NULL)
+ surface = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (id));
+ if (surface == NULL)
return FALSE;
- window->visible = TRUE;
+ surface->visible = TRUE;
if (server->output)
{
- broadway_output_show_surface (server->output, window->id);
+ broadway_output_show_surface (server->output, surface->id);
sent = TRUE;
}
@@ -1558,52 +1499,52 @@ broadway_server_window_show (BroadwayServer *server,
}
gboolean
-broadway_server_window_hide (BroadwayServer *server,
- gint id)
+broadway_server_surface_hide (BroadwayServer *server,
+ gint id)
{
- BroadwayWindow *window;
+ BroadwaySurface *surface;
gboolean sent = FALSE;
- window = g_hash_table_lookup (server->id_ht,
- GINT_TO_POINTER (id));
- if (window == NULL)
+ surface = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (id));
+ if (surface == NULL)
return FALSE;
- window->visible = FALSE;
+ surface->visible = FALSE;
- if (server->mouse_in_toplevel_id == id)
+ if (server->mouse_in_surface_id == id)
{
/* TODO: Send leave + enter event, update cursors, etc */
- server->mouse_in_toplevel_id = 0;
+ server->mouse_in_surface_id = 0;
}
- if (server->pointer_grab_window_id == id)
- server->pointer_grab_window_id = -1;
+ if (server->pointer_grab_surface_id == id)
+ server->pointer_grab_surface_id = -1;
if (server->output)
{
- broadway_output_hide_surface (server->output, window->id);
+ broadway_output_hide_surface (server->output, surface->id);
sent = TRUE;
}
return sent;
}
void
-broadway_server_window_raise (BroadwayServer *server,
- gint id)
+broadway_server_surface_raise (BroadwayServer *server,
+ gint id)
{
- BroadwayWindow *window;
+ BroadwaySurface *surface;
- window = g_hash_table_lookup (server->id_ht,
- GINT_TO_POINTER (id));
- if (window == NULL)
+ surface = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (id));
+ if (surface == NULL)
return;
- server->toplevels = g_list_remove (server->toplevels, window);
- server->toplevels = g_list_append (server->toplevels, window);
+ server->surfaces = g_list_remove (server->surfaces, surface);
+ server->surfaces = g_list_append (server->surfaces, surface);
if (server->output)
- broadway_output_raise_surface (server->output, window->id);
+ broadway_output_raise_surface (server->output, surface->id);
}
void
@@ -1616,43 +1557,43 @@ broadway_server_set_show_keyboard (BroadwayServer *server,
{
broadway_output_set_show_keyboard (server->output, server->show_keyboard);
broadway_server_flush (server);
- }
+ }
}
void
-broadway_server_window_lower (BroadwayServer *server,
- gint id)
+broadway_server_surface_lower (BroadwayServer *server,
+ gint id)
{
- BroadwayWindow *window;
+ BroadwaySurface *surface;
- window = g_hash_table_lookup (server->id_ht,
- GINT_TO_POINTER (id));
- if (window == NULL)
+ surface = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (id));
+ if (surface == NULL)
return;
- server->toplevels = g_list_remove (server->toplevels, window);
- server->toplevels = g_list_prepend (server->toplevels, window);
+ server->surfaces = g_list_remove (server->surfaces, surface);
+ server->surfaces = g_list_prepend (server->surfaces, surface);
if (server->output)
- broadway_output_lower_surface (server->output, window->id);
+ broadway_output_lower_surface (server->output, surface->id);
}
void
-broadway_server_window_set_transient_for (BroadwayServer *server,
- gint id, gint parent)
+broadway_server_surface_set_transient_for (BroadwayServer *server,
+ gint id, gint parent)
{
- BroadwayWindow *window;
+ BroadwaySurface *surface;
- window = g_hash_table_lookup (server->id_ht,
- GINT_TO_POINTER (id));
- if (window == NULL)
+ surface = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (id));
+ if (surface == NULL)
return;
- window->transient_for = parent;
+ surface->transient_for = parent;
if (server->output)
{
- broadway_output_set_transient_for (server->output, window->id, window->transient_for);
+ broadway_output_set_transient_for (server->output, surface->id, surface->transient_for);
broadway_server_flush (server);
}
}
@@ -1665,36 +1606,36 @@ broadway_server_has_client (BroadwayServer *server)
/* passes ownership of nodes */
void
-broadway_server_window_set_nodes (BroadwayServer *server,
- gint id,
- BroadwayNode *root)
+broadway_server_surface_set_nodes (BroadwayServer *server,
+ gint id,
+ BroadwayNode *root)
{
- BroadwayWindow *window;
+ BroadwaySurface *surface;
- window = g_hash_table_lookup (server->id_ht, GINT_TO_POINTER (id));
- if (window == NULL)
+ surface = g_hash_table_lookup (server->id_ht, GINT_TO_POINTER (id));
+ if (surface == NULL)
return;
if (server->output != NULL)
- broadway_output_window_set_nodes (server->output, window->id,
- root,
- window->nodes);
+ broadway_output_surface_set_nodes (server->output, surface->id,
+ root,
+ surface->nodes);
- if (window->nodes)
- broadway_node_free (window->nodes);
- window->nodes = root;
+ if (surface->nodes)
+ broadway_node_free (surface->nodes);
+ surface->nodes = root;
}
guint32
broadway_server_upload_texture (BroadwayServer *server,
- GBytes *texture)
+ GBytes *texture)
{
guint32 id;
id = ++server->next_texture_id;
g_hash_table_replace (server->textures,
- GINT_TO_POINTER (id),
- g_bytes_ref (texture));
+ GINT_TO_POINTER (id),
+ g_bytes_ref (texture));
if (server->output)
broadway_output_upload_texture (server->output, id, texture);
@@ -1704,7 +1645,7 @@ broadway_server_upload_texture (BroadwayServer *server,
void
broadway_server_release_texture (BroadwayServer *server,
- guint32 id)
+ guint32 id)
{
g_hash_table_remove (server->textures, GINT_TO_POINTER (id));
@@ -1713,86 +1654,86 @@ broadway_server_release_texture (BroadwayServer *server,
}
gboolean
-broadway_server_window_move_resize (BroadwayServer *server,
- gint id,
- gboolean with_move,
- int x,
- int y,
- int width,
- int height)
-{
- BroadwayWindow *window;
+broadway_server_surface_move_resize (BroadwayServer *server,
+ gint id,
+ gboolean with_move,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+ BroadwaySurface *surface;
gboolean with_resize;
gboolean sent = FALSE;
- window = g_hash_table_lookup (server->id_ht,
- GINT_TO_POINTER (id));
- if (window == NULL)
+ surface = g_hash_table_lookup (server->id_ht,
+ GINT_TO_POINTER (id));
+ if (surface == NULL)
return FALSE;
- with_resize = width != window->width || height != window->height;
- window->width = width;
- window->height = height;
+ with_resize = width != surface->width || height != surface->height;
+ surface->width = width;
+ surface->height = height;
if (server->output != NULL)
{
broadway_output_move_resize_surface (server->output,
- window->id,
- with_move, x, y,
- with_resize, window->width, window->height);
+ surface->id,
+ with_move, x, y,
+ with_resize, surface->width, surface->height);
sent = TRUE;
}
else
{
if (with_move)
- {
- window->x = x;
- window->y = y;
- }
+ {
+ surface->x = x;
+ surface->y = y;
+ }
- fake_configure_notify (server, window);
+ fake_configure_notify (server, surface);
}
return sent;
}
void
-broadway_server_focus_window (BroadwayServer *server,
- gint new_focused_window)
+broadway_server_focus_surface (BroadwayServer *server,
+ gint new_focused_surface)
{
BroadwayInputMsg focus_msg;
- if (server->focused_window_id == new_focused_window)
+ if (server->focused_surface_id == new_focused_surface)
return;
memset (&focus_msg, 0, sizeof (focus_msg));
focus_msg.base.type = BROADWAY_EVENT_FOCUS;
focus_msg.base.time = broadway_server_get_last_seen_time (server);
- focus_msg.focus.old_id = server->focused_window_id;
- focus_msg.focus.new_id = new_focused_window;
+ focus_msg.focus.old_id = server->focused_surface_id;
+ focus_msg.focus.new_id = new_focused_surface;
broadway_events_got_input (&focus_msg, -1);
- /* Keep track of the new focused window */
- server->focused_window_id = new_focused_window;
+ /* Keep track of the new focused surface */
+ server->focused_surface_id = new_focused_surface;
}
guint32
broadway_server_grab_pointer (BroadwayServer *server,
- gint client_id,
- gint id,
- gboolean owner_events,
- guint32 event_mask,
- guint32 time_)
+ gint client_id,
+ gint id,
+ gboolean owner_events,
+ guint32 event_mask,
+ guint32 time_)
{
- if (server->pointer_grab_window_id != -1 &&
+ if (server->pointer_grab_surface_id != -1 &&
time_ != 0 && server->pointer_grab_time > time_)
return GDK_GRAB_ALREADY_GRABBED;
if (time_ == 0)
time_ = server->last_seen_time;
- server->pointer_grab_window_id = id;
+ server->pointer_grab_surface_id = id;
server->pointer_grab_client_id = client_id;
server->pointer_grab_owner_events = owner_events;
server->pointer_grab_time = time_;
@@ -1800,27 +1741,27 @@ broadway_server_grab_pointer (BroadwayServer *server,
if (server->output)
{
broadway_output_grab_pointer (server->output,
- id,
- owner_events);
+ id,
+ owner_events);
broadway_server_flush (server);
}
- /* TODO: What about toplevel grab events if we're not connected? */
+ /* TODO: What about surface grab events if we're not connected? */
return GDK_GRAB_SUCCESS;
}
guint32
broadway_server_ungrab_pointer (BroadwayServer *server,
- guint32 time_)
+ guint32 time_)
{
guint32 serial;
- if (server->pointer_grab_window_id != -1 &&
+ if (server->pointer_grab_surface_id != -1 &&
time_ != 0 && server->pointer_grab_time > time_)
return 0;
- /* TODO: What about toplevel grab events if we're not connected? */
+ /* TODO: What about surface grab events if we're not connected? */
if (server->output)
{
@@ -1832,57 +1773,57 @@ broadway_server_ungrab_pointer (BroadwayServer *server,
serial = server->saved_serial;
}
- server->pointer_grab_window_id = -1;
+ server->pointer_grab_surface_id = -1;
return serial;
}
guint32
-broadway_server_new_window (BroadwayServer *server,
- int x,
- int y,
- int width,
- int height,
- gboolean is_temp)
-{
- BroadwayWindow *window;
-
- window = g_new0 (BroadwayWindow, 1);
- window->id = server->id_counter++;
- window->x = x;
- window->y = y;
+broadway_server_new_surface (BroadwayServer *server,
+ int x,
+ int y,
+ int width,
+ int height,
+ gboolean is_temp)
+{
+ BroadwaySurface *surface;
+
+ surface = g_new0 (BroadwaySurface, 1);
+ surface->id = server->id_counter++;
+ surface->x = x;
+ surface->y = y;
if (x == 0 && y == 0 && !is_temp)
{
/* TODO: Better way to know if we should pick default pos */
- window->x = 100;
- window->y = 100;
+ surface->x = 100;
+ surface->y = 100;
}
- window->width = width;
- window->height = height;
- window->is_temp = is_temp;
+ surface->width = width;
+ surface->height = height;
+ surface->is_temp = is_temp;
g_hash_table_insert (server->id_ht,
- GINT_TO_POINTER (window->id),
- window);
+ GINT_TO_POINTER (surface->id),
+ surface);
- server->toplevels = g_list_append (server->toplevels, window);
+ server->surfaces = g_list_append (server->surfaces, surface);
if (server->output)
broadway_output_new_surface (server->output,
- window->id,
- window->x,
- window->y,
- window->width,
- window->height,
- window->is_temp);
+ surface->id,
+ surface->x,
+ surface->y,
+ surface->width,
+ surface->height,
+ surface->is_temp);
else
- fake_configure_notify (server, window);
+ fake_configure_notify (server, surface);
- return window->id;
+ return surface->id;
}
static void
-broadway_server_resync_windows (BroadwayServer *server)
+broadway_server_resync_surfaces (BroadwayServer *server)
{
GHashTableIter iter;
gpointer key, value;
@@ -1895,44 +1836,44 @@ broadway_server_resync_windows (BroadwayServer *server)
g_hash_table_iter_init (&iter, server->textures);
while (g_hash_table_iter_next (&iter, &key, &value))
broadway_output_upload_texture (server->output,
- GPOINTER_TO_INT (key),
- (GBytes *)value);
+ GPOINTER_TO_INT (key),
+ (GBytes *)value);
- /* Then create all windows */
- for (l = server->toplevels; l != NULL; l = l->next)
+ /* Then create all surfaces */
+ for (l = server->surfaces; l != NULL; l = l->next)
{
- BroadwayWindow *window = l->data;
+ BroadwaySurface *surface = l->data;
- if (window->id == 0)
- continue; /* Skip root */
+ if (surface->id == 0)
+ continue; /* Skip root */
broadway_output_new_surface (server->output,
- window->id,
- window->x,
- window->y,
- window->width,
- window->height,
- window->is_temp);
+ surface->id,
+ surface->x,
+ surface->y,
+ surface->width,
+ surface->height,
+ surface->is_temp);
}
- /* Then do everything that may reference other windows */
- for (l = server->toplevels; l != NULL; l = l->next)
+ /* Then do everything that may reference other surfaces */
+ for (l = server->surfaces; l != NULL; l = l->next)
{
- BroadwayWindow *window = l->data;
+ BroadwaySurface *surface = l->data;
- if (window->id == 0)
- continue; /* Skip root */
+ if (surface->id == 0)
+ continue; /* Skip root */
- if (window->transient_for != -1)
- broadway_output_set_transient_for (server->output, window->id,
- window->transient_for);
+ if (surface->transient_for != -1)
+ broadway_output_set_transient_for (server->output, surface->id,
+ surface->transient_for);
- if (window->nodes)
- broadway_output_window_set_nodes (server->output, window->id,
- window->nodes, NULL);
+ if (surface->nodes)
+ broadway_output_surface_set_nodes (server->output, surface->id,
+ surface->nodes, NULL);
- if (window->visible)
- broadway_output_show_surface (server->output, window->id);
+ if (surface->visible)
+ broadway_output_show_surface (server->output, surface->id);
}
if (server->show_keyboard)
diff --git a/gdk/broadway/broadway-server.h b/gdk/broadway/broadway-server.h
index 3a40f72..73ec89e 100644
--- a/gdk/broadway/broadway-server.h
+++ b/gdk/broadway/broadway-server.h
@@ -29,88 +29,88 @@ struct _BroadwayNode {
guint32 data[1];
};
-gboolean broadway_node_equal (BroadwayNode *a,
- BroadwayNode *b);
-gboolean broadway_node_deep_equal (BroadwayNode *a,
- BroadwayNode *b);
+gboolean broadway_node_equal (BroadwayNode *a,
+ BroadwayNode *b);
+gboolean broadway_node_deep_equal (BroadwayNode *a,
+ BroadwayNode *b);
+BroadwayServer *broadway_server_new (char *address,
+ int port,
+ const char *ssl_cert,
+ const char *ssl_key,
+ GError **error);
+BroadwayServer *broadway_server_on_unix_socket_new (char *address,
+ GError **error);
+gboolean broadway_server_has_client (BroadwayServer *server);
+void broadway_server_flush (BroadwayServer *server);
+void broadway_server_sync (BroadwayServer *server);
+void broadway_server_roundtrip (BroadwayServer *server,
+ gint id,
+ guint32 tag);
+void broadway_server_get_screen_size (BroadwayServer *server,
+ guint32 *width,
+ guint32 *height);
+guint32 broadway_server_get_next_serial (BroadwayServer *server);
+guint32 broadway_server_get_last_seen_time (BroadwayServer *server);
+gboolean broadway_server_lookahead_event (BroadwayServer *server,
+ const char *types);
+void broadway_server_query_mouse (BroadwayServer *server,
+ guint32 *surface,
+ gint32 *root_x,
+ gint32 *root_y,
+ guint32 *mask);
+guint32 broadway_server_grab_pointer (BroadwayServer *server,
+ gint client_id,
+ gint id,
+ gboolean owner_events,
+ guint32 event_mask,
+ guint32 time_);
+guint32 broadway_server_ungrab_pointer (BroadwayServer *server,
+ guint32 time_);
+gint32 broadway_server_get_mouse_surface (BroadwayServer *server);
+void broadway_server_set_show_keyboard (BroadwayServer *server,
+ gboolean show);
+guint32 broadway_server_new_surface (BroadwayServer *server,
+ int x,
+ int y,
+ int width,
+ int height,
+ gboolean is_temp);
+void broadway_server_destroy_surface (BroadwayServer *server,
+ gint id);
+gboolean broadway_server_surface_show (BroadwayServer *server,
+ gint id);
+gboolean broadway_server_surface_hide (BroadwayServer *server,
+ gint id);
+void broadway_server_surface_raise (BroadwayServer *server,
+ gint id);
+void broadway_server_surface_lower (BroadwayServer *server,
+ gint id);
+void broadway_server_surface_set_transient_for (BroadwayServer *server,
+ gint id,
+ gint parent);
+gboolean broadway_server_surface_translate (BroadwayServer *server,
+ gint id,
+ cairo_region_t *area,
+ gint dx,
+ gint dy);
+guint32 broadway_server_upload_texture (BroadwayServer *server,
+ GBytes *texture);
+void broadway_server_release_texture (BroadwayServer *server,
+ guint32 id);
+cairo_surface_t * broadway_server_create_surface (int width,
+ int height);
+void broadway_server_surface_set_nodes (BroadwayServer *server,
+ gint id,
+ BroadwayNode *root);
+gboolean broadway_server_surface_move_resize (BroadwayServer *server,
+ gint id,
+ gboolean with_move,
+ int x,
+ int y,
+ int width,
+ int height);
+void broadway_server_focus_surface (BroadwayServer *server,
+ gint new_focused_surface);
-BroadwayServer *broadway_server_new (char *address,
- int port,
- const char *ssl_cert,
- const char *ssl_key,
- GError **error);
-BroadwayServer *broadway_server_on_unix_socket_new (char *address,
- GError **error);
-gboolean broadway_server_has_client (BroadwayServer *server);
-void broadway_server_flush (BroadwayServer *server);
-void broadway_server_sync (BroadwayServer *server);
-void broadway_server_roundtrip (BroadwayServer *server,
- gint id,
- guint32 tag);
-void broadway_server_get_screen_size (BroadwayServer *server,
- guint32 *width,
- guint32 *height);
-guint32 broadway_server_get_next_serial (BroadwayServer *server);
-guint32 broadway_server_get_last_seen_time (BroadwayServer *server);
-gboolean broadway_server_lookahead_event (BroadwayServer *server,
- const char *types);
-void broadway_server_query_mouse (BroadwayServer *server,
- guint32 *toplevel,
- gint32 *root_x,
- gint32 *root_y,
- guint32 *mask);
-guint32 broadway_server_grab_pointer (BroadwayServer *server,
- gint client_id,
- gint id,
- gboolean owner_events,
- guint32 event_mask,
- guint32 time_);
-guint32 broadway_server_ungrab_pointer (BroadwayServer *server,
- guint32 time_);
-gint32 broadway_server_get_mouse_toplevel (BroadwayServer *server);
-void broadway_server_set_show_keyboard (BroadwayServer *server,
- gboolean show);
-guint32 broadway_server_new_window (BroadwayServer *server,
- int x,
- int y,
- int width,
- int height,
- gboolean is_temp);
-void broadway_server_destroy_window (BroadwayServer *server,
- gint id);
-gboolean broadway_server_window_show (BroadwayServer *server,
- gint id);
-gboolean broadway_server_window_hide (BroadwayServer *server,
- gint id);
-void broadway_server_window_raise (BroadwayServer *server,
- gint id);
-void broadway_server_window_lower (BroadwayServer *server,
- gint id);
-void broadway_server_window_set_transient_for (BroadwayServer *server,
- gint id,
- gint parent);
-gboolean broadway_server_window_translate (BroadwayServer *server,
- gint id,
- cairo_region_t *area,
- gint dx,
- gint dy);
-guint32 broadway_server_upload_texture (BroadwayServer *server,
- GBytes *texture);
-void broadway_server_release_texture (BroadwayServer *server,
- guint32 id);
-cairo_surface_t * broadway_server_create_surface (int width,
- int height);
-void broadway_server_window_set_nodes (BroadwayServer *server,
- gint id,
- BroadwayNode *root);
-gboolean broadway_server_window_move_resize (BroadwayServer *server,
- gint id,
- gboolean with_move,
- int x,
- int y,
- int width,
- int height);
-void broadway_server_focus_window (BroadwayServer *server,
- gint new_focused_window);
#endif /* __BROADWAY_SERVER__ */
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index 4e15ecd..24859f1 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -69,7 +69,7 @@ function logStackTrace(len) {
}
var grab = new Object();
-grab.window = null;
+grab.surface = null;
grab.ownerEvents = false;
grab.implicit = false;
var keyDownList = [];
@@ -78,8 +78,8 @@ var lastX = 0;
var lastY = 0;
var lastState;
var lastTimeStamp = 0;
-var realWindowWithMouse = 0;
-var windowWithMouse = 0;
+var realSurfaceWithMouse = 0;
+var surfaceWithMouse = 0;
var surfaces = {};
var textures = {};
var stackingOrder = [];
@@ -177,12 +177,12 @@ function cmdShowSurface(id)
surface.div.style["top"] = yOffset + "px";
surface.div.style["visibility"] = "visible";
- restackWindows();
+ restackSurfaces();
}
function cmdHideSurface(id)
{
- if (grab.window == id)
+ if (grab.surface == id)
doUngrab();
var surface = surfaces[id];
@@ -206,11 +206,11 @@ function cmdSetTransientFor(id, parentId)
}
if (surface.visible) {
- restackWindows();
+ restackSurfaces();
}
}
-function restackWindows() {
+function restackSurfaces() {
for (var i = 0; i < stackingOrder.length; i++) {
var surface = stackingOrder[i];
surface.div.style.zIndex = i;
@@ -234,7 +234,7 @@ function moveToHelper(surface, position) {
function cmdDeleteSurface(id)
{
- if (grab.window == id)
+ if (grab.surface == id)
doUngrab();
var surface = surfaces[id];
@@ -286,7 +286,7 @@ function cmdRaiseSurface(id)
var surface = surfaces[id];
moveToHelper(surface);
- restackWindows();
+ restackSurfaces();
}
function cmdLowerSurface(id)
@@ -294,7 +294,7 @@ function cmdLowerSurface(id)
var surface = surfaces[id];
moveToHelper(surface, 0);
- restackWindows();
+ restackSurfaces();
}
function SwapNodes(node_data, div) {
@@ -692,7 +692,7 @@ SwapNodes.prototype.insertNode = function(parent, posInParent, oldNode)
}
}
-function cmdWindowSetNodes(id, node_data)
+function cmdSurfaceSetNodes(id, node_data)
{
var surface = surfaces[id];
surface.node_data = node_data;
@@ -730,7 +730,7 @@ function cmdGrabPointer(id, ownerEvents)
function cmdUngrabPointer()
{
sendInput ("u", []);
- if (grab.window)
+ if (grab.surface)
doUngrab();
}
@@ -833,7 +833,7 @@ function handleCommands(cmd)
for (var i = 0; i < len; i++)
node_data[i] = cmd.get_32();
- cmdWindowSetNodes(id, node_data);
+ cmdSurfaceSetNodes(id, node_data);
break;
case 'g': // Grab
@@ -980,11 +980,11 @@ function getPositionsFromEvent(ev, relativeId) {
}
function getEffectiveEventTarget (id) {
- if (grab.window != null) {
+ if (grab.surface != null) {
if (!grab.ownerEvents)
- return grab.window;
+ return grab.surface;
if (id == 0)
- return grab.window;
+ return grab.surface;
}
return id;
}
@@ -1016,19 +1016,19 @@ function onMouseMove (ev) {
var id = getSurfaceId(ev);
id = getEffectiveEventTarget (id);
var pos = getPositionsFromEvent(ev, id);
- sendInput ("m", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
+ sendInput ("m", [realSurfaceWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
}
function onMouseOver (ev) {
updateForEvent(ev);
var id = getSurfaceId(ev);
- realWindowWithMouse = id;
+ realSurfaceWithMouse = id;
id = getEffectiveEventTarget (id);
var pos = getPositionsFromEvent(ev, id);
- windowWithMouse = id;
- if (windowWithMouse != 0) {
- sendInput ("e", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState,
GDK_CROSSING_NORMAL]);
+ surfaceWithMouse = id;
+ if (surfaceWithMouse != 0) {
+ sendInput ("e", [realSurfaceWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState,
GDK_CROSSING_NORMAL]);
}
}
@@ -1040,44 +1040,44 @@ function onMouseOut (ev) {
var pos = getPositionsFromEvent(ev, id);
if (id != 0) {
- sendInput ("l", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState,
GDK_CROSSING_NORMAL]);
+ sendInput ("l", [realSurfaceWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState,
GDK_CROSSING_NORMAL]);
}
- realWindowWithMouse = 0;
- windowWithMouse = 0;
+ realSurfaceWithMouse = 0;
+ surfaceWithMouse = 0;
}
function doGrab(id, ownerEvents, implicit) {
var pos;
- if (windowWithMouse != id) {
- if (windowWithMouse != 0) {
- pos = getPositionsFromAbsCoord(lastX, lastY, windowWithMouse);
- sendInput ("l", [realWindowWithMouse, windowWithMouse, pos.rootX, pos.rootY, pos.winX, pos.winY,
lastState, GDK_CROSSING_GRAB]);
+ if (surfaceWithMouse != id) {
+ if (surfaceWithMouse != 0) {
+ pos = getPositionsFromAbsCoord(lastX, lastY, surfaceWithMouse);
+ sendInput ("l", [realSurfaceWithMouse, surfaceWithMouse, pos.rootX, pos.rootY, pos.winX,
pos.winY, lastState, GDK_CROSSING_GRAB]);
}
pos = getPositionsFromAbsCoord(lastX, lastY, id);
- sendInput ("e", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState,
GDK_CROSSING_GRAB]);
- windowWithMouse = id;
+ sendInput ("e", [realSurfaceWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState,
GDK_CROSSING_GRAB]);
+ surfaceWithMouse = id;
}
- grab.window = id;
+ grab.surface = id;
grab.ownerEvents = ownerEvents;
grab.implicit = implicit;
}
function doUngrab() {
var pos;
- if (realWindowWithMouse != windowWithMouse) {
- if (windowWithMouse != 0) {
- pos = getPositionsFromAbsCoord(lastX, lastY, windowWithMouse);
- sendInput ("l", [realWindowWithMouse, windowWithMouse, pos.rootX, pos.rootY, pos.winX, pos.winY,
lastState, GDK_CROSSING_UNGRAB]);
+ if (realSurfaceWithMouse != surfaceWithMouse) {
+ if (surfaceWithMouse != 0) {
+ pos = getPositionsFromAbsCoord(lastX, lastY, surfaceWithMouse);
+ sendInput ("l", [realSurfaceWithMouse, surfaceWithMouse, pos.rootX, pos.rootY, pos.winX,
pos.winY, lastState, GDK_CROSSING_UNGRAB]);
}
- if (realWindowWithMouse != 0) {
- pos = getPositionsFromAbsCoord(lastX, lastY, realWindowWithMouse);
- sendInput ("e", [realWindowWithMouse, realWindowWithMouse, pos.rootX, pos.rootY, pos.winX,
pos.winY, lastState, GDK_CROSSING_UNGRAB]);
+ if (realSurfaceWithMouse != 0) {
+ pos = getPositionsFromAbsCoord(lastX, lastY, realSurfaceWithMouse);
+ sendInput ("e", [realSurfaceWithMouse, realSurfaceWithMouse, pos.rootX, pos.rootY, pos.winX,
pos.winY, lastState, GDK_CROSSING_UNGRAB]);
}
- windowWithMouse = realWindowWithMouse;
+ surfaceWithMouse = realSurfaceWithMouse;
}
- grab.window = null;
+ grab.surface = null;
}
function onMouseDown (ev) {
@@ -1088,9 +1088,9 @@ function onMouseDown (ev) {
id = getEffectiveEventTarget (id);
var pos = getPositionsFromEvent(ev, id);
- if (grab.window == null)
+ if (grab.surface == null)
doGrab (id, false, true);
- sendInput ("b", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, button]);
+ sendInput ("b", [realSurfaceWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, button]);
return false;
}
@@ -1102,9 +1102,9 @@ function onMouseUp (ev) {
id = getEffectiveEventTarget (evId);
var pos = getPositionsFromEvent(ev, id);
- sendInput ("B", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, button]);
+ sendInput ("B", [realSurfaceWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, button]);
- if (grab.window != null && grab.implicit)
+ if (grab.surface != null && grab.implicit)
doUngrab();
return false;
@@ -2691,7 +2691,7 @@ function onMouseWheel(ev)
var dir = 0;
if (offset > 0)
dir = 1;
- sendInput ("s", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, dir]);
+ sendInput ("s", [realSurfaceWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState, dir]);
return cancelEvent(ev);
}
@@ -2714,13 +2714,13 @@ function onTouchStart(ev) {
firstTouchDownId = touch.identifier;
isEmulated = 1;
- if (realWindowWithMouse != origId || id != windowWithMouse) {
+ if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
if (id != 0) {
- sendInput ("l", [realWindowWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY,
lastState, GDK_CROSSING_NORMAL]);
+ sendInput ("l", [realSurfaceWithMouse, id, pos.rootX, pos.rootY, pos.winX, pos.winY,
lastState, GDK_CROSSING_NORMAL]);
}
- windowWithMouse = id;
- realWindowWithMouse = origId;
+ surfaceWithMouse = id;
+ realSurfaceWithMouse = origId;
sendInput ("e", [origId, id, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState,
GDK_CROSSING_NORMAL]);
}
diff --git a/gdk/broadway/broadwayd.c b/gdk/broadway/broadwayd.c
index 4879bf4..e453af4 100644
--- a/gdk/broadway/broadwayd.c
+++ b/gdk/broadway/broadwayd.c
@@ -54,7 +54,7 @@ typedef struct {
GString *buffer;
GSource *source;
GSList *serial_mappings;
- GList *windows;
+ GList *surfaces;
guint disconnect_idle;
GList *fds;
GHashTable *textures;
@@ -69,7 +69,7 @@ close_fd (void *data)
static void
client_free (BroadwayClient *client)
{
- g_assert (client->windows == NULL);
+ g_assert (client->surfaces == NULL);
g_assert (client->disconnect_idle == 0);
clients = g_list_remove (clients, client);
g_object_unref (client->connection);
@@ -100,11 +100,11 @@ client_disconnected (BroadwayClient *client)
client->source = 0;
}
- for (l = client->windows; l != NULL; l = l->next)
- broadway_server_destroy_window (server,
- GPOINTER_TO_UINT (l->data));
- g_list_free (client->windows);
- client->windows = NULL;
+ for (l = client->surfaces; l != NULL; l = l->next)
+ broadway_server_destroy_surface (server,
+ GPOINTER_TO_UINT (l->data));
+ g_list_free (client->surfaces);
+ client->surfaces = NULL;
g_hash_table_iter_init (&iter, client->textures);
while (g_hash_table_iter_next (&iter, &key, &value))
@@ -329,7 +329,7 @@ static void
client_handle_request (BroadwayClient *client,
BroadwayRequest *request)
{
- BroadwayReplyNewWindow reply_new_window;
+ BroadwayReplyNewSurface reply_new_surface;
BroadwayReplySync reply_sync;
BroadwayReplyQueryMouse reply_query_mouse;
BroadwayReplyGrabPointer reply_grab_pointer;
@@ -342,20 +342,20 @@ client_handle_request (BroadwayClient *client,
switch (request->base.type)
{
- case BROADWAY_REQUEST_NEW_WINDOW:
- reply_new_window.id =
- broadway_server_new_window (server,
- request->new_window.x,
- request->new_window.y,
- request->new_window.width,
- request->new_window.height,
- request->new_window.is_temp);
- client->windows =
- g_list_prepend (client->windows,
- GUINT_TO_POINTER (reply_new_window.id));
-
- send_reply (client, request, (BroadwayReply *)&reply_new_window, sizeof (reply_new_window),
- BROADWAY_REPLY_NEW_WINDOW);
+ case BROADWAY_REQUEST_NEW_SURFACE:
+ reply_new_surface.id =
+ broadway_server_new_surface (server,
+ request->new_surface.x,
+ request->new_surface.y,
+ request->new_surface.width,
+ request->new_surface.height,
+ request->new_surface.is_temp);
+ client->surfaces =
+ g_list_prepend (client->surfaces,
+ GUINT_TO_POINTER (reply_new_surface.id));
+
+ send_reply (client, request, (BroadwayReply *)&reply_new_surface, sizeof (reply_new_surface),
+ BROADWAY_REPLY_NEW_SURFACE);
break;
case BROADWAY_REQUEST_FLUSH:
broadway_server_flush (server);
@@ -372,41 +372,41 @@ client_handle_request (BroadwayClient *client,
break;
case BROADWAY_REQUEST_QUERY_MOUSE:
broadway_server_query_mouse (server,
- &reply_query_mouse.toplevel,
+ &reply_query_mouse.surface,
&reply_query_mouse.root_x,
&reply_query_mouse.root_y,
&reply_query_mouse.mask);
send_reply (client, request, (BroadwayReply *)&reply_query_mouse, sizeof (reply_query_mouse),
BROADWAY_REPLY_QUERY_MOUSE);
break;
- case BROADWAY_REQUEST_DESTROY_WINDOW:
- client->windows =
- g_list_remove (client->windows,
- GUINT_TO_POINTER (request->destroy_window.id));
- broadway_server_destroy_window (server, request->destroy_window.id);
+ case BROADWAY_REQUEST_DESTROY_SURFACE:
+ client->surfaces =
+ g_list_remove (client->surfaces,
+ GUINT_TO_POINTER (request->destroy_surface.id));
+ broadway_server_destroy_surface (server, request->destroy_surface.id);
break;
- case BROADWAY_REQUEST_SHOW_WINDOW:
- broadway_server_window_show (server, request->show_window.id);
+ case BROADWAY_REQUEST_SHOW_SURFACE:
+ broadway_server_surface_show (server, request->show_surface.id);
break;
- case BROADWAY_REQUEST_HIDE_WINDOW:
- broadway_server_window_hide (server, request->hide_window.id);
+ case BROADWAY_REQUEST_HIDE_SURFACE:
+ broadway_server_surface_hide (server, request->hide_surface.id);
break;
case BROADWAY_REQUEST_SET_TRANSIENT_FOR:
- broadway_server_window_set_transient_for (server,
- request->set_transient_for.id,
- request->set_transient_for.parent);
+ broadway_server_surface_set_transient_for (server,
+ request->set_transient_for.id,
+ request->set_transient_for.parent);
break;
case BROADWAY_REQUEST_SET_NODES:
{
gsize array_size = request->base.size - sizeof (BroadwayRequestSetNodes) + sizeof(guint32);
int n_data = array_size / sizeof(guint32);
- int pos = 0;
- BroadwayNode *node;
+ int pos = 0;
+ BroadwayNode *node;
- node = decode_nodes (client, n_data, request->set_nodes.data, &pos);
+ node = decode_nodes (client, n_data, request->set_nodes.data, &pos);
- broadway_server_window_set_nodes (server, request->set_nodes.id,
- node);
+ broadway_server_surface_set_nodes (server, request->set_nodes.id,
+ node);
}
break;
case BROADWAY_REQUEST_UPLOAD_TEXTURE:
@@ -466,13 +466,13 @@ client_handle_request (BroadwayClient *client,
break;
case BROADWAY_REQUEST_MOVE_RESIZE:
- broadway_server_window_move_resize (server,
- request->move_resize.id,
- request->move_resize.with_move,
- request->move_resize.x,
- request->move_resize.y,
- request->move_resize.width,
- request->move_resize.height);
+ broadway_server_surface_move_resize (server,
+ request->move_resize.id,
+ request->move_resize.with_move,
+ request->move_resize.x,
+ request->move_resize.y,
+ request->move_resize.width,
+ request->move_resize.height);
break;
case BROADWAY_REQUEST_GRAB_POINTER:
reply_grab_pointer.status =
@@ -492,8 +492,8 @@ client_handle_request (BroadwayClient *client,
send_reply (client, request, (BroadwayReply *)&reply_ungrab_pointer, sizeof (reply_ungrab_pointer),
BROADWAY_REPLY_UNGRAB_POINTER);
break;
- case BROADWAY_REQUEST_FOCUS_WINDOW:
- broadway_server_focus_window (server, request->focus_window.id);
+ case BROADWAY_REQUEST_FOCUS_SURFACE:
+ broadway_server_focus_surface (server, request->focus_surface.id);
break;
case BROADWAY_REQUEST_SET_SHOW_KEYBOARD:
broadway_server_set_show_keyboard (server, request->set_show_keyboard.show_keyboard);
diff --git a/gdk/broadway/gdkbroadway-server.c b/gdk/broadway/gdkbroadway-server.c
index fa24e08..87c1bb7 100644
--- a/gdk/broadway/gdkbroadway-server.c
+++ b/gdk/broadway/gdkbroadway-server.c
@@ -83,9 +83,8 @@ gdk_broadway_server_class_init (GdkBroadwayServerClass * class)
gboolean
_gdk_broadway_server_lookahead_event (GdkBroadwayServer *server,
- const char *types)
+ const char *types)
{
-
return FALSE;
}
@@ -245,7 +244,7 @@ parse_all_input (GdkBroadwayServer *server)
{
memcpy (&size, p, sizeof (guint32));
if (p + size > end)
- break;
+ break;
reply = g_memdup (p, size);
p += size;
@@ -268,8 +267,8 @@ read_some_input_blocking (GdkBroadwayServer *server)
g_assert (server->recv_buffer_size < sizeof (server->recv_buffer));
res = g_input_stream_read (in, &server->recv_buffer[server->recv_buffer_size],
- sizeof (server->recv_buffer) - server->recv_buffer_size,
- NULL, NULL);
+ sizeof (server->recv_buffer) - server->recv_buffer_size,
+ NULL, NULL);
if (res <= 0)
{
@@ -294,8 +293,8 @@ read_some_input_nonblocking (GdkBroadwayServer *server)
g_assert (server->recv_buffer_size < sizeof (server->recv_buffer));
error = NULL;
res = g_pollable_input_stream_read_nonblocking (pollable, &server->recv_buffer[server->recv_buffer_size],
- sizeof (server->recv_buffer) - server->recv_buffer_size,
- NULL, &error);
+ sizeof (server->recv_buffer) - server->recv_buffer_size,
+ NULL, &error);
if (res < 0 && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WOULD_BLOCK))
{
@@ -321,7 +320,7 @@ find_response_by_serial (GdkBroadwayServer *server, guint32 serial)
BroadwayReply *reply = l->data;
if (reply->base.in_reply_to == serial)
- return reply;
+ return reply;
}
return NULL;
@@ -342,13 +341,13 @@ process_input_messages (GdkBroadwayServer *server)
{
reply = server->incomming->data;
server->incomming =
- g_list_delete_link (server->incomming,
- server->incomming);
+ g_list_delete_link (server->incomming,
+ server->incomming);
if (reply->base.type == BROADWAY_REPLY_EVENT)
- _gdk_broadway_events_got_input (&reply->event.msg);
+ _gdk_broadway_events_got_input (&reply->event.msg);
else
- g_warning ("Unhandled reply type %d", reply->base.type);
+ g_warning ("Unhandled reply type %d", reply->base.type);
g_free (reply);
}
}
@@ -384,7 +383,7 @@ input_available_cb (gpointer stream, gpointer user_data)
static BroadwayReply *
gdk_broadway_server_wait_for_reply (GdkBroadwayServer *server,
- guint32 serial)
+ guint32 serial)
{
BroadwayReply *reply;
@@ -392,10 +391,10 @@ gdk_broadway_server_wait_for_reply (GdkBroadwayServer *server,
{
reply = find_response_by_serial (server, serial);
if (reply)
- {
- server->incomming = g_list_remove (server->incomming, reply);
- break;
- }
+ {
+ server->incomming = g_list_remove (server->incomming, reply);
+ break;
+ }
read_some_input_blocking (server);
parse_all_input (server);
@@ -410,7 +409,7 @@ _gdk_broadway_server_flush (GdkBroadwayServer *server)
{
BroadwayRequestFlush msg;
- gdk_broadway_server_send_message(server, msg, BROADWAY_REQUEST_FLUSH);
+ gdk_broadway_server_send_message (server, msg, BROADWAY_REQUEST_FLUSH);
}
void
@@ -446,42 +445,42 @@ _gdk_broadway_server_roundtrip (GdkBroadwayServer *server,
void
_gdk_broadway_server_query_mouse (GdkBroadwayServer *server,
- guint32 *toplevel,
- gint32 *root_x,
- gint32 *root_y,
- guint32 *mask)
+ guint32 *surface,
+ gint32 *root_x,
+ gint32 *root_y,
+ guint32 *mask)
{
BroadwayRequestQueryMouse msg;
guint32 serial;
BroadwayReply *reply;
serial = gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_QUERY_MOUSE);
+ BROADWAY_REQUEST_QUERY_MOUSE);
reply = gdk_broadway_server_wait_for_reply (server, serial);
g_assert (reply->base.type == BROADWAY_REPLY_QUERY_MOUSE);
- if (toplevel)
- *toplevel = reply->query_mouse.toplevel;
+ if (surface)
+ *surface = reply->query_mouse.surface;
if (root_x)
*root_x = reply->query_mouse.root_x;
if (root_y)
*root_y = reply->query_mouse.root_y;
if (mask)
*mask = reply->query_mouse.mask;
-
+
g_free (reply);
}
guint32
-_gdk_broadway_server_new_window (GdkBroadwayServer *server,
- int x,
- int y,
- int width,
- int height,
- gboolean is_temp)
-{
- BroadwayRequestNewWindow msg;
+_gdk_broadway_server_new_surface (GdkBroadwayServer *server,
+ int x,
+ int y,
+ int width,
+ int height,
+ gboolean is_temp)
+{
+ BroadwayRequestNewSurface msg;
guint32 serial, id;
BroadwayReply *reply;
@@ -490,78 +489,77 @@ _gdk_broadway_server_new_window (GdkBroadwayServer *server,
msg.width = width;
msg.height = height;
msg.is_temp = is_temp;
-
serial = gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_NEW_WINDOW);
+ BROADWAY_REQUEST_NEW_SURFACE);
reply = gdk_broadway_server_wait_for_reply (server, serial);
- g_assert (reply->base.type == BROADWAY_REPLY_NEW_WINDOW);
+ g_assert (reply->base.type == BROADWAY_REPLY_NEW_SURFACE);
+
+ id = reply->new_surface.id;
- id = reply->new_window.id;
-
g_free (reply);
return id;
}
void
-_gdk_broadway_server_destroy_window (GdkBroadwayServer *server,
- gint id)
+_gdk_broadway_server_destroy_surface (GdkBroadwayServer *server,
+ gint id)
{
- BroadwayRequestDestroyWindow msg;
+ BroadwayRequestDestroySurface msg;
msg.id = id;
gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_DESTROY_WINDOW);
+ BROADWAY_REQUEST_DESTROY_SURFACE);
}
gboolean
-_gdk_broadway_server_window_show (GdkBroadwayServer *server,
- gint id)
+_gdk_broadway_server_surface_show (GdkBroadwayServer *server,
+ gint id)
{
- BroadwayRequestShowWindow msg;
+ BroadwayRequestShowSurface msg;
msg.id = id;
gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_SHOW_WINDOW);
-
+ BROADWAY_REQUEST_SHOW_SURFACE);
+
return TRUE;
}
gboolean
-_gdk_broadway_server_window_hide (GdkBroadwayServer *server,
- gint id)
+_gdk_broadway_server_surface_hide (GdkBroadwayServer *server,
+ gint id)
{
- BroadwayRequestHideWindow msg;
+ BroadwayRequestHideSurface msg;
msg.id = id;
gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_HIDE_WINDOW);
-
+ BROADWAY_REQUEST_HIDE_SURFACE);
+
return TRUE;
}
void
-_gdk_broadway_server_window_focus (GdkBroadwayServer *server,
- gint id)
+_gdk_broadway_server_surface_focus (GdkBroadwayServer *server,
+ gint id)
{
- BroadwayRequestFocusWindow msg;
+ BroadwayRequestFocusSurface msg;
msg.id = id;
gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_FOCUS_WINDOW);
+ BROADWAY_REQUEST_FOCUS_SURFACE);
}
void
-_gdk_broadway_server_window_set_transient_for (GdkBroadwayServer *server,
- gint id, gint parent)
+_gdk_broadway_server_surface_set_transient_for (GdkBroadwayServer *server,
+ gint id, gint parent)
{
BroadwayRequestSetTransientFor msg;
msg.id = id;
msg.parent = parent;
gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_SET_TRANSIENT_FOR);
+ BROADWAY_REQUEST_SET_TRANSIENT_FOR);
}
static int
@@ -680,7 +678,7 @@ gdk_broadway_server_release_texture (GdkBroadwayServer *server,
}
void
-gdk_broadway_server_window_set_nodes (GdkBroadwayServer *server,
+gdk_broadway_server_surface_set_nodes (GdkBroadwayServer *server,
guint32 id,
GArray *nodes)
{
@@ -696,13 +694,13 @@ gdk_broadway_server_window_set_nodes (GdkBroadwayServer *server,
}
gboolean
-_gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
- gint id,
- gboolean with_move,
- int x,
- int y,
- int width,
- int height)
+_gdk_broadway_server_surface_move_resize (GdkBroadwayServer *server,
+ gint id,
+ gboolean with_move,
+ int x,
+ int y,
+ int width,
+ int height)
{
BroadwayRequestMoveResize msg;
@@ -714,17 +712,17 @@ _gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
msg.height = height;
gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_MOVE_RESIZE);
+ BROADWAY_REQUEST_MOVE_RESIZE);
return TRUE;
}
GdkGrabStatus
_gdk_broadway_server_grab_pointer (GdkBroadwayServer *server,
- gint id,
- gboolean owner_events,
- guint32 event_mask,
- guint32 time_)
+ gint id,
+ gboolean owner_events,
+ guint32 event_mask,
+ guint32 time_)
{
BroadwayRequestGrabPointer msg;
guint32 serial, status;
@@ -736,7 +734,7 @@ _gdk_broadway_server_grab_pointer (GdkBroadwayServer *server,
msg.time_ = time_;
serial = gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_GRAB_POINTER);
+ BROADWAY_REQUEST_GRAB_POINTER);
reply = gdk_broadway_server_wait_for_reply (server, serial);
g_assert (reply->base.type == BROADWAY_REPLY_GRAB_POINTER);
@@ -750,7 +748,7 @@ _gdk_broadway_server_grab_pointer (GdkBroadwayServer *server,
guint32
_gdk_broadway_server_ungrab_pointer (GdkBroadwayServer *server,
- guint32 time_)
+ guint32 time_)
{
BroadwayRequestUngrabPointer msg;
guint32 serial, status;
@@ -759,7 +757,7 @@ _gdk_broadway_server_ungrab_pointer (GdkBroadwayServer *server,
msg.time_ = time_;
serial = gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_UNGRAB_POINTER);
+ BROADWAY_REQUEST_UNGRAB_POINTER);
reply = gdk_broadway_server_wait_for_reply (server, serial);
g_assert (reply->base.type == BROADWAY_REPLY_UNGRAB_POINTER);
@@ -779,5 +777,5 @@ _gdk_broadway_server_set_show_keyboard (GdkBroadwayServer *server,
msg.show_keyboard = show;
gdk_broadway_server_send_message (server, msg,
- BROADWAY_REQUEST_SET_SHOW_KEYBOARD);
+ BROADWAY_REQUEST_SET_SHOW_KEYBOARD);
}
diff --git a/gdk/broadway/gdkbroadway-server.h b/gdk/broadway/gdkbroadway-server.h
index aec5669..537c8a1 100644
--- a/gdk/broadway/gdkbroadway-server.h
+++ b/gdk/broadway/gdkbroadway-server.h
@@ -26,7 +26,7 @@ guint32 _gdk_broadway_server_get_last_seen_time (GdkBroadwaySer
gboolean _gdk_broadway_server_lookahead_event (GdkBroadwayServer *server,
const char *types);
void _gdk_broadway_server_query_mouse (GdkBroadwayServer *server,
- guint32 *toplevel,
+ guint32 *surface,
gint32 *root_x,
gint32 *root_y,
guint32 *mask);
@@ -37,27 +37,27 @@ GdkGrabStatus _gdk_broadway_server_grab_pointer (GdkBroadwaySer
guint32 time_);
guint32 _gdk_broadway_server_ungrab_pointer (GdkBroadwayServer *server,
guint32 time_);
-gint32 _gdk_broadway_server_get_mouse_toplevel (GdkBroadwayServer *server);
-guint32 _gdk_broadway_server_new_window (GdkBroadwayServer *server,
+gint32 _gdk_broadway_server_get_mouse_surface (GdkBroadwayServer *server);
+guint32 _gdk_broadway_server_new_surface (GdkBroadwayServer *server,
int x,
int y,
int width,
int height,
gboolean is_temp);
-void _gdk_broadway_server_destroy_window (GdkBroadwayServer *server,
+void _gdk_broadway_server_destroy_surface (GdkBroadwayServer *server,
gint id);
-gboolean _gdk_broadway_server_window_show (GdkBroadwayServer *server,
+gboolean _gdk_broadway_server_surface_show (GdkBroadwayServer *server,
gint id);
-gboolean _gdk_broadway_server_window_hide (GdkBroadwayServer *server,
+gboolean _gdk_broadway_server_surface_hide (GdkBroadwayServer *server,
gint id);
-void _gdk_broadway_server_window_focus (GdkBroadwayServer *server,
+void _gdk_broadway_server_surface_focus (GdkBroadwayServer *server,
gint id);
-void _gdk_broadway_server_window_set_transient_for (GdkBroadwayServer *server,
+void _gdk_broadway_server_surface_set_transient_for (GdkBroadwayServer *server,
gint id,
gint parent);
void _gdk_broadway_server_set_show_keyboard (GdkBroadwayServer *server,
gboolean show_keyboard);
-gboolean _gdk_broadway_server_window_translate (GdkBroadwayServer *server,
+gboolean _gdk_broadway_server_surface_translate (GdkBroadwayServer *server,
gint id,
cairo_region_t *area,
gint dx,
@@ -66,10 +66,10 @@ guint32 gdk_broadway_server_upload_texture (GdkBroadwaySer
GdkTexture *texture);
void gdk_broadway_server_release_texture (GdkBroadwayServer *server,
guint32 id);
-void gdk_broadway_server_window_set_nodes (GdkBroadwayServer *server,
+void gdk_broadway_server_surface_set_nodes (GdkBroadwayServer *server,
guint32 id,
GArray *nodes);
-gboolean _gdk_broadway_server_window_move_resize (GdkBroadwayServer *server,
+gboolean _gdk_broadway_server_surface_move_resize (GdkBroadwayServer *server,
gint id,
gboolean with_move,
int x,
diff --git a/gdk/broadway/gdkeventsource.c b/gdk/broadway/gdkeventsource.c
index dbc9043..14897d6 100644
--- a/gdk/broadway/gdkeventsource.c
+++ b/gdk/broadway/gdkeventsource.c
@@ -33,7 +33,7 @@ static gboolean gdk_event_source_dispatch (GSource *source,
gpointer user_data);
static void gdk_event_source_finalize (GSource *source);
-#define HAS_FOCUS(toplevel) \
+#define HAS_FOCUS(toplevel) \
((toplevel)->has_focus || (toplevel)->has_pointer_focus)
struct _GdkEventSource
@@ -121,118 +121,118 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
switch (message->base.type) {
case BROADWAY_EVENT_ENTER:
- window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_window_id));
+ window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_surface_id));
if (window)
{
- event = gdk_event_new (GDK_ENTER_NOTIFY);
- event->crossing.window = g_object_ref (window);
- event->crossing.time = message->base.time;
- event->crossing.x = message->pointer.win_x;
- event->crossing.y = message->pointer.win_y;
- event->crossing.x_root = message->pointer.root_x;
- event->crossing.y_root = message->pointer.root_y;
- event->crossing.state = message->pointer.state;
- event->crossing.mode = message->crossing.mode;
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- gdk_event_set_device (event, gdk_seat_get_pointer (seat));
- gdk_event_set_seat (event, seat);
-
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ event = gdk_event_new (GDK_ENTER_NOTIFY);
+ event->crossing.window = g_object_ref (window);
+ event->crossing.time = message->base.time;
+ event->crossing.x = message->pointer.win_x;
+ event->crossing.y = message->pointer.win_y;
+ event->crossing.x_root = message->pointer.root_x;
+ event->crossing.y_root = message->pointer.root_y;
+ event->crossing.state = message->pointer.state;
+ event->crossing.mode = message->crossing.mode;
+ event->crossing.detail = GDK_NOTIFY_ANCESTOR;
+ gdk_event_set_device (event, gdk_seat_get_pointer (seat));
+ gdk_event_set_seat (event, seat);
+
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case BROADWAY_EVENT_LEAVE:
- window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_window_id));
+ window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_surface_id));
if (window)
{
- event = gdk_event_new (GDK_LEAVE_NOTIFY);
- event->crossing.window = g_object_ref (window);
- event->crossing.time = message->base.time;
- event->crossing.x = message->pointer.win_x;
- event->crossing.y = message->pointer.win_y;
- event->crossing.x_root = message->pointer.root_x;
- event->crossing.y_root = message->pointer.root_y;
- event->crossing.state = message->pointer.state;
- event->crossing.mode = message->crossing.mode;
- event->crossing.detail = GDK_NOTIFY_ANCESTOR;
- gdk_event_set_device (event, gdk_seat_get_pointer (seat));
- gdk_event_set_seat (event, seat);
-
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ event = gdk_event_new (GDK_LEAVE_NOTIFY);
+ event->crossing.window = g_object_ref (window);
+ event->crossing.time = message->base.time;
+ event->crossing.x = message->pointer.win_x;
+ event->crossing.y = message->pointer.win_y;
+ event->crossing.x_root = message->pointer.root_x;
+ event->crossing.y_root = message->pointer.root_y;
+ event->crossing.state = message->pointer.state;
+ event->crossing.mode = message->crossing.mode;
+ event->crossing.detail = GDK_NOTIFY_ANCESTOR;
+ gdk_event_set_device (event, gdk_seat_get_pointer (seat));
+ gdk_event_set_seat (event, seat);
+
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case BROADWAY_EVENT_POINTER_MOVE:
if (_gdk_broadway_moveresize_handle_event (display, message))
break;
- window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_window_id));
+ window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_surface_id));
if (window)
{
- event = gdk_event_new (GDK_MOTION_NOTIFY);
- event->motion.window = g_object_ref (window);
- event->motion.time = message->base.time;
- event->motion.x = message->pointer.win_x;
- event->motion.y = message->pointer.win_y;
- event->motion.x_root = message->pointer.root_x;
- event->motion.y_root = message->pointer.root_y;
- event->motion.state = message->pointer.state;
- gdk_event_set_device (event, gdk_seat_get_pointer (seat));
- gdk_event_set_seat (event, seat);
-
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ event = gdk_event_new (GDK_MOTION_NOTIFY);
+ event->motion.window = g_object_ref (window);
+ event->motion.time = message->base.time;
+ event->motion.x = message->pointer.win_x;
+ event->motion.y = message->pointer.win_y;
+ event->motion.x_root = message->pointer.root_x;
+ event->motion.y_root = message->pointer.root_y;
+ event->motion.state = message->pointer.state;
+ gdk_event_set_device (event, gdk_seat_get_pointer (seat));
+ gdk_event_set_seat (event, seat);
+
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case BROADWAY_EVENT_BUTTON_PRESS:
case BROADWAY_EVENT_BUTTON_RELEASE:
if (message->base.type != 'b' &&
- _gdk_broadway_moveresize_handle_event (display, message))
+ _gdk_broadway_moveresize_handle_event (display, message))
break;
- window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_window_id));
+ window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_surface_id));
if (window)
{
- event = gdk_event_new (message->base.type == 'b' ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
- event->button.window = g_object_ref (window);
- event->button.time = message->base.time;
- event->button.x = message->pointer.win_x;
- event->button.y = message->pointer.win_y;
- event->button.x_root = message->pointer.root_x;
- event->button.y_root = message->pointer.root_y;
- event->button.button = message->button.button;
- event->button.state = message->pointer.state;
- gdk_event_set_device (event, gdk_seat_get_pointer (seat));
- gdk_event_set_seat (event, seat);
-
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ event = gdk_event_new (message->base.type == 'b' ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE);
+ event->button.window = g_object_ref (window);
+ event->button.time = message->base.time;
+ event->button.x = message->pointer.win_x;
+ event->button.y = message->pointer.win_y;
+ event->button.x_root = message->pointer.root_x;
+ event->button.y_root = message->pointer.root_y;
+ event->button.button = message->button.button;
+ event->button.state = message->pointer.state;
+ gdk_event_set_device (event, gdk_seat_get_pointer (seat));
+ gdk_event_set_seat (event, seat);
+
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case BROADWAY_EVENT_SCROLL:
- window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_window_id));
+ window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->pointer.event_surface_id));
if (window)
{
- event = gdk_event_new (GDK_SCROLL);
- event->scroll.window = g_object_ref (window);
- event->scroll.time = message->base.time;
- event->scroll.x = message->pointer.win_x;
- event->scroll.y = message->pointer.win_y;
- event->scroll.x_root = message->pointer.root_x;
- event->scroll.y_root = message->pointer.root_y;
- event->scroll.direction = message->scroll.dir == 0 ? GDK_SCROLL_UP : GDK_SCROLL_DOWN;
- gdk_event_set_device (event, gdk_seat_get_pointer (seat));
- gdk_event_set_seat (event, seat);
-
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ event = gdk_event_new (GDK_SCROLL);
+ event->scroll.window = g_object_ref (window);
+ event->scroll.time = message->base.time;
+ event->scroll.x = message->pointer.win_x;
+ event->scroll.y = message->pointer.win_y;
+ event->scroll.x_root = message->pointer.root_x;
+ event->scroll.y_root = message->pointer.root_y;
+ event->scroll.direction = message->scroll.dir == 0 ? GDK_SCROLL_UP : GDK_SCROLL_DOWN;
+ gdk_event_set_device (event, gdk_seat_get_pointer (seat));
+ gdk_event_set_seat (event, seat);
+
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case BROADWAY_EVENT_TOUCH:
- window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->touch.event_window_id));
+ window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER
(message->touch.event_surface_id));
if (window)
{
GdkEventType event_type = 0;
@@ -255,18 +255,18 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
message->touch.is_emulated && _gdk_broadway_moveresize_handle_event (display, message))
break;
- event = gdk_event_new (event_type);
- event->touch.window = g_object_ref (window);
- event->touch.sequence = GUINT_TO_POINTER(message->touch.sequence_id);
- event->touch.emulating_pointer = message->touch.is_emulated;
- event->touch.time = message->base.time;
- event->touch.x = message->touch.win_x;
- event->touch.y = message->touch.win_y;
- event->touch.x_root = message->touch.root_x;
- event->touch.y_root = message->touch.root_y;
- event->touch.state = message->touch.state;
-
- gdk_event_set_device (event, gdk_seat_get_pointer (seat));
+ event = gdk_event_new (event_type);
+ event->touch.window = g_object_ref (window);
+ event->touch.sequence = GUINT_TO_POINTER(message->touch.sequence_id);
+ event->touch.emulating_pointer = message->touch.is_emulated;
+ event->touch.time = message->base.time;
+ event->touch.x = message->touch.win_x;
+ event->touch.y = message->touch.win_y;
+ event->touch.x_root = message->touch.root_x;
+ event->touch.y_root = message->touch.root_y;
+ event->touch.state = message->touch.state;
+
+ gdk_event_set_device (event, gdk_seat_get_pointer (seat));
{
GList *devices;
devices = gdk_seat_get_slaves (seat, GDK_SEAT_CAPABILITY_TOUCH);
@@ -274,7 +274,7 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
gdk_event_set_source_device (event, GDK_DEVICE (devices->data));
g_list_free (devices);
}
- gdk_event_set_seat (event, seat);
+ gdk_event_set_seat (event, seat);
if (message->touch.is_emulated)
gdk_event_set_pointer_emulated (event, TRUE);
@@ -282,30 +282,30 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
if (event_type == GDK_TOUCH_BEGIN || event_type == GDK_TOUCH_UPDATE)
event->touch.state |= GDK_BUTTON1_MASK;
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
case BROADWAY_EVENT_KEY_PRESS:
case BROADWAY_EVENT_KEY_RELEASE:
window = g_hash_table_lookup (display_broadway->id_ht,
- GINT_TO_POINTER (message->key.window_id));
+ GINT_TO_POINTER (message->key.surface_id));
if (window)
{
- event = gdk_event_new (message->base.type == 'k' ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
- event->key.window = g_object_ref (window);
- event->key.time = message->base.time;
- event->key.keyval = message->key.key;
- event->key.state = message->key.state;
- event->key.hardware_keycode = message->key.key;
+ event = gdk_event_new (message->base.type == 'k' ? GDK_KEY_PRESS : GDK_KEY_RELEASE);
+ event->key.window = g_object_ref (window);
+ event->key.time = message->base.time;
+ event->key.keyval = message->key.key;
+ event->key.state = message->key.state;
+ event->key.hardware_keycode = message->key.key;
gdk_event_set_scancode (event, message->key.key);
- event->key.length = 0;
- gdk_event_set_device (event, gdk_seat_get_keyboard (seat));
- gdk_event_set_seat (event, seat);
+ event->key.length = 0;
+ gdk_event_set_device (event, gdk_seat_get_keyboard (seat));
+ gdk_event_set_seat (event, seat);
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
@@ -318,26 +318,26 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (window)
{
- window->x = message->configure_notify.x;
- window->y = message->configure_notify.y;
-
- event = gdk_event_new (GDK_CONFIGURE);
- event->configure.window = g_object_ref (window);
- event->configure.x = message->configure_notify.x;
- event->configure.y = message->configure_notify.y;
- event->configure.width = message->configure_notify.width;
- event->configure.height = message->configure_notify.height;
-
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
-
- if (window->resize_count >= 1)
- {
- window->resize_count -= 1;
-
- if (window->resize_count == 0)
- _gdk_broadway_moveresize_configure_done (display, window);
- }
+ window->x = message->configure_notify.x;
+ window->y = message->configure_notify.y;
+
+ event = gdk_event_new (GDK_CONFIGURE);
+ event->configure.window = g_object_ref (window);
+ event->configure.x = message->configure_notify.x;
+ event->configure.y = message->configure_notify.y;
+ event->configure.width = message->configure_notify.width;
+ event->configure.height = message->configure_notify.height;
+
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
+
+ if (window->resize_count >= 1)
+ {
+ window->resize_count -= 1;
+
+ if (window->resize_count == 0)
+ _gdk_broadway_moveresize_configure_done (display, window);
+ }
}
break;
@@ -355,24 +355,24 @@ _gdk_broadway_events_got_input (BroadwayInputMsg *message)
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.old_id));
if (window)
{
- event = gdk_event_new (GDK_FOCUS_CHANGE);
- event->focus_change.window = g_object_ref (window);
- event->focus_change.in = FALSE;
- gdk_event_set_device (event, gdk_seat_get_pointer (seat));
- gdk_event_set_seat (event, seat);
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ event = gdk_event_new (GDK_FOCUS_CHANGE);
+ event->focus_change.window = g_object_ref (window);
+ event->focus_change.in = FALSE;
+ gdk_event_set_device (event, gdk_seat_get_pointer (seat));
+ gdk_event_set_seat (event, seat);
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->focus.new_id));
if (window)
{
- event = gdk_event_new (GDK_FOCUS_CHANGE);
- event->focus_change.window = g_object_ref (window);
- event->focus_change.in = TRUE;
- gdk_event_set_device (event, gdk_seat_get_pointer (seat));
- gdk_event_set_seat (event, seat);
- node = _gdk_event_queue_append (display, event);
- _gdk_windowing_got_event (display, node, event, message->base.serial);
+ event = gdk_event_new (GDK_FOCUS_CHANGE);
+ event->focus_change.window = g_object_ref (window);
+ event->focus_change.in = TRUE;
+ gdk_event_set_device (event, gdk_seat_get_pointer (seat));
+ gdk_event_set_seat (event, seat);
+ node = _gdk_event_queue_append (display, event);
+ _gdk_windowing_got_event (display, node, event, message->base.serial);
}
break;
@@ -428,7 +428,7 @@ _gdk_broadway_event_source_new (GdkDisplay *display)
source = g_source_new (&event_funcs, sizeof (GdkEventSource));
name = g_strdup_printf ("GDK Broadway Event source (%s)",
- gdk_display_get_name (display));
+ gdk_display_get_name (display));
g_source_set_name (source, name);
g_free (name);
event_source = (GdkEventSource *) source;
diff --git a/gdk/broadway/gdkwindow-broadway.c b/gdk/broadway/gdkwindow-broadway.c
index 947217c..1656c07 100644
--- a/gdk/broadway/gdkwindow-broadway.c
+++ b/gdk/broadway/gdkwindow-broadway.c
@@ -218,12 +218,12 @@ _gdk_broadway_display_create_window_impl (GdkDisplay *display,
impl = g_object_new (GDK_TYPE_WINDOW_IMPL_BROADWAY, NULL);
window->impl = (GdkWindowImpl *)impl;
- impl->id = _gdk_broadway_server_new_window (broadway_display->server,
- window->x,
- window->y,
- window->width,
- window->height,
- window->window_type == GDK_WINDOW_TEMP);
+ impl->id = _gdk_broadway_server_new_surface (broadway_display->server,
+ window->x,
+ window->y,
+ window->width,
+ window->height,
+ window->window_type == GDK_WINDOW_TEMP);
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), window);
impl->wrapper = window;
@@ -271,7 +271,7 @@ _gdk_broadway_window_destroy (GdkWindow *window,
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
g_hash_table_remove (broadway_display->id_ht, GINT_TO_POINTER (impl->id));
- _gdk_broadway_server_destroy_window (broadway_display->server, impl->id);
+ _gdk_broadway_server_destroy_surface (broadway_display->server, impl->id);
}
@@ -301,7 +301,7 @@ gdk_broadway_window_set_nodes (GdkWindow *window,
g_ptr_array_unref (impl->node_data_textures);
impl->node_data_textures = node_textures;
- gdk_broadway_server_window_set_nodes (broadway_display->server, impl->id, impl->node_data);
+ gdk_broadway_server_surface_set_nodes (broadway_display->server, impl->id, impl->node_data);
}
/* This function is called when the XWindow is really gone.
@@ -331,7 +331,7 @@ gdk_window_broadway_show (GdkWindow *window, gboolean already_mapped)
_gdk_make_event (GDK_WINDOW (window), GDK_MAP, NULL, FALSE);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
- if (_gdk_broadway_server_window_show (broadway_display->server, impl->id))
+ if (_gdk_broadway_server_surface_show (broadway_display->server, impl->id))
queue_flush (window);
}
@@ -356,7 +356,7 @@ gdk_window_broadway_hide (GdkWindow *window)
_gdk_broadway_window_grab_check_unmap (window,
_gdk_broadway_server_get_next_serial (broadway_display->server));
- if (_gdk_broadway_server_window_hide (broadway_display->server, impl->id))
+ if (_gdk_broadway_server_surface_hide (broadway_display->server, impl->id))
queue_flush (window);
_gdk_window_clear_update_area (window);
@@ -406,11 +406,11 @@ gdk_window_broadway_move_resize (GdkWindow *window,
}
}
- _gdk_broadway_server_window_move_resize (broadway_display->server,
- impl->id,
- with_move,
- x, y,
- window->width, window->height);
+ _gdk_broadway_server_surface_move_resize (broadway_display->server,
+ impl->id,
+ with_move,
+ x, y,
+ window->width, window->height);
queue_flush (window);
if (size_changed)
window->resize_count++;
@@ -449,8 +449,8 @@ gdk_broadway_window_focus (GdkWindow *window,
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
broadway_display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (window));
- _gdk_broadway_server_window_focus (broadway_display->server,
- impl->id);
+ _gdk_broadway_server_surface_focus (broadway_display->server,
+ impl->id);
}
static void
@@ -537,7 +537,7 @@ gdk_broadway_window_set_transient_for (GdkWindow *window,
impl->transient_for = parent_id;
display = GDK_BROADWAY_DISPLAY (gdk_window_get_display (impl->wrapper));
- _gdk_broadway_server_window_set_transient_for (display->server, impl->id, impl->transient_for);
+ _gdk_broadway_server_surface_set_transient_for (display->server, impl->id, impl->transient_for);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]