broadway: Use "surface" instead of window/toplevel for browser object

Als fixes indentation/tabs and removes some unused code.
This commit is contained in:
Alexander Larsson 2017-12-05 14:38:57 +01:00
parent e80ad0e0f9
commit d141bd4121
11 changed files with 874 additions and 935 deletions

View File

@ -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);

View File

@ -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__ */

View File

@ -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;

File diff suppressed because it is too large Load Diff

View File

@ -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__ */

View File

@ -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]);
}

View File

@ -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));
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_window, sizeof (reply_new_window),
BROADWAY_REPLY_NEW_WINDOW);
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);

View File

@ -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)
_gdk_broadway_server_new_surface (GdkBroadwayServer *server,
int x,
int y,
int width,
int height,
gboolean is_temp)
{
BroadwayRequestNewWindow msg;
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);
}

View File

@ -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,

View File

@ -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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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;
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));
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;
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;
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);
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 >= 1)
{
window->resize_count -= 1;
if (window->resize_count == 0)
_gdk_broadway_moveresize_configure_done (display, window);
}
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;

View File

@ -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