forked from AuroraMiddleware/gtk
Merge branch 'update-broadway' into 'master'
Update broadway See merge request GNOME/gtk!1521
This commit is contained in:
commit
9aa270f928
@ -200,8 +200,7 @@ 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)
|
||||
{
|
||||
write_header (output, BROADWAY_OP_NEW_SURFACE);
|
||||
append_uint16 (output, id);
|
||||
@ -209,7 +208,6 @@ broadway_output_new_surface(BroadwayOutput *output,
|
||||
append_uint16 (output, y);
|
||||
append_uint16 (output, w);
|
||||
append_uint16 (output, h);
|
||||
append_bool (output, is_temp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -30,8 +30,7 @@ void broadway_output_new_surface (BroadwayOutput *output,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h,
|
||||
gboolean is_temp);
|
||||
int h);
|
||||
void broadway_output_disconnected (BroadwayOutput *output);
|
||||
void broadway_output_show_surface (BroadwayOutput *output,
|
||||
int id);
|
||||
|
@ -165,6 +165,7 @@ typedef struct {
|
||||
BroadwayInputBaseMsg base;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guint32 scale;
|
||||
} BroadwayInputScreenResizeNotify;
|
||||
|
||||
typedef struct {
|
||||
@ -275,7 +276,6 @@ typedef struct {
|
||||
gint32 y;
|
||||
guint32 width;
|
||||
guint32 height;
|
||||
guint32 is_temp;
|
||||
} BroadwayRequestNewSurface;
|
||||
|
||||
typedef struct {
|
||||
|
@ -67,8 +67,7 @@ struct _BroadwayServer {
|
||||
guint32 next_texture_id;
|
||||
GHashTable *textures;
|
||||
|
||||
guint32 screen_width;
|
||||
guint32 screen_height;
|
||||
guint32 screen_scale;
|
||||
|
||||
gint32 mouse_in_surface_id;
|
||||
int last_x, last_y; /* in root coords */
|
||||
@ -121,7 +120,6 @@ struct BroadwaySurface {
|
||||
gint32 y;
|
||||
gint32 width;
|
||||
gint32 height;
|
||||
gboolean is_temp;
|
||||
gboolean visible;
|
||||
gint32 transient_for;
|
||||
guint32 texture;
|
||||
@ -273,6 +271,7 @@ broadway_server_init (BroadwayServer *server)
|
||||
root->visible = TRUE;
|
||||
|
||||
server->root = root;
|
||||
server->screen_scale = 1;
|
||||
|
||||
g_hash_table_insert (server->surface_id_hash,
|
||||
GINT_TO_POINTER (root->id),
|
||||
@ -428,6 +427,7 @@ update_event_state (BroadwayServer *server,
|
||||
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
|
||||
server->root->width = message->screen_resize_notify.width;
|
||||
server->root->height = message->screen_resize_notify.height;
|
||||
server->screen_scale = message->screen_resize_notify.scale;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -722,6 +722,7 @@ parse_input_message (BroadwayInput *input, const unsigned char *message)
|
||||
case BROADWAY_EVENT_SCREEN_SIZE_CHANGED:
|
||||
msg.screen_resize_notify.width = ntohl (*p++);
|
||||
msg.screen_resize_notify.height = ntohl (*p++);
|
||||
msg.screen_resize_notify.scale = ntohl (*p++);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -958,10 +959,12 @@ broadway_server_get_next_serial (BroadwayServer *server)
|
||||
void
|
||||
broadway_server_get_screen_size (BroadwayServer *server,
|
||||
guint32 *width,
|
||||
guint32 *height)
|
||||
guint32 *height,
|
||||
guint32 *scale)
|
||||
{
|
||||
*width = server->root->width;
|
||||
*height = server->root->height;
|
||||
*scale = server->screen_scale;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2070,8 +2073,7 @@ broadway_server_new_surface (BroadwayServer *server,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
gboolean is_temp)
|
||||
int height)
|
||||
{
|
||||
BroadwaySurface *surface;
|
||||
|
||||
@ -2080,15 +2082,8 @@ broadway_server_new_surface (BroadwayServer *server,
|
||||
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 */
|
||||
surface->x = 100;
|
||||
surface->y = 100;
|
||||
}
|
||||
surface->width = width;
|
||||
surface->height = height;
|
||||
surface->is_temp = is_temp;
|
||||
surface->node_lookup = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
|
||||
g_hash_table_insert (server->surface_id_hash,
|
||||
@ -2103,8 +2098,7 @@ broadway_server_new_surface (BroadwayServer *server,
|
||||
surface->x,
|
||||
surface->y,
|
||||
surface->width,
|
||||
surface->height,
|
||||
surface->is_temp);
|
||||
surface->height);
|
||||
else
|
||||
fake_configure_notify (server, surface);
|
||||
|
||||
@ -2144,8 +2138,7 @@ broadway_server_resync_surfaces (BroadwayServer *server)
|
||||
surface->x,
|
||||
surface->y,
|
||||
surface->width,
|
||||
surface->height,
|
||||
surface->is_temp);
|
||||
surface->height);
|
||||
}
|
||||
|
||||
/* Then do everything that may reference other surfaces */
|
||||
|
@ -64,7 +64,8 @@ void broadway_server_roundtrip (BroadwayServer *
|
||||
guint32 tag);
|
||||
void broadway_server_get_screen_size (BroadwayServer *server,
|
||||
guint32 *width,
|
||||
guint32 *height);
|
||||
guint32 *height,
|
||||
guint32 *scale);
|
||||
guint32 broadway_server_get_next_serial (BroadwayServer *server);
|
||||
guint32 broadway_server_get_last_seen_time (BroadwayServer *server);
|
||||
gboolean broadway_server_lookahead_event (BroadwayServer *server,
|
||||
@ -90,8 +91,7 @@ guint32 broadway_server_new_surface (BroadwayServer *
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
gboolean is_temp);
|
||||
int height);
|
||||
void broadway_server_destroy_surface (BroadwayServer *server,
|
||||
gint id);
|
||||
gboolean broadway_server_surface_show (BroadwayServer *server,
|
||||
|
@ -274,6 +274,7 @@ function Texture(id, data) {
|
||||
var image = new Image();
|
||||
image.src = this.url;
|
||||
this.image = image;
|
||||
this.decoded = image.decode();
|
||||
textures[id] = this;
|
||||
}
|
||||
|
||||
@ -297,10 +298,9 @@ function sendConfigureNotify(surface)
|
||||
sendInput(BROADWAY_EVENT_CONFIGURE_NOTIFY, [surface.id, surface.x, surface.y, surface.width, surface.height]);
|
||||
}
|
||||
|
||||
function cmdCreateSurface(id, x, y, width, height, isTemp)
|
||||
function cmdCreateSurface(id, x, y, width, height)
|
||||
{
|
||||
var surface = { id: id, x: x, y:y, width: width, height: height, isTemp: isTemp };
|
||||
surface.positioned = isTemp;
|
||||
var surface = { id: id, x: x, y:y, width: width, height: height };
|
||||
surface.transientParent = 0;
|
||||
surface.visible = false;
|
||||
surface.imageData = null;
|
||||
@ -997,12 +997,13 @@ function handleDisplayCommands(display_commands)
|
||||
case DISPLAY_OP_CHANGE_TEXTURE:
|
||||
var image = cmd[1];
|
||||
var texture = cmd[2];
|
||||
// We need a new closure here to have a separate copy of "template" for each iteration...
|
||||
function a_block(t) {
|
||||
// We need a new closure here to have a separate copy of "texture" for each iteration in the onload callback...
|
||||
var block = function(t) {
|
||||
image.src = t.url;
|
||||
// Unref blob url when loaded
|
||||
image.onload = function() { t.unref(); };
|
||||
}(texture);
|
||||
};
|
||||
block(texture);
|
||||
break;
|
||||
case DISPLAY_OP_CHANGE_TRANSFORM:
|
||||
var div = cmd[1];
|
||||
@ -1037,8 +1038,7 @@ function handleCommands(cmd, display_commands, new_textures, modified_trees)
|
||||
y = cmd.get_16s();
|
||||
w = cmd.get_16();
|
||||
h = cmd.get_16();
|
||||
var isTemp = cmd.get_bool();
|
||||
var div = cmdCreateSurface(id, x, y, w, h, isTemp);
|
||||
var div = cmdCreateSurface(id, x, y, w, h);
|
||||
display_commands.push([DISPLAY_OP_APPEND_ROOT, div]);
|
||||
need_restack = true;
|
||||
break;
|
||||
@ -1059,6 +1059,7 @@ function handleCommands(cmd, display_commands, new_textures, modified_trees)
|
||||
doUngrab();
|
||||
surface = surfaces[id];
|
||||
if (surface.visible) {
|
||||
surface.visible = false;
|
||||
display_commands.push([DISPLAY_OP_HIDE_SURFACE, surface.div]);
|
||||
}
|
||||
break;
|
||||
@ -1106,14 +1107,13 @@ function handleCommands(cmd, display_commands, new_textures, modified_trees)
|
||||
var has_size = ops & 2;
|
||||
surface = surfaces[id];
|
||||
if (has_pos) {
|
||||
surface.positioned = true;
|
||||
surface.x = cmd.get_16s();;
|
||||
surface.y = cmd.get_16s();;
|
||||
surface.x = cmd.get_16s();
|
||||
surface.y = cmd.get_16s();
|
||||
display_commands.push([DISPLAY_OP_MOVE_NODE, surface.div, surface.x, surface.y]);
|
||||
}
|
||||
if (has_size) {
|
||||
surface.width = cmd.get_16();
|
||||
surface.height = cmd.get_16();;
|
||||
surface.height = cmd.get_16();
|
||||
display_commands.push([DISPLAY_OP_RESIZE_NODE, surface.div, surface.width, surface.height]);
|
||||
|
||||
}
|
||||
@ -1236,16 +1236,14 @@ function handleOutstanding()
|
||||
outstandingDisplayCommands = display_commands;
|
||||
|
||||
if (new_textures.length > 0) {
|
||||
var n_textures = new_textures.length;
|
||||
var decodes = [];
|
||||
for (var i = 0; i < new_textures.length; i++) {
|
||||
var t = new_textures[i];
|
||||
t.image.onload = function() {
|
||||
n_textures -= 1;
|
||||
if (n_textures == 0) {
|
||||
handleOutstandingDisplayCommands();
|
||||
}
|
||||
};
|
||||
decodes.push(new_textures[i].decoded);
|
||||
}
|
||||
Promise.allSettled(decodes).then(
|
||||
() => {
|
||||
handleOutstandingDisplayCommands();
|
||||
});
|
||||
} else {
|
||||
handleOutstandingDisplayCommands();
|
||||
}
|
||||
@ -3184,20 +3182,32 @@ function setupDocument(document)
|
||||
}
|
||||
}
|
||||
|
||||
function sendScreenSizeChanged() {
|
||||
var w, h, s;
|
||||
w = window.innerWidth;
|
||||
h = window.innerHeight;
|
||||
s = Math.round(window.devicePixelRatio);
|
||||
sendInput (BROADWAY_EVENT_SCREEN_SIZE_CHANGED, [w, h, s]);
|
||||
}
|
||||
|
||||
function start()
|
||||
{
|
||||
setupDocument(document);
|
||||
|
||||
var w, h;
|
||||
w = window.innerWidth;
|
||||
h = window.innerHeight;
|
||||
window.onresize = function(ev) {
|
||||
var w, h;
|
||||
w = window.innerWidth;
|
||||
h = window.innerHeight;
|
||||
sendInput (BROADWAY_EVENT_SCREEN_SIZE_CHANGED, [w, h]);
|
||||
sendScreenSizeChanged();
|
||||
};
|
||||
sendInput (BROADWAY_EVENT_SCREEN_SIZE_CHANGED, [w, h]);
|
||||
window.matchMedia('screen and (min-resolution: 2dppx)').
|
||||
addListener(function(e) {
|
||||
if (e.matches) {
|
||||
/* devicePixelRatio >= 2 */
|
||||
sendScreenSizeChanged();
|
||||
} else {
|
||||
/* devicePixelRatio < 2 */
|
||||
sendScreenSizeChanged();
|
||||
}
|
||||
});
|
||||
sendScreenSizeChanged();
|
||||
}
|
||||
|
||||
function connect()
|
||||
|
@ -238,8 +238,7 @@ client_handle_request (BroadwayClient *client,
|
||||
request->new_surface.x,
|
||||
request->new_surface.y,
|
||||
request->new_surface.width,
|
||||
request->new_surface.height,
|
||||
request->new_surface.is_temp);
|
||||
request->new_surface.height);
|
||||
client->surfaces =
|
||||
g_list_prepend (client->surfaces,
|
||||
GUINT_TO_POINTER (reply_new_surface.id));
|
||||
@ -513,7 +512,8 @@ incoming_client (GSocketService *service,
|
||||
ev.base.time = broadway_server_get_last_seen_time (server);
|
||||
broadway_server_get_screen_size (server,
|
||||
&ev.screen_resize_notify.width,
|
||||
&ev.screen_resize_notify.height);
|
||||
&ev.screen_resize_notify.height,
|
||||
&ev.screen_resize_notify.scale);
|
||||
|
||||
broadway_events_got_input (&ev,
|
||||
client->id);
|
||||
|
@ -482,8 +482,7 @@ _gdk_broadway_server_new_surface (GdkBroadwayServer *server,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
gboolean is_temp)
|
||||
int height)
|
||||
{
|
||||
BroadwayRequestNewSurface msg;
|
||||
guint32 serial, id;
|
||||
@ -493,7 +492,6 @@ _gdk_broadway_server_new_surface (GdkBroadwayServer *server,
|
||||
msg.y = y;
|
||||
msg.width = width;
|
||||
msg.height = height;
|
||||
msg.is_temp = is_temp;
|
||||
serial = gdk_broadway_server_send_message (server, msg,
|
||||
BROADWAY_REQUEST_NEW_SURFACE);
|
||||
reply = gdk_broadway_server_wait_for_reply (server, serial);
|
||||
|
@ -43,8 +43,7 @@ guint32 _gdk_broadway_server_new_surface (GdkBroadwaySe
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
gboolean is_temp);
|
||||
int height);
|
||||
void _gdk_broadway_server_destroy_surface (GdkBroadwayServer *server,
|
||||
gint id);
|
||||
gboolean _gdk_broadway_server_surface_show (GdkBroadwayServer *server,
|
||||
|
@ -63,6 +63,10 @@ gdk_broadway_display_init (GdkBroadwayDisplay *display)
|
||||
NULL);
|
||||
gdk_monitor_set_manufacturer (display->monitor, "browser");
|
||||
gdk_monitor_set_model (display->monitor, "0");
|
||||
display->scale_factor = 1;
|
||||
gdk_monitor_set_size (display->monitor, 1024, 768);
|
||||
gdk_monitor_set_physical_size (display->monitor, 1024 * 25.4 / 96, 768 * 25.4 / 96);
|
||||
gdk_monitor_set_scale_factor (display->monitor, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -80,16 +84,21 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
|
||||
{
|
||||
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
|
||||
GdkMonitor *monitor;
|
||||
GdkRectangle size;
|
||||
GdkRectangle current_size;
|
||||
GList *toplevels, *l;
|
||||
|
||||
monitor = broadway_display->monitor;
|
||||
gdk_monitor_get_geometry (monitor, &size);
|
||||
gdk_monitor_get_geometry (monitor, ¤t_size);
|
||||
|
||||
if (msg->width == size.width && msg->height == size.height)
|
||||
if (msg->width == current_size.width &&
|
||||
msg->height == current_size.height &&
|
||||
msg->scale == broadway_display->scale_factor)
|
||||
return;
|
||||
|
||||
broadway_display->scale_factor = msg->scale;
|
||||
|
||||
gdk_monitor_set_size (monitor, msg->width, msg->height);
|
||||
gdk_monitor_set_scale_factor (monitor, msg->scale);
|
||||
gdk_monitor_set_physical_size (monitor, msg->width * 25.4 / 96, msg->height * 25.4 / 96);
|
||||
|
||||
toplevels = broadway_display->toplevels;
|
||||
@ -101,8 +110,7 @@ _gdk_broadway_display_size_changed (GdkDisplay *display,
|
||||
gdk_broadway_surface_move_resize (GDK_SURFACE (toplevel),
|
||||
0, 0,
|
||||
msg->width, msg->height);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
static GdkDevice *
|
||||
create_core_pointer (GdkDisplay *display)
|
||||
|
@ -50,10 +50,10 @@ struct _GdkBroadwayDisplay
|
||||
GdkKeymap *keymap;
|
||||
|
||||
GdkBroadwayServer *server;
|
||||
|
||||
gpointer move_resize_data;
|
||||
|
||||
GdkMonitor *monitor;
|
||||
int scale_factor;
|
||||
|
||||
GHashTable *texture_cache;
|
||||
|
||||
|
@ -294,11 +294,6 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
|
||||
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
|
||||
if (surface)
|
||||
{
|
||||
surface->x = message->configure_notify.x;
|
||||
surface->y = message->configure_notify.y;
|
||||
|
||||
gdk_broadway_surface_update_popups (surface);
|
||||
|
||||
event = gdk_event_configure_new (surface,
|
||||
message->configure_notify.width,
|
||||
message->configure_notify.height);
|
||||
|
@ -67,7 +67,6 @@ void _gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
||||
void _gdk_broadway_surface_grab_check_destroy (GdkSurface *surface);
|
||||
void _gdk_broadway_surface_grab_check_unmap (GdkSurface *surface,
|
||||
gulong serial);
|
||||
void gdk_broadway_surface_update_popups (GdkSurface *surface);
|
||||
|
||||
void gdk_broadway_surface_move_resize (GdkSurface *surface,
|
||||
gint x,
|
||||
|
@ -219,7 +219,10 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
GdkBroadwaySurface *impl;
|
||||
GType type;
|
||||
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
if (parent)
|
||||
frame_clock = g_object_ref (gdk_surface_get_frame_clock (parent));
|
||||
else
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
|
||||
switch (surface_type)
|
||||
{
|
||||
@ -253,12 +256,19 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (display);
|
||||
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
impl->root_x = x;
|
||||
impl->root_y = y;
|
||||
if (parent)
|
||||
{
|
||||
impl->root_x += GDK_BROADWAY_SURFACE (parent)->root_x;
|
||||
impl->root_y += GDK_BROADWAY_SURFACE (parent)->root_y;
|
||||
}
|
||||
|
||||
impl->id = _gdk_broadway_server_new_surface (broadway_display->server,
|
||||
surface->x,
|
||||
surface->y,
|
||||
impl->root_x,
|
||||
impl->root_y,
|
||||
surface->width,
|
||||
surface->height,
|
||||
surface_type == GDK_SURFACE_TEMP);
|
||||
surface->height);
|
||||
g_hash_table_insert (broadway_display->id_ht, GINT_TO_POINTER(impl->id), surface);
|
||||
|
||||
if (!surface->parent)
|
||||
@ -266,6 +276,13 @@ _gdk_broadway_display_create_surface (GdkDisplay *display,
|
||||
|
||||
connect_frame_clock (surface);
|
||||
|
||||
/* We treat the real parent as a default transient for to get stacking right */
|
||||
if (parent)
|
||||
{
|
||||
impl->transient_for = GDK_BROADWAY_SURFACE (parent)->id;
|
||||
_gdk_broadway_server_surface_set_transient_for (broadway_display->server, impl->id, impl->transient_for);
|
||||
}
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
@ -386,6 +403,54 @@ gdk_broadway_surface_hide (GdkSurface *surface)
|
||||
_gdk_surface_clear_update_area (surface);
|
||||
}
|
||||
|
||||
static gint
|
||||
gdk_broadway_surface_get_scale_factor (GdkSurface *surface)
|
||||
{
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (surface))
|
||||
return 1;
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
|
||||
|
||||
return broadway_display->scale_factor;
|
||||
}
|
||||
|
||||
static void
|
||||
sync_child_root_pos (GdkSurface *parent)
|
||||
{
|
||||
GdkBroadwaySurface *parent_impl = GDK_BROADWAY_SURFACE (parent);
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
GList *l;
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (parent));
|
||||
|
||||
for (l = parent->children; l; l = l->next)
|
||||
{
|
||||
GdkBroadwaySurface *child_impl = l->data;
|
||||
GdkSurface *child = GDK_SURFACE (child_impl);
|
||||
int root_x, root_y;
|
||||
|
||||
root_x = child->x + parent_impl->root_x;
|
||||
root_y = child->y + parent_impl->root_y;
|
||||
|
||||
if (root_x != child_impl->root_x ||
|
||||
root_y != child_impl->root_y)
|
||||
{
|
||||
child_impl->root_x = root_x;
|
||||
child_impl->root_y = root_y;
|
||||
|
||||
_gdk_broadway_server_surface_move_resize (broadway_display->server,
|
||||
child_impl->id,
|
||||
TRUE,
|
||||
child_impl->root_x, child_impl->root_y,
|
||||
child->width, child->height);
|
||||
sync_child_root_pos (child);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* x, y is relative to parent */
|
||||
static void
|
||||
gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
@ -398,6 +463,20 @@ gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
|
||||
GdkBroadwayDisplay *broadway_display;
|
||||
gboolean size_changed;
|
||||
|
||||
if (with_move)
|
||||
{
|
||||
surface->x = x;
|
||||
surface->y = y;
|
||||
impl->root_x = x;
|
||||
impl->root_y = y;
|
||||
if (surface->parent)
|
||||
{
|
||||
GdkBroadwaySurface *parent_impl = GDK_BROADWAY_SURFACE (surface->parent);
|
||||
impl->root_x += parent_impl->root_x;
|
||||
impl->root_y += parent_impl->root_y;
|
||||
}
|
||||
}
|
||||
|
||||
size_changed = FALSE;
|
||||
|
||||
broadway_display = GDK_BROADWAY_DISPLAY (gdk_surface_get_display (surface));
|
||||
@ -424,17 +503,13 @@ gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
|
||||
}
|
||||
}
|
||||
|
||||
if (surface->parent)
|
||||
{
|
||||
impl->offset_x = x - surface->parent->x;
|
||||
impl->offset_y = y - surface->parent->y;
|
||||
}
|
||||
|
||||
_gdk_broadway_server_surface_move_resize (broadway_display->server,
|
||||
impl->id,
|
||||
with_move,
|
||||
x, y,
|
||||
impl->root_x, impl->root_y,
|
||||
surface->width, surface->height);
|
||||
sync_child_root_pos (surface);
|
||||
|
||||
queue_flush (surface);
|
||||
if (size_changed)
|
||||
{
|
||||
@ -488,9 +563,8 @@ gdk_broadway_surface_layout_popup (GdkSurface *surface,
|
||||
layout,
|
||||
&final_rect);
|
||||
|
||||
gdk_surface_get_origin (surface->parent, &x, &y);
|
||||
x += final_rect.x;
|
||||
y += final_rect.y;
|
||||
x = final_rect.x;
|
||||
y = final_rect.y;
|
||||
|
||||
if (final_rect.width != surface->width ||
|
||||
final_rect.height != surface->height)
|
||||
@ -606,6 +680,10 @@ gdk_broadway_surface_set_transient_for (GdkSurface *surface,
|
||||
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
/* We treat the real parent as a default transient for to get stacking right */
|
||||
if (parent == NULL)
|
||||
parent = surface->parent;
|
||||
|
||||
parent_id = 0;
|
||||
if (parent)
|
||||
parent_id = GDK_BROADWAY_SURFACE (parent)->id;
|
||||
@ -645,10 +723,14 @@ gdk_broadway_surface_get_root_coords (GdkSurface *surface,
|
||||
gint *root_x,
|
||||
gint *root_y)
|
||||
{
|
||||
GdkBroadwaySurface *impl;
|
||||
|
||||
impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (root_x)
|
||||
*root_x = x + surface->x;
|
||||
*root_x = x + impl->root_x;
|
||||
if (root_y)
|
||||
*root_y = y + surface->y;
|
||||
*root_y = y + impl->root_y;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -749,25 +831,6 @@ gdk_broadway_surface_unmaximize (GdkSurface *surface)
|
||||
impl->pre_maximize_height);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_broadway_surface_update_popups (GdkSurface *parent)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
for (l = parent ->children; l; l = l->next)
|
||||
{
|
||||
GdkBroadwaySurface *popup_impl = l->data;
|
||||
GdkSurface *popup = GDK_SURFACE (popup_impl);
|
||||
int new_x = parent->x + popup_impl->offset_x;
|
||||
int new_y = parent->y + popup_impl->offset_y;
|
||||
|
||||
if (new_x != popup->x || new_y != popup->y)
|
||||
gdk_broadway_surface_move_resize (popup,
|
||||
new_x, new_y,
|
||||
popup->width, popup->height);
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct _MoveResizeData MoveResizeData;
|
||||
|
||||
struct _MoveResizeData
|
||||
@ -1249,6 +1312,7 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
impl_class->begin_move_drag = gdk_broadway_surface_begin_move_drag;
|
||||
impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
|
||||
impl_class->get_scale_factor = gdk_broadway_surface_get_scale_factor;
|
||||
}
|
||||
|
||||
#define LAST_PROP 1
|
||||
|
@ -61,8 +61,8 @@ struct _GdkBroadwaySurface
|
||||
GArray *node_data;
|
||||
GPtrArray *node_data_textures;
|
||||
|
||||
int offset_x;
|
||||
int offset_y;
|
||||
int root_x;
|
||||
int root_y;
|
||||
};
|
||||
|
||||
struct _GdkBroadwaySurfaceClass
|
||||
|
@ -477,6 +477,7 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
|
||||
float offset_y)
|
||||
{
|
||||
GdkDisplay *display = gdk_surface_get_display (gsk_renderer_get_surface (renderer));
|
||||
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
|
||||
GskBroadwayRenderer *self = GSK_BROADWAY_RENDERER (renderer);
|
||||
GArray *nodes = self->nodes;
|
||||
|
||||
@ -753,9 +754,11 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
|
||||
int y = floorf (node->bounds.origin.y);
|
||||
int width = ceil (node->bounds.origin.x + node->bounds.size.width) - x;
|
||||
int height = ceil (node->bounds.origin.y + node->bounds.size.height) - y;
|
||||
int scale = broadway_display->scale_factor;
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width * scale, height * scale);
|
||||
cr = cairo_create (surface);
|
||||
cairo_scale (cr, scale, scale);
|
||||
cairo_translate (cr, -x, -y);
|
||||
gsk_render_node_draw (node, cr);
|
||||
cairo_destroy (cr);
|
||||
@ -766,8 +769,8 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
|
||||
texture_id = gdk_broadway_display_ensure_texture (display, texture);
|
||||
add_float (nodes, x - offset_x);
|
||||
add_float (nodes, y - offset_y);
|
||||
add_float (nodes, gdk_texture_get_width (texture));
|
||||
add_float (nodes, gdk_texture_get_height (texture));
|
||||
add_float (nodes, width);
|
||||
add_float (nodes, height);
|
||||
add_uint32 (nodes, texture_id);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user