mir: migrate away from deprecated mir api
This commit is contained in:
parent
a497938358
commit
7949069b9d
@ -207,30 +207,30 @@ _gdk_mir_print_input_event (const MirInputEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_gdk_mir_print_surface_event (const MirSurfaceEvent *event)
|
_gdk_mir_print_window_event (const MirWindowEvent *event)
|
||||||
{
|
{
|
||||||
g_printerr ("SURFACE\n");
|
g_printerr ("WINDOW\n");
|
||||||
g_printerr (" Attribute ");
|
g_printerr (" Attribute ");
|
||||||
switch (mir_surface_event_get_attribute (event))
|
switch (mir_window_event_get_attribute (event))
|
||||||
{
|
{
|
||||||
case mir_surface_attrib_type:
|
case mir_window_attrib_type:
|
||||||
g_printerr ("type");
|
g_printerr ("type");
|
||||||
break;
|
break;
|
||||||
case mir_surface_attrib_state:
|
case mir_window_attrib_state:
|
||||||
g_printerr ("state");
|
g_printerr ("state");
|
||||||
break;
|
break;
|
||||||
case mir_surface_attrib_swapinterval:
|
case mir_window_attrib_swapinterval:
|
||||||
g_printerr ("swapinterval");
|
g_printerr ("swapinterval");
|
||||||
break;
|
break;
|
||||||
case mir_surface_attrib_focus:
|
case mir_window_attrib_focus:
|
||||||
g_printerr ("focus");
|
g_printerr ("focus");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_printerr ("%u", mir_surface_event_get_attribute (event));
|
g_printerr ("%u", mir_window_event_get_attribute (event));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
g_printerr ("\n");
|
g_printerr ("\n");
|
||||||
g_printerr (" Value %i\n", mir_surface_event_get_attribute_value (event));
|
g_printerr (" Value %i\n", mir_window_event_get_attribute_value (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -278,13 +278,13 @@ _gdk_mir_print_event (const MirEvent *event)
|
|||||||
case mir_event_type_motion:
|
case mir_event_type_motion:
|
||||||
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
|
_gdk_mir_print_motion_event (mir_event_get_input_event (event));
|
||||||
break;
|
break;
|
||||||
case mir_event_type_surface:
|
case mir_event_type_window:
|
||||||
_gdk_mir_print_surface_event (mir_event_get_surface_event (event));
|
_gdk_mir_print_window_event (mir_event_get_window_event (event));
|
||||||
break;
|
break;
|
||||||
case mir_event_type_resize:
|
case mir_event_type_resize:
|
||||||
_gdk_mir_print_resize_event (mir_event_get_resize_event (event));
|
_gdk_mir_print_resize_event (mir_event_get_resize_event (event));
|
||||||
break;
|
break;
|
||||||
case mir_event_type_close_surface:
|
case mir_event_type_close_window:
|
||||||
_gdk_mir_print_close_event ();
|
_gdk_mir_print_close_event ();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -83,13 +83,15 @@ GdkCursor *_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name)
|
|||||||
|
|
||||||
const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor);
|
const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor);
|
||||||
|
|
||||||
|
MirWindow *_gdk_mir_window_get_mir_window (GdkWindow *window);
|
||||||
|
|
||||||
GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask);
|
GdkWindowImpl *_gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr *attributes, gint attributes_mask);
|
||||||
|
|
||||||
void _gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state);
|
void _gdk_mir_window_impl_set_window_state (GdkMirWindowImpl *impl, MirWindowState state);
|
||||||
|
|
||||||
void _gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl, MirSurfaceType type);
|
void _gdk_mir_window_impl_set_window_type (GdkMirWindowImpl *impl, MirWindowType type);
|
||||||
|
|
||||||
void _gdk_mir_window_set_surface_output (GdkWindow *window, gdouble scale);
|
void _gdk_mir_window_set_scale (GdkWindow *window, gdouble scale);
|
||||||
|
|
||||||
void _gdk_mir_window_set_final_rect (GdkWindow *window, MirRectangle rect);
|
void _gdk_mir_window_set_final_rect (GdkWindow *window, MirRectangle rect);
|
||||||
|
|
||||||
|
@ -827,8 +827,8 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
|
|||||||
guint32 time)
|
guint32 time)
|
||||||
{
|
{
|
||||||
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
|
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
|
||||||
MirSurface *surface;
|
MirWindow *mir_window;
|
||||||
MirPersistentId *persistent_id;
|
MirWindowId *mir_window_id;
|
||||||
ConvertInfo *info;
|
ConvertInfo *info;
|
||||||
|
|
||||||
if (selection != GDK_SELECTION_CLIPBOARD)
|
if (selection != GDK_SELECTION_CLIPBOARD)
|
||||||
@ -837,17 +837,17 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
|
|||||||
gdk_mir_display_real_convert_selection (display, requestor, selection, target, time);
|
gdk_mir_display_real_convert_selection (display, requestor, selection, target, time);
|
||||||
else if (mir_display->focused_window)
|
else if (mir_display->focused_window)
|
||||||
{
|
{
|
||||||
surface = gdk_mir_window_get_mir_surface (mir_display->focused_window);
|
mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window);
|
||||||
|
|
||||||
if (!surface)
|
if (!mir_window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
persistent_id = mir_surface_request_persistent_id_sync (surface);
|
mir_window_id = mir_window_request_window_id_sync (mir_window);
|
||||||
|
|
||||||
if (!persistent_id)
|
if (!mir_window_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mir_persistent_id_is_valid (persistent_id))
|
if (mir_window_id_is_valid (mir_window_id))
|
||||||
{
|
{
|
||||||
info = g_new (ConvertInfo, 1);
|
info = g_new (ConvertInfo, 1);
|
||||||
info->display = g_object_ref (display);
|
info->display = g_object_ref (display);
|
||||||
@ -858,13 +858,13 @@ gdk_mir_display_convert_selection (GdkDisplay *display,
|
|||||||
|
|
||||||
content_hub_service_call_get_latest_paste_data (
|
content_hub_service_call_get_latest_paste_data (
|
||||||
mir_display->content_service,
|
mir_display->content_service,
|
||||||
mir_persistent_id_as_string (persistent_id),
|
mir_window_id_as_string (mir_window_id),
|
||||||
NULL,
|
NULL,
|
||||||
paste_data_ready_cb,
|
paste_data_ready_cb,
|
||||||
info);
|
info);
|
||||||
}
|
}
|
||||||
|
|
||||||
mir_persistent_id_release (persistent_id);
|
mir_window_id_release (mir_window_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1010,34 +1010,34 @@ _gdk_mir_display_create_paste (GdkDisplay *display,
|
|||||||
gsize paste_size)
|
gsize paste_size)
|
||||||
{
|
{
|
||||||
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
|
GdkMirDisplay *mir_display = GDK_MIR_DISPLAY (display);
|
||||||
MirSurface *surface;
|
MirWindow *mir_window;
|
||||||
MirPersistentId *persistent_id;
|
MirWindowId *mir_window_id;
|
||||||
|
|
||||||
if (!mir_display->focused_window)
|
if (!mir_display->focused_window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
surface = gdk_mir_window_get_mir_surface (mir_display->focused_window);
|
mir_window = _gdk_mir_window_get_mir_window (mir_display->focused_window);
|
||||||
|
|
||||||
if (!surface)
|
if (!mir_window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
persistent_id = mir_surface_request_persistent_id_sync (surface);
|
mir_window_id = mir_window_request_window_id_sync (mir_window);
|
||||||
|
|
||||||
if (!persistent_id)
|
if (!mir_window_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mir_persistent_id_is_valid (persistent_id))
|
if (mir_window_id_is_valid (mir_window_id))
|
||||||
content_hub_service_call_create_paste_sync (
|
content_hub_service_call_create_paste_sync (
|
||||||
mir_display->content_service,
|
mir_display->content_service,
|
||||||
g_application_get_application_id (g_application_get_default ()),
|
g_application_get_application_id (g_application_get_default ()),
|
||||||
mir_persistent_id_as_string (persistent_id),
|
mir_window_id_as_string (mir_window_id),
|
||||||
g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, paste_data, paste_size, sizeof (guchar)),
|
g_variant_new_fixed_array (G_VARIANT_TYPE_BYTE, paste_data, paste_size, sizeof (guchar)),
|
||||||
paste_formats,
|
paste_formats,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
mir_persistent_id_release (persistent_id);
|
mir_window_id_release (mir_window_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
#include "gdkmir.h"
|
#include "gdkmir.h"
|
||||||
#include "gdkmir-private.h"
|
#include "gdkmir-private.h"
|
||||||
|
|
||||||
#include <mir_toolkit/events/surface_placement.h>
|
#include <mir_toolkit/events/window_placement.h>
|
||||||
|
|
||||||
#define NANO_TO_MILLI(x) ((x) / 1000000)
|
#define NANO_TO_MILLI(x) ((x) / 1000000)
|
||||||
|
|
||||||
@ -444,45 +444,46 @@ handle_motion_event (GdkWindow *window, const MirInputEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
|
handle_window_event (GdkWindow *window,
|
||||||
|
const MirWindowEvent *event)
|
||||||
{
|
{
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
MirSurfaceState state;
|
MirWindowState state;
|
||||||
|
|
||||||
switch (mir_surface_event_get_attribute (event))
|
switch (mir_window_event_get_attribute (event))
|
||||||
{
|
{
|
||||||
case mir_surface_attrib_type:
|
case mir_window_attrib_type:
|
||||||
_gdk_mir_window_impl_set_surface_type (impl, mir_surface_event_get_attribute_value (event));
|
_gdk_mir_window_impl_set_window_type (impl, mir_window_event_get_attribute_value (event));
|
||||||
break;
|
break;
|
||||||
case mir_surface_attrib_state:
|
case mir_window_attrib_state:
|
||||||
state = mir_surface_event_get_attribute_value (event);
|
state = mir_window_event_get_attribute_value (event);
|
||||||
_gdk_mir_window_impl_set_surface_state (impl, state);
|
_gdk_mir_window_impl_set_window_state (impl, state);
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case mir_surface_state_restored:
|
case mir_window_state_restored:
|
||||||
case mir_surface_state_hidden:
|
case mir_window_state_hidden:
|
||||||
gdk_synthesize_window_state (window,
|
gdk_synthesize_window_state (window,
|
||||||
GDK_WINDOW_STATE_ICONIFIED |
|
GDK_WINDOW_STATE_ICONIFIED |
|
||||||
GDK_WINDOW_STATE_MAXIMIZED |
|
GDK_WINDOW_STATE_MAXIMIZED |
|
||||||
GDK_WINDOW_STATE_FULLSCREEN,
|
GDK_WINDOW_STATE_FULLSCREEN,
|
||||||
0);
|
0);
|
||||||
break;
|
break;
|
||||||
case mir_surface_state_minimized:
|
case mir_window_state_minimized:
|
||||||
gdk_synthesize_window_state (window,
|
gdk_synthesize_window_state (window,
|
||||||
GDK_WINDOW_STATE_MAXIMIZED |
|
GDK_WINDOW_STATE_MAXIMIZED |
|
||||||
GDK_WINDOW_STATE_FULLSCREEN,
|
GDK_WINDOW_STATE_FULLSCREEN,
|
||||||
GDK_WINDOW_STATE_ICONIFIED);
|
GDK_WINDOW_STATE_ICONIFIED);
|
||||||
break;
|
break;
|
||||||
case mir_surface_state_maximized:
|
case mir_window_state_maximized:
|
||||||
case mir_surface_state_vertmaximized:
|
case mir_window_state_vertmaximized:
|
||||||
case mir_surface_state_horizmaximized:
|
case mir_window_state_horizmaximized:
|
||||||
gdk_synthesize_window_state (window,
|
gdk_synthesize_window_state (window,
|
||||||
GDK_WINDOW_STATE_ICONIFIED |
|
GDK_WINDOW_STATE_ICONIFIED |
|
||||||
GDK_WINDOW_STATE_FULLSCREEN,
|
GDK_WINDOW_STATE_FULLSCREEN,
|
||||||
GDK_WINDOW_STATE_MAXIMIZED);
|
GDK_WINDOW_STATE_MAXIMIZED);
|
||||||
break;
|
break;
|
||||||
case mir_surface_state_fullscreen:
|
case mir_window_state_fullscreen:
|
||||||
gdk_synthesize_window_state (window,
|
gdk_synthesize_window_state (window,
|
||||||
GDK_WINDOW_STATE_ICONIFIED |
|
GDK_WINDOW_STATE_ICONIFIED |
|
||||||
GDK_WINDOW_STATE_MAXIMIZED,
|
GDK_WINDOW_STATE_MAXIMIZED,
|
||||||
@ -493,10 +494,10 @@ handle_surface_event (GdkWindow *window, const MirSurfaceEvent *event)
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case mir_surface_attrib_swapinterval:
|
case mir_window_attrib_swapinterval:
|
||||||
break;
|
break;
|
||||||
case mir_surface_attrib_focus:
|
case mir_window_attrib_focus:
|
||||||
generate_focus_event (window, mir_surface_event_get_attribute_value (event) != 0);
|
generate_focus_event (window, mir_window_event_get_attribute_value (event) != 0);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -537,17 +538,17 @@ handle_close_event (GdkWindow *window)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_surface_output_event (GdkWindow *window,
|
handle_window_output_event (GdkWindow *window,
|
||||||
const MirSurfaceOutputEvent *event)
|
const MirWindowOutputEvent *event)
|
||||||
{
|
{
|
||||||
_gdk_mir_window_set_surface_output (window, mir_surface_output_event_get_scale (event));
|
_gdk_mir_window_set_scale (window, mir_window_output_event_get_scale (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_surface_placement_event (GdkWindow *window,
|
handle_window_placement_event (GdkWindow *window,
|
||||||
const MirSurfacePlacementEvent *event)
|
const MirWindowPlacementEvent *event)
|
||||||
{
|
{
|
||||||
_gdk_mir_window_set_final_rect (window, mir_surface_placement_get_relative_position (event));
|
_gdk_mir_window_set_final_rect (window, mir_window_placement_get_relative_position (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -591,8 +592,8 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
|
|||||||
case mir_event_type_motion:
|
case mir_event_type_motion:
|
||||||
handle_motion_event (window, mir_event_get_input_event (event));
|
handle_motion_event (window, mir_event_get_input_event (event));
|
||||||
break;
|
break;
|
||||||
case mir_event_type_surface:
|
case mir_event_type_window:
|
||||||
handle_surface_event (window, mir_event_get_surface_event (event));
|
handle_window_event (window, mir_event_get_window_event (event));
|
||||||
break;
|
break;
|
||||||
case mir_event_type_resize:
|
case mir_event_type_resize:
|
||||||
handle_resize_event (window, mir_event_get_resize_event (event));
|
handle_resize_event (window, mir_event_get_resize_event (event));
|
||||||
@ -603,14 +604,14 @@ gdk_mir_event_source_queue_event (GdkDisplay *display,
|
|||||||
case mir_event_type_orientation:
|
case mir_event_type_orientation:
|
||||||
// FIXME?
|
// FIXME?
|
||||||
break;
|
break;
|
||||||
case mir_event_type_close_surface:
|
case mir_event_type_close_window:
|
||||||
handle_close_event (window);
|
handle_close_event (window);
|
||||||
break;
|
break;
|
||||||
case mir_event_type_surface_output:
|
case mir_event_type_window_output:
|
||||||
handle_surface_output_event (window, mir_event_get_surface_output_event (event));
|
handle_window_output_event (window, mir_event_get_window_output_event (event));
|
||||||
break;
|
break;
|
||||||
case mir_event_type_surface_placement:
|
case mir_event_type_window_placement:
|
||||||
handle_surface_placement_event (window, mir_event_get_surface_placement_event (event));
|
handle_window_placement_event (window, mir_event_get_window_placement_event (event));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_warning ("Ignoring unknown Mir event %d", mir_event_get_type (event));
|
g_warning ("Ignoring unknown Mir event %d", mir_event_get_type (event));
|
||||||
|
@ -46,7 +46,7 @@ struct GdkMirScreen
|
|||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
|
||||||
/* Current monitor configuration */
|
/* Current monitor configuration */
|
||||||
MirDisplayConfiguration *display_config;
|
MirDisplayConfig *display_config;
|
||||||
|
|
||||||
GdkVisual *visual;
|
GdkVisual *visual;
|
||||||
|
|
||||||
@ -67,9 +67,15 @@ get_connection (GdkMirScreen *screen)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
|
get_screen_size (MirDisplayConfig *config,
|
||||||
|
gint *width,
|
||||||
|
gint *height)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
const MirOutput *output;
|
||||||
|
const MirOutputMode *mode;
|
||||||
|
gint right;
|
||||||
|
gint bottom;
|
||||||
|
gint i;
|
||||||
|
|
||||||
*width = 0;
|
*width = 0;
|
||||||
*height = 0;
|
*height = 0;
|
||||||
@ -77,27 +83,33 @@ get_screen_size (MirDisplayConfiguration *config, gint *width, gint *height)
|
|||||||
if (!config)
|
if (!config)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < config->num_outputs; i++)
|
for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
|
||||||
{
|
{
|
||||||
MirDisplayOutput *o = &config->outputs[i];
|
output = mir_display_config_get_output (config, i);
|
||||||
gint w, h;
|
|
||||||
|
|
||||||
if (!o->used)
|
if (!mir_output_is_enabled (output))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w = o->position_x + o->modes[o->current_mode].horizontal_resolution;
|
mode = mir_output_get_current_mode (output);
|
||||||
if (w > *width)
|
|
||||||
*width = w;
|
right = mir_output_get_position_x (output) + mir_output_mode_get_width (mode);
|
||||||
h = o->position_y + o->modes[o->current_mode].vertical_resolution;
|
bottom = mir_output_get_position_y (output) + mir_output_mode_get_height (mode);
|
||||||
if (h > *height)
|
|
||||||
*height = h;
|
if (right > *width)
|
||||||
|
*width = right;
|
||||||
|
|
||||||
|
if (bottom > *height)
|
||||||
|
*height = bottom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
get_screen_size_mm (MirDisplayConfiguration *config, gint *width, gint *height)
|
get_screen_size_mm (MirDisplayConfig *config,
|
||||||
|
gint *width,
|
||||||
|
gint *height)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
const MirOutput *output;
|
||||||
|
gint i;
|
||||||
|
|
||||||
*width = 0;
|
*width = 0;
|
||||||
*height = 0;
|
*height = 0;
|
||||||
@ -105,15 +117,15 @@ get_screen_size_mm (MirDisplayConfiguration *config, gint *width, gint *height)
|
|||||||
if (!config)
|
if (!config)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < config->num_outputs; i++)
|
for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
|
||||||
{
|
{
|
||||||
MirDisplayOutput *o = &config->outputs[i];
|
output = mir_display_config_get_output (config, i);
|
||||||
|
|
||||||
if (!o->used)
|
if (!mir_output_is_enabled (output))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
*width += o->physical_width_mm;
|
*width += mir_output_get_physical_width_mm (output);
|
||||||
*height += o->physical_height_mm;
|
*height += mir_output_get_physical_height_mm (output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,8 +133,8 @@ static void
|
|||||||
update_display_config (GdkMirScreen *screen)
|
update_display_config (GdkMirScreen *screen)
|
||||||
{
|
{
|
||||||
gdk_mir_display_get_mir_connection (GDK_DISPLAY (screen->display));
|
gdk_mir_display_get_mir_connection (GDK_DISPLAY (screen->display));
|
||||||
mir_display_config_destroy (screen->display_config);
|
mir_display_config_release (screen->display_config);
|
||||||
screen->display_config = mir_connection_create_display_config (get_connection (screen));
|
screen->display_config = mir_connection_create_display_configuration (get_connection (screen));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -165,7 +177,7 @@ gdk_mir_screen_finalize (GObject *object)
|
|||||||
GdkMirScreen *screen = GDK_MIR_SCREEN (object);
|
GdkMirScreen *screen = GDK_MIR_SCREEN (object);
|
||||||
|
|
||||||
mir_connection_set_display_config_change_callback (get_connection (screen), NULL, NULL);
|
mir_connection_set_display_config_change_callback (get_connection (screen), NULL, NULL);
|
||||||
mir_display_config_destroy (screen->display_config);
|
mir_display_config_release (screen->display_config);
|
||||||
g_clear_object (&screen->visual);
|
g_clear_object (&screen->visual);
|
||||||
g_clear_object (&screen->root_window);
|
g_clear_object (&screen->root_window);
|
||||||
|
|
||||||
@ -179,21 +191,27 @@ gdk_mir_screen_get_display (GdkScreen *screen)
|
|||||||
return GDK_DISPLAY (GDK_MIR_SCREEN (screen)->display);
|
return GDK_DISPLAY (GDK_MIR_SCREEN (screen)->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MirDisplayOutput *
|
static const MirOutput *
|
||||||
get_output (GdkScreen *screen, gint monitor_num)
|
get_output (GdkScreen *screen,
|
||||||
|
gint monitor_num)
|
||||||
{
|
{
|
||||||
MirDisplayConfiguration *config;
|
MirDisplayConfig *config;
|
||||||
uint32_t i, j;
|
const MirOutput *output;
|
||||||
|
gint i;
|
||||||
|
gint j;
|
||||||
|
|
||||||
config = GDK_MIR_SCREEN (screen)->display_config;
|
config = GDK_MIR_SCREEN (screen)->display_config;
|
||||||
|
|
||||||
for (i = 0, j = 0; i < config->num_outputs; i++)
|
for (i = 0, j = 0; i < mir_display_config_get_num_outputs (config); i++)
|
||||||
{
|
{
|
||||||
if (!config->outputs[i].used)
|
output = mir_display_config_get_output (config, i);
|
||||||
|
|
||||||
|
if (!mir_output_is_enabled (output))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (j == monitor_num)
|
if (j == monitor_num)
|
||||||
return &config->outputs[i];
|
return output;
|
||||||
|
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,15 +295,15 @@ static gint
|
|||||||
gdk_mir_screen_get_n_monitors (GdkScreen *screen)
|
gdk_mir_screen_get_n_monitors (GdkScreen *screen)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_screen_get_n_monitors\n");
|
//g_printerr ("gdk_mir_screen_get_n_monitors\n");
|
||||||
MirDisplayConfiguration *config;
|
MirDisplayConfig *config;
|
||||||
uint32_t i;
|
|
||||||
gint count = 0;
|
gint count = 0;
|
||||||
|
gint i;
|
||||||
|
|
||||||
config = GDK_MIR_SCREEN (screen)->display_config;
|
config = GDK_MIR_SCREEN (screen)->display_config;
|
||||||
|
|
||||||
for (i = 0; i < config->num_outputs; i++)
|
for (i = 0; i < mir_display_config_get_num_outputs (config); i++)
|
||||||
if (config->outputs[i].used)
|
if (mir_output_is_enabled (mir_display_config_get_output (config, i)))
|
||||||
++count;
|
count++;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@ -302,8 +320,9 @@ gdk_mir_screen_get_monitor_width_mm (GdkScreen *screen,
|
|||||||
gint monitor_num)
|
gint monitor_num)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
|
//g_printerr ("gdk_mir_screen_get_monitor_width_mm (%d)\n", monitor_num);
|
||||||
MirDisplayOutput *output = get_output (screen, monitor_num);
|
const MirOutput *output = get_output (screen, monitor_num);
|
||||||
return output ? output->physical_width_mm : 0;
|
|
||||||
|
return output ? mir_output_get_physical_width_mm (output) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -311,8 +330,9 @@ gdk_mir_screen_get_monitor_height_mm (GdkScreen *screen,
|
|||||||
gint monitor_num)
|
gint monitor_num)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
|
//g_printerr ("gdk_mir_screen_get_monitor_height_mm (%d)\n", monitor_num);
|
||||||
MirDisplayOutput *output = get_output (screen, monitor_num);
|
const MirOutput *output = get_output (screen, monitor_num);
|
||||||
return output ? output->physical_height_mm : 0;
|
|
||||||
|
return output ? mir_output_get_physical_height_mm (output) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gchar *
|
static gchar *
|
||||||
@ -320,44 +340,44 @@ gdk_mir_screen_get_monitor_plug_name (GdkScreen *screen,
|
|||||||
gint monitor_num)
|
gint monitor_num)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
|
//g_printerr ("gdk_mir_screen_get_monitor_plug_name (%d)\n", monitor_num);
|
||||||
MirDisplayOutput *output = get_output (screen, monitor_num);
|
const MirOutput *output = get_output (screen, monitor_num);
|
||||||
|
|
||||||
if (output)
|
if (output)
|
||||||
{
|
{
|
||||||
switch (output->type)
|
switch (mir_output_get_type (output))
|
||||||
{
|
{
|
||||||
case mir_display_output_type_unknown:
|
case mir_output_type_unknown:
|
||||||
return g_strdup_printf ("None-%u", output->output_id);
|
return g_strdup_printf ("None-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_vga:
|
case mir_output_type_vga:
|
||||||
return g_strdup_printf ("VGA-%u", output->output_id);
|
return g_strdup_printf ("VGA-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_dvii:
|
case mir_output_type_dvii:
|
||||||
case mir_display_output_type_dvid:
|
case mir_output_type_dvid:
|
||||||
case mir_display_output_type_dvia:
|
case mir_output_type_dvia:
|
||||||
return g_strdup_printf ("DVI-%u", output->output_id);
|
return g_strdup_printf ("DVI-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_composite:
|
case mir_output_type_composite:
|
||||||
return g_strdup_printf ("Composite-%u", output->output_id);
|
return g_strdup_printf ("Composite-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_lvds:
|
case mir_output_type_lvds:
|
||||||
return g_strdup_printf ("LVDS-%u", output->output_id);
|
return g_strdup_printf ("LVDS-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_component:
|
case mir_output_type_component:
|
||||||
return g_strdup_printf ("CTV-%u", output->output_id);
|
return g_strdup_printf ("CTV-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_ninepindin:
|
case mir_output_type_ninepindin:
|
||||||
return g_strdup_printf ("DIN-%u", output->output_id);
|
return g_strdup_printf ("DIN-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_displayport:
|
case mir_output_type_displayport:
|
||||||
return g_strdup_printf ("DP-%u", output->output_id);
|
return g_strdup_printf ("DP-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_hdmia:
|
case mir_output_type_hdmia:
|
||||||
case mir_display_output_type_hdmib:
|
case mir_output_type_hdmib:
|
||||||
return g_strdup_printf ("HDMI-%u", output->output_id);
|
return g_strdup_printf ("HDMI-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_svideo:
|
case mir_output_type_svideo:
|
||||||
case mir_display_output_type_tv:
|
case mir_output_type_tv:
|
||||||
return g_strdup_printf ("TV-%u", output->output_id);
|
return g_strdup_printf ("TV-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_edp:
|
case mir_output_type_edp:
|
||||||
return g_strdup_printf ("eDP-%u", output->output_id);
|
return g_strdup_printf ("eDP-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_virtual:
|
case mir_output_type_virtual:
|
||||||
return g_strdup_printf ("Virtual-%u", output->output_id);
|
return g_strdup_printf ("Virtual-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_dsi:
|
case mir_output_type_dsi:
|
||||||
return g_strdup_printf ("DSI-%u", output->output_id);
|
return g_strdup_printf ("DSI-%u", mir_output_get_id (output));
|
||||||
case mir_display_output_type_dpi:
|
case mir_output_type_dpi:
|
||||||
return g_strdup_printf ("DPI-%u", output->output_id);
|
return g_strdup_printf ("DPI-%u", mir_output_get_id (output));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,18 +390,19 @@ gdk_mir_screen_get_monitor_geometry (GdkScreen *screen,
|
|||||||
GdkRectangle *dest)
|
GdkRectangle *dest)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_screen_get_monitor_geometry (%d)\n", monitor_num);
|
//g_printerr ("gdk_mir_screen_get_monitor_geometry (%d)\n", monitor_num);
|
||||||
MirDisplayOutput *output;
|
const MirOutput *output;
|
||||||
MirDisplayMode *mode;
|
const MirOutputMode *mode;
|
||||||
|
|
||||||
output = get_output (screen, monitor_num);
|
output = get_output (screen, monitor_num);
|
||||||
|
|
||||||
if (output)
|
if (output)
|
||||||
{
|
{
|
||||||
mode = &output->modes[output->current_mode];
|
mode = mir_output_get_current_mode (output);
|
||||||
dest->x = output->position_x;
|
|
||||||
dest->y = output->position_y;
|
dest->x = mir_output_get_position_x (output);
|
||||||
dest->width = mode->horizontal_resolution;
|
dest->y = mir_output_get_position_y (output);
|
||||||
dest->height = mode->vertical_resolution;
|
dest->width = mir_output_mode_get_width (mode);
|
||||||
|
dest->height = mir_output_mode_get_height (mode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -90,9 +90,9 @@ struct _GdkMirWindowImpl
|
|||||||
gint rect_anchor_dx;
|
gint rect_anchor_dx;
|
||||||
gint rect_anchor_dy;
|
gint rect_anchor_dy;
|
||||||
|
|
||||||
/* Desired surface attributes */
|
/* Desired window attributes */
|
||||||
GdkWindowTypeHint type_hint;
|
GdkWindowTypeHint type_hint;
|
||||||
MirSurfaceState surface_state;
|
MirWindowState window_state;
|
||||||
gboolean modal;
|
gboolean modal;
|
||||||
|
|
||||||
/* Pattern for background */
|
/* Pattern for background */
|
||||||
@ -105,8 +105,8 @@ struct _GdkMirWindowImpl
|
|||||||
|
|
||||||
GdkDisplay *display;
|
GdkDisplay *display;
|
||||||
|
|
||||||
/* Surface being rendered to (only exists when window visible) */
|
/* Window being rendered to (only exists when visible) */
|
||||||
MirSurface *surface;
|
MirWindow *mir_window;
|
||||||
MirBufferStream *buffer_stream;
|
MirBufferStream *buffer_stream;
|
||||||
MirBufferUsage buffer_usage;
|
MirBufferUsage buffer_usage;
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ struct _GdkMirWindowImpl
|
|||||||
GdkGeometry geometry_hints;
|
GdkGeometry geometry_hints;
|
||||||
GdkWindowHints geometry_mask;
|
GdkWindowHints geometry_mask;
|
||||||
|
|
||||||
/* Egl surface for the current mir surface */
|
/* Egl surface for the current mir window */
|
||||||
EGLSurface egl_surface;
|
EGLSurface egl_surface;
|
||||||
|
|
||||||
/* Dummy MIR and EGL surfaces */
|
/* Dummy MIR and EGL surfaces */
|
||||||
@ -142,8 +142,7 @@ struct _GdkMirWindowImplClass
|
|||||||
G_DEFINE_TYPE (GdkMirWindowImpl, gdk_mir_window_impl, GDK_TYPE_WINDOW_IMPL)
|
G_DEFINE_TYPE (GdkMirWindowImpl, gdk_mir_window_impl, GDK_TYPE_WINDOW_IMPL)
|
||||||
|
|
||||||
static cairo_surface_t *gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window);
|
static cairo_surface_t *gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window);
|
||||||
static void ensure_surface (GdkWindow *window);
|
static void ensure_mir_window (GdkWindow *window);
|
||||||
static void apply_geometry_hints (MirSurfaceSpec *spec, GdkMirWindowImpl *impl);
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
type_hint_differs (GdkWindowTypeHint lhs, GdkWindowTypeHint rhs)
|
type_hint_differs (GdkWindowTypeHint lhs, GdkWindowTypeHint rhs)
|
||||||
@ -228,14 +227,15 @@ _gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gdk_mir_window_impl_set_surface_state (GdkMirWindowImpl *impl, MirSurfaceState state)
|
_gdk_mir_window_impl_set_window_state (GdkMirWindowImpl *impl,
|
||||||
|
MirWindowState state)
|
||||||
{
|
{
|
||||||
impl->surface_state = state;
|
impl->window_state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gdk_mir_window_impl_set_surface_type (GdkMirWindowImpl *impl,
|
_gdk_mir_window_impl_set_window_type (GdkMirWindowImpl *impl,
|
||||||
MirSurfaceType type)
|
MirWindowType type)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,37 +274,40 @@ gdk_mir_window_impl_init (GdkMirWindowImpl *impl)
|
|||||||
{
|
{
|
||||||
impl->properties = g_hash_table_new_full (NULL, NULL, NULL, gdk_mir_property_free);
|
impl->properties = g_hash_table_new_full (NULL, NULL, NULL, gdk_mir_property_free);
|
||||||
impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
|
impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
|
||||||
impl->surface_state = mir_surface_state_unknown;
|
impl->window_state = mir_window_state_unknown;
|
||||||
impl->output_scale = 1;
|
impl->output_scale = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_surface_state (GdkMirWindowImpl *impl,
|
set_window_state (GdkMirWindowImpl *impl,
|
||||||
MirSurfaceState state)
|
MirWindowState state)
|
||||||
{
|
{
|
||||||
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
||||||
if (impl->surface_state == state)
|
MirWindowSpec *spec;
|
||||||
|
|
||||||
|
if (state == impl->window_state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
impl->surface_state = state;
|
impl->window_state = state;
|
||||||
if (impl->surface && !impl->pending_spec_update)
|
|
||||||
|
if (impl->mir_window && !impl->pending_spec_update)
|
||||||
{
|
{
|
||||||
MirSurfaceSpec *spec = mir_connection_create_spec_for_changes (connection);
|
spec = mir_create_window_spec (connection);
|
||||||
mir_surface_spec_set_state (spec, state);
|
mir_window_spec_set_state (spec, state);
|
||||||
mir_surface_apply_spec (impl->surface, spec);
|
mir_window_apply_spec (impl->mir_window, spec);
|
||||||
mir_surface_spec_release (spec);
|
mir_window_spec_release (spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_cb (MirSurface *surface,
|
event_cb (MirWindow *mir_window,
|
||||||
const MirEvent *event,
|
const MirEvent *event,
|
||||||
void *context)
|
void *context)
|
||||||
{
|
{
|
||||||
_gdk_mir_event_source_queue (context, event);
|
_gdk_mir_event_source_queue (context, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MirSurfaceSpec *
|
static MirWindowSpec *
|
||||||
create_window_type_spec (GdkDisplay *display,
|
create_window_type_spec (GdkDisplay *display,
|
||||||
GdkWindow *parent,
|
GdkWindow *parent,
|
||||||
gint x,
|
gint x,
|
||||||
@ -316,17 +319,18 @@ create_window_type_spec (GdkDisplay *display,
|
|||||||
MirBufferUsage buffer_usage)
|
MirBufferUsage buffer_usage)
|
||||||
{
|
{
|
||||||
MirConnection *connection = gdk_mir_display_get_mir_connection (display);
|
MirConnection *connection = gdk_mir_display_get_mir_connection (display);
|
||||||
MirSurface *parent_surface = NULL;
|
MirWindow *parent_mir_window = NULL;
|
||||||
MirPixelFormat format;
|
MirPixelFormat format;
|
||||||
MirRectangle rect;
|
MirRectangle rect;
|
||||||
|
MirWindowSpec *spec;
|
||||||
|
|
||||||
if (parent && parent->impl)
|
if (parent && parent->impl)
|
||||||
{
|
{
|
||||||
ensure_surface (parent);
|
ensure_mir_window (parent);
|
||||||
parent_surface = GDK_MIR_WINDOW_IMPL (parent->impl)->surface;
|
parent_mir_window = GDK_MIR_WINDOW_IMPL (parent->impl)->mir_window;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!parent_surface)
|
if (!parent_mir_window)
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
@ -350,21 +354,20 @@ create_window_type_spec (GdkDisplay *display,
|
|||||||
{
|
{
|
||||||
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
case GDK_WINDOW_TYPE_HINT_DIALOG:
|
||||||
if (modal)
|
if (modal)
|
||||||
return mir_connection_create_spec_for_modal_dialog (connection,
|
spec = mir_create_modal_dialog_window_spec (connection,
|
||||||
width,
|
|
||||||
height,
|
|
||||||
format,
|
|
||||||
parent_surface);
|
|
||||||
else
|
|
||||||
return mir_connection_create_spec_for_dialog (connection,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
format);
|
|
||||||
case GDK_WINDOW_TYPE_HINT_DOCK:
|
|
||||||
return mir_connection_create_spec_for_dialog (connection,
|
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
format);
|
parent_mir_window);
|
||||||
|
else
|
||||||
|
spec = mir_create_dialog_window_spec (connection,
|
||||||
|
width,
|
||||||
|
height);
|
||||||
|
break;
|
||||||
|
case GDK_WINDOW_TYPE_HINT_DOCK:
|
||||||
|
spec = mir_create_dialog_window_spec (connection,
|
||||||
|
width,
|
||||||
|
height);
|
||||||
|
break;
|
||||||
case GDK_WINDOW_TYPE_HINT_MENU:
|
case GDK_WINDOW_TYPE_HINT_MENU:
|
||||||
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
|
case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU:
|
||||||
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
|
case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
|
||||||
@ -373,59 +376,65 @@ create_window_type_spec (GdkDisplay *display,
|
|||||||
case GDK_WINDOW_TYPE_HINT_DND:
|
case GDK_WINDOW_TYPE_HINT_DND:
|
||||||
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
|
case GDK_WINDOW_TYPE_HINT_TOOLTIP:
|
||||||
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
|
case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
|
||||||
return mir_connection_create_spec_for_menu (connection,
|
spec = mir_create_menu_window_spec (connection,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
format,
|
parent_mir_window,
|
||||||
parent_surface,
|
&rect,
|
||||||
&rect,
|
0);
|
||||||
0);
|
break;
|
||||||
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
|
||||||
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
case GDK_WINDOW_TYPE_HINT_UTILITY:
|
||||||
return mir_connection_create_spec_for_modal_dialog (connection,
|
spec = mir_create_modal_dialog_window_spec (connection,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
format,
|
parent_mir_window);
|
||||||
parent_surface);
|
break;
|
||||||
case GDK_WINDOW_TYPE_HINT_NORMAL:
|
case GDK_WINDOW_TYPE_HINT_NORMAL:
|
||||||
case GDK_WINDOW_TYPE_HINT_DESKTOP:
|
case GDK_WINDOW_TYPE_HINT_DESKTOP:
|
||||||
default:
|
default:
|
||||||
return mir_connection_create_spec_for_normal_surface (connection,
|
spec = mir_create_normal_window_spec (connection,
|
||||||
width,
|
width,
|
||||||
height,
|
height);
|
||||||
format);
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mir_window_spec_set_pixel_format (spec, format);
|
||||||
|
|
||||||
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
apply_geometry_hints (MirSurfaceSpec *spec, GdkMirWindowImpl *impl)
|
apply_geometry_hints (MirWindowSpec *spec,
|
||||||
|
GdkMirWindowImpl *impl)
|
||||||
{
|
{
|
||||||
if (impl->geometry_mask & GDK_HINT_RESIZE_INC)
|
if (impl->geometry_mask & GDK_HINT_RESIZE_INC)
|
||||||
{
|
{
|
||||||
mir_surface_spec_set_width_increment (spec, impl->geometry_hints.width_inc);
|
mir_window_spec_set_width_increment (spec, impl->geometry_hints.width_inc);
|
||||||
mir_surface_spec_set_height_increment (spec, impl->geometry_hints.height_inc);
|
mir_window_spec_set_height_increment (spec, impl->geometry_hints.height_inc);
|
||||||
}
|
}
|
||||||
if (impl->geometry_mask & GDK_HINT_MIN_SIZE)
|
if (impl->geometry_mask & GDK_HINT_MIN_SIZE)
|
||||||
{
|
{
|
||||||
mir_surface_spec_set_min_width (spec, impl->geometry_hints.min_width);
|
mir_window_spec_set_min_width (spec, impl->geometry_hints.min_width);
|
||||||
mir_surface_spec_set_min_height (spec, impl->geometry_hints.min_height);
|
mir_window_spec_set_min_height (spec, impl->geometry_hints.min_height);
|
||||||
}
|
}
|
||||||
if (impl->geometry_mask & GDK_HINT_MAX_SIZE)
|
if (impl->geometry_mask & GDK_HINT_MAX_SIZE)
|
||||||
{
|
{
|
||||||
mir_surface_spec_set_max_width (spec, impl->geometry_hints.max_width);
|
mir_window_spec_set_max_width (spec, impl->geometry_hints.max_width);
|
||||||
mir_surface_spec_set_max_height (spec, impl->geometry_hints.max_height);
|
mir_window_spec_set_max_height (spec, impl->geometry_hints.max_height);
|
||||||
}
|
}
|
||||||
if (impl->geometry_mask & GDK_HINT_ASPECT)
|
if (impl->geometry_mask & GDK_HINT_ASPECT)
|
||||||
{
|
{
|
||||||
mir_surface_spec_set_min_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.min_aspect));
|
mir_window_spec_set_min_aspect_ratio (spec, (guint) 1000 * impl->geometry_hints.min_aspect, 1000);
|
||||||
mir_surface_spec_set_max_aspect_ratio (spec, 1000, (unsigned)(1000.0/impl->geometry_hints.max_aspect));
|
mir_window_spec_set_max_aspect_ratio (spec, (guint) 1000 * impl->geometry_hints.max_aspect, 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static MirSurfaceSpec*
|
static MirWindowSpec *
|
||||||
create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
|
create_spec (GdkWindow *window,
|
||||||
|
GdkMirWindowImpl *impl)
|
||||||
{
|
{
|
||||||
MirSurfaceSpec *spec = NULL;
|
MirWindowSpec *spec = NULL;
|
||||||
GdkWindow *parent;
|
GdkWindow *parent;
|
||||||
|
|
||||||
spec = create_window_type_spec (impl->display,
|
spec = create_window_type_spec (impl->display,
|
||||||
@ -438,8 +447,8 @@ create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
|
|||||||
impl->type_hint,
|
impl->type_hint,
|
||||||
impl->buffer_usage);
|
impl->buffer_usage);
|
||||||
|
|
||||||
mir_surface_spec_set_name (spec, impl->title);
|
mir_window_spec_set_name (spec, impl->title);
|
||||||
mir_surface_spec_set_buffer_usage (spec, impl->buffer_usage);
|
mir_window_spec_set_buffer_usage (spec, impl->buffer_usage);
|
||||||
|
|
||||||
apply_geometry_hints (spec, impl);
|
apply_geometry_hints (spec, impl);
|
||||||
|
|
||||||
@ -460,33 +469,34 @@ create_spec (GdkWindow *window, GdkMirWindowImpl *impl)
|
|||||||
parent = gdk_window_get_parent (parent);
|
parent = gdk_window_get_parent (parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
mir_surface_spec_set_placement (spec,
|
mir_window_spec_set_placement (spec,
|
||||||
&impl->mir_rect,
|
&impl->mir_rect,
|
||||||
impl->rect_anchor,
|
impl->rect_anchor,
|
||||||
impl->window_anchor,
|
impl->window_anchor,
|
||||||
impl->anchor_hints,
|
impl->anchor_hints,
|
||||||
impl->rect_anchor_dx,
|
impl->rect_anchor_dx,
|
||||||
impl->rect_anchor_dy);
|
impl->rect_anchor_dy);
|
||||||
}
|
}
|
||||||
|
|
||||||
return spec;
|
return spec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_surface_spec (GdkWindow *window)
|
update_window_spec (GdkWindow *window)
|
||||||
{
|
{
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
MirSurfaceSpec *spec;
|
MirWindowSpec *spec;
|
||||||
|
|
||||||
if (!impl->surface)
|
if (!impl->mir_window)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
spec = create_spec (window, impl);
|
spec = create_spec (window, impl);
|
||||||
|
|
||||||
mir_surface_apply_spec (impl->surface, spec);
|
mir_window_apply_spec (impl->mir_window, spec);
|
||||||
mir_surface_spec_release (spec);
|
mir_window_spec_release (spec);
|
||||||
|
|
||||||
impl->pending_spec_update = FALSE;
|
impl->pending_spec_update = FALSE;
|
||||||
impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
|
impl->buffer_stream = mir_window_get_buffer_stream (impl->mir_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GdkDevice *
|
static GdkDevice *
|
||||||
@ -535,17 +545,17 @@ generate_configure_event (GdkWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ensure_surface_full (GdkWindow *window,
|
ensure_mir_window_full (GdkWindow *window,
|
||||||
MirBufferUsage buffer_usage)
|
MirBufferUsage buffer_usage)
|
||||||
{
|
{
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
GdkMirWindowReference *window_ref;
|
GdkMirWindowReference *window_ref;
|
||||||
MirSurfaceSpec *spec;
|
MirWindowSpec *spec;
|
||||||
|
|
||||||
if (impl->surface)
|
if (impl->mir_window)
|
||||||
{
|
{
|
||||||
if (impl->pending_spec_update)
|
if (impl->pending_spec_update)
|
||||||
update_surface_spec(window);
|
update_window_spec (window);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,12 +567,12 @@ ensure_surface_full (GdkWindow *window,
|
|||||||
|
|
||||||
spec = create_spec (window, impl);
|
spec = create_spec (window, impl);
|
||||||
|
|
||||||
impl->surface = mir_surface_create_sync (spec);
|
impl->mir_window = mir_create_window_sync (spec);
|
||||||
|
|
||||||
mir_surface_spec_release(spec);
|
mir_window_spec_release (spec);
|
||||||
|
|
||||||
impl->pending_spec_update = FALSE;
|
impl->pending_spec_update = FALSE;
|
||||||
impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
|
impl->buffer_stream = mir_window_get_buffer_stream (impl->mir_window);
|
||||||
|
|
||||||
/* FIXME: can't make an initial resize event */
|
/* FIXME: can't make an initial resize event */
|
||||||
// MirEvent *resize_event;
|
// MirEvent *resize_event;
|
||||||
@ -580,20 +590,21 @@ ensure_surface_full (GdkWindow *window,
|
|||||||
|
|
||||||
generate_configure_event (window, window->width, window->height);
|
generate_configure_event (window, window->width, window->height);
|
||||||
|
|
||||||
mir_surface_set_event_handler (impl->surface, event_cb, window_ref); // FIXME: Ignore some events until shown
|
/* FIXME: Ignore some events until shown */
|
||||||
|
mir_window_set_event_handler (impl->mir_window, event_cb, window_ref);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ensure_surface (GdkWindow *window)
|
ensure_mir_window (GdkWindow *window)
|
||||||
{
|
{
|
||||||
ensure_surface_full (window,
|
ensure_mir_window_full (window,
|
||||||
window->gl_paint_context ?
|
window->gl_paint_context ?
|
||||||
mir_buffer_usage_hardware :
|
mir_buffer_usage_hardware :
|
||||||
mir_buffer_usage_software);
|
mir_buffer_usage_software);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ensure_no_surface (GdkWindow *window)
|
ensure_no_mir_window (GdkWindow *window)
|
||||||
{
|
{
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
|
|
||||||
@ -621,7 +632,7 @@ ensure_no_surface (GdkWindow *window)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_clear_pointer(&impl->surface, mir_surface_release_sync);
|
g_clear_pointer (&impl->mir_window, mir_window_release_sync);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -630,12 +641,12 @@ send_buffer (GdkWindow *window)
|
|||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
|
|
||||||
/* Send the completed buffer to Mir */
|
/* Send the completed buffer to Mir */
|
||||||
mir_buffer_stream_swap_buffers_sync (mir_surface_get_buffer_stream (impl->surface));
|
mir_buffer_stream_swap_buffers_sync (mir_window_get_buffer_stream (impl->mir_window));
|
||||||
|
|
||||||
/* The Cairo context is no longer valid */
|
/* The Cairo context is no longer valid */
|
||||||
g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
|
g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
|
||||||
if (impl->pending_spec_update)
|
if (impl->pending_spec_update)
|
||||||
update_surface_spec (window);
|
update_window_spec (window);
|
||||||
|
|
||||||
impl->pending_spec_update = FALSE;
|
impl->pending_spec_update = FALSE;
|
||||||
}
|
}
|
||||||
@ -656,7 +667,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
|
|||||||
return impl->cairo_surface;
|
return impl->cairo_surface;
|
||||||
}
|
}
|
||||||
|
|
||||||
ensure_surface (window);
|
ensure_mir_window (window);
|
||||||
|
|
||||||
if (window->gl_paint_context)
|
if (window->gl_paint_context)
|
||||||
{
|
{
|
||||||
@ -665,7 +676,7 @@ gdk_mir_window_impl_ref_cairo_surface (GdkWindow *window)
|
|||||||
}
|
}
|
||||||
else if (impl->visible)
|
else if (impl->visible)
|
||||||
{
|
{
|
||||||
mir_buffer_stream_get_graphics_region (mir_surface_get_buffer_stream (impl->surface), ®ion);
|
mir_buffer_stream_get_graphics_region (mir_window_get_buffer_stream (impl->mir_window), ®ion);
|
||||||
|
|
||||||
switch (region.pixel_format)
|
switch (region.pixel_format)
|
||||||
{
|
{
|
||||||
@ -743,13 +754,10 @@ gdk_mir_window_impl_finalize (GObject *object)
|
|||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (object);
|
||||||
|
|
||||||
g_free (impl->title);
|
g_free (impl->title);
|
||||||
if (impl->background)
|
|
||||||
cairo_pattern_destroy (impl->background);
|
|
||||||
if (impl->surface)
|
|
||||||
mir_surface_release_sync (impl->surface);
|
|
||||||
if (impl->cairo_surface)
|
|
||||||
cairo_surface_destroy (impl->cairo_surface);
|
|
||||||
|
|
||||||
|
g_clear_pointer (&impl->background, cairo_pattern_destroy);
|
||||||
|
g_clear_pointer (&impl->mir_window, mir_window_release_sync);
|
||||||
|
g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
|
||||||
g_clear_pointer (&impl->properties, g_hash_table_unref);
|
g_clear_pointer (&impl->properties, g_hash_table_unref);
|
||||||
|
|
||||||
G_OBJECT_CLASS (gdk_mir_window_impl_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gdk_mir_window_impl_parent_class)->finalize (object);
|
||||||
@ -765,10 +773,10 @@ gdk_mir_window_impl_show (GdkWindow *window,
|
|||||||
//g_printerr ("gdk_mir_window_impl_show window=%p\n", window);
|
//g_printerr ("gdk_mir_window_impl_show window=%p\n", window);
|
||||||
|
|
||||||
impl->visible = TRUE;
|
impl->visible = TRUE;
|
||||||
set_surface_state (impl, mir_surface_state_restored);
|
set_window_state (impl, mir_window_state_restored);
|
||||||
|
|
||||||
/* Make sure there's a surface to see */
|
/* Make sure there's a window to see */
|
||||||
ensure_surface (window);
|
ensure_mir_window (window);
|
||||||
|
|
||||||
if (!window->gl_paint_context)
|
if (!window->gl_paint_context)
|
||||||
{
|
{
|
||||||
@ -788,7 +796,7 @@ gdk_mir_window_impl_hide (GdkWindow *window)
|
|||||||
impl->cursor_inside = FALSE;
|
impl->cursor_inside = FALSE;
|
||||||
impl->visible = FALSE;
|
impl->visible = FALSE;
|
||||||
|
|
||||||
set_surface_state (impl, mir_surface_state_hidden);
|
set_window_state (impl, mir_window_state_hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -800,7 +808,7 @@ gdk_mir_window_impl_withdraw (GdkWindow *window)
|
|||||||
impl->cursor_inside = FALSE;
|
impl->cursor_inside = FALSE;
|
||||||
impl->visible = FALSE;
|
impl->visible = FALSE;
|
||||||
|
|
||||||
set_surface_state (impl, mir_surface_state_hidden);
|
set_window_state (impl, mir_window_state_hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -853,7 +861,7 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
|
|||||||
*/
|
*/
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
|
|
||||||
/* If resize requested then rebuild surface */
|
/* If resize requested then rebuild window */
|
||||||
if (width >= 0 && (window->width != width || window->height != height))
|
if (width >= 0 && (window->width != width || window->height != height))
|
||||||
{
|
{
|
||||||
/* We accept any resize */
|
/* We accept any resize */
|
||||||
@ -870,8 +878,8 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
|
|||||||
impl->has_rect = FALSE;
|
impl->has_rect = FALSE;
|
||||||
impl->transient_x = x;
|
impl->transient_x = x;
|
||||||
impl->transient_y = y;
|
impl->transient_y = y;
|
||||||
if (!impl->pending_spec_update && impl->surface)
|
if (!impl->pending_spec_update && impl->mir_window)
|
||||||
update_surface_spec (window);
|
update_window_spec (window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1008,8 +1016,8 @@ gdk_mir_window_impl_move_to_rect (GdkWindow *window,
|
|||||||
impl->rect_anchor_dx = rect_anchor_dx + get_window_shadow_dx (window, window_anchor);
|
impl->rect_anchor_dx = rect_anchor_dx + get_window_shadow_dx (window, window_anchor);
|
||||||
impl->rect_anchor_dy = rect_anchor_dy + get_window_shadow_dy (window, window_anchor);
|
impl->rect_anchor_dy = rect_anchor_dy + get_window_shadow_dy (window, window_anchor);
|
||||||
|
|
||||||
if (impl->surface && !impl->pending_spec_update)
|
if (impl->mir_window && !impl->pending_spec_update)
|
||||||
update_surface_spec (window);
|
update_window_spec (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
@ -1261,25 +1269,20 @@ gdk_mir_window_impl_set_device_cursor (GdkWindow *window,
|
|||||||
GdkDevice *device,
|
GdkDevice *device,
|
||||||
GdkCursor *cursor)
|
GdkCursor *cursor)
|
||||||
{
|
{
|
||||||
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
|
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
||||||
|
MirWindowSpec *spec;
|
||||||
const gchar *cursor_name;
|
const gchar *cursor_name;
|
||||||
MirCursorConfiguration *configuration;
|
|
||||||
|
|
||||||
if (cursor)
|
if (cursor)
|
||||||
cursor_name = _gdk_mir_cursor_get_name (cursor);
|
cursor_name = _gdk_mir_cursor_get_name (cursor);
|
||||||
else
|
else
|
||||||
cursor_name = mir_default_cursor_name;
|
cursor_name = mir_default_cursor_name;
|
||||||
|
|
||||||
configuration = mir_cursor_configuration_from_name (cursor_name);
|
spec = mir_create_window_spec (connection);
|
||||||
|
mir_window_spec_set_cursor_name (spec, cursor_name);
|
||||||
if (configuration)
|
mir_window_apply_spec (impl->mir_window, spec);
|
||||||
{
|
mir_window_spec_release (spec);
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
|
||||||
|
|
||||||
if (impl->surface)
|
|
||||||
mir_surface_configure_cursor (impl->surface, configuration);
|
|
||||||
|
|
||||||
mir_cursor_configuration_destroy (configuration);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1390,7 +1393,7 @@ gdk_mir_window_impl_destroy (GdkWindow *window,
|
|||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
|
|
||||||
impl->visible = FALSE;
|
impl->visible = FALSE;
|
||||||
ensure_no_surface (window);
|
ensure_no_mir_window (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1415,8 +1418,9 @@ gdk_mir_window_impl_set_type_hint (GdkWindow *window,
|
|||||||
if (type_hint_differs (hint, impl->type_hint))
|
if (type_hint_differs (hint, impl->type_hint))
|
||||||
{
|
{
|
||||||
impl->type_hint = hint;
|
impl->type_hint = hint;
|
||||||
if (impl->surface && !impl->pending_spec_update)
|
|
||||||
update_surface_spec (window);
|
if (impl->mir_window && !impl->pending_spec_update)
|
||||||
|
update_window_spec (window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1438,8 +1442,8 @@ gdk_mir_window_impl_set_modal_hint (GdkWindow *window,
|
|||||||
{
|
{
|
||||||
impl->modal = modal;
|
impl->modal = modal;
|
||||||
|
|
||||||
if (impl->surface && !impl->pending_spec_update)
|
if (impl->mir_window && !impl->pending_spec_update)
|
||||||
update_surface_spec (window);
|
update_window_spec (window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1471,17 +1475,18 @@ gdk_mir_window_impl_set_geometry_hints (GdkWindow *window,
|
|||||||
{
|
{
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
||||||
|
MirWindowSpec *spec;
|
||||||
//g_printerr ("gdk_mir_window_impl_set_geometry_hints window=%p impl=%p\n", window, impl);
|
//g_printerr ("gdk_mir_window_impl_set_geometry_hints window=%p impl=%p\n", window, impl);
|
||||||
|
|
||||||
impl->geometry_hints = *geometry;
|
impl->geometry_hints = *geometry;
|
||||||
impl->geometry_mask = geom_mask;
|
impl->geometry_mask = geom_mask;
|
||||||
|
|
||||||
if (impl->surface && !impl->pending_spec_update)
|
if (impl->mir_window && !impl->pending_spec_update)
|
||||||
{
|
{
|
||||||
MirSurfaceSpec* spec = mir_connection_create_spec_for_changes (connection);
|
spec = mir_create_window_spec (connection);
|
||||||
apply_geometry_hints (spec, impl);
|
apply_geometry_hints (spec, impl);
|
||||||
mir_surface_apply_spec (impl->surface, spec);
|
mir_window_apply_spec (impl->mir_window, spec);
|
||||||
mir_surface_spec_release (spec);
|
mir_window_spec_release (spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1491,16 +1496,18 @@ gdk_mir_window_impl_set_title (GdkWindow *window,
|
|||||||
{
|
{
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
||||||
|
MirWindowSpec *spec;
|
||||||
//g_printerr ("gdk_mir_window_impl_set_title window=%p\n", window);
|
//g_printerr ("gdk_mir_window_impl_set_title window=%p\n", window);
|
||||||
|
|
||||||
g_free (impl->title);
|
g_free (impl->title);
|
||||||
impl->title = g_strdup (title);
|
impl->title = g_strdup (title);
|
||||||
if (impl->surface && !impl->pending_spec_update)
|
|
||||||
|
if (impl->mir_window && !impl->pending_spec_update)
|
||||||
{
|
{
|
||||||
MirSurfaceSpec* spec = mir_connection_create_spec_for_changes (connection);
|
spec = mir_create_window_spec (connection);
|
||||||
mir_surface_spec_set_name (spec, impl->title);
|
mir_window_spec_set_name (spec, impl->title);
|
||||||
mir_surface_apply_spec (impl->surface, spec);
|
mir_window_apply_spec (impl->mir_window, spec);
|
||||||
mir_surface_spec_release (spec);
|
mir_window_spec_release (spec);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1531,8 +1538,8 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window,
|
|||||||
/* Link this window to the parent */
|
/* Link this window to the parent */
|
||||||
impl->transient_for = parent;
|
impl->transient_for = parent;
|
||||||
|
|
||||||
if (impl->surface && !impl->pending_spec_update)
|
if (impl->mir_window && !impl->pending_spec_update)
|
||||||
update_surface_spec (window);
|
update_window_spec (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1612,21 +1619,21 @@ static void
|
|||||||
gdk_mir_window_impl_maximize (GdkWindow *window)
|
gdk_mir_window_impl_maximize (GdkWindow *window)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_window_impl_maximize window=%p\n", window);
|
//g_printerr ("gdk_mir_window_impl_maximize window=%p\n", window);
|
||||||
set_surface_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_surface_state_maximized);
|
set_window_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_window_state_maximized);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_mir_window_impl_unmaximize (GdkWindow *window)
|
gdk_mir_window_impl_unmaximize (GdkWindow *window)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_window_impl_unmaximize window=%p\n", window);
|
//g_printerr ("gdk_mir_window_impl_unmaximize window=%p\n", window);
|
||||||
set_surface_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_surface_state_restored);
|
set_window_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_window_state_restored);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gdk_mir_window_impl_fullscreen (GdkWindow *window)
|
gdk_mir_window_impl_fullscreen (GdkWindow *window)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_window_impl_fullscreen window=%p\n", window);
|
//g_printerr ("gdk_mir_window_impl_fullscreen window=%p\n", window);
|
||||||
set_surface_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_surface_state_fullscreen);
|
set_window_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_window_state_fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1639,7 +1646,7 @@ static void
|
|||||||
gdk_mir_window_impl_unfullscreen (GdkWindow *window)
|
gdk_mir_window_impl_unfullscreen (GdkWindow *window)
|
||||||
{
|
{
|
||||||
//g_printerr ("gdk_mir_window_impl_unfullscreen window=%p\n", window);
|
//g_printerr ("gdk_mir_window_impl_unfullscreen window=%p\n", window);
|
||||||
set_surface_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_surface_state_restored);
|
set_window_state (GDK_MIR_WINDOW_IMPL (window->impl), mir_window_state_restored);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2328,8 +2335,8 @@ _gdk_mir_window_get_egl_surface (GdkWindow *window,
|
|||||||
EGLDisplay egl_display;
|
EGLDisplay egl_display;
|
||||||
EGLNativeWindowType egl_window;
|
EGLNativeWindowType egl_window;
|
||||||
|
|
||||||
ensure_no_surface (window);
|
ensure_no_mir_window (window);
|
||||||
ensure_surface_full (window, mir_buffer_usage_hardware);
|
ensure_mir_window_full (window, mir_buffer_usage_hardware);
|
||||||
|
|
||||||
egl_display = _gdk_mir_display_get_egl_display (gdk_window_get_display (window));
|
egl_display = _gdk_mir_display_get_egl_display (gdk_window_get_display (window));
|
||||||
egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (impl->buffer_stream);
|
egl_window = (EGLNativeWindowType) mir_buffer_stream_get_egl_native_window (impl->buffer_stream);
|
||||||
@ -2369,23 +2376,26 @@ _gdk_mir_window_get_dummy_egl_surface (GdkWindow *window,
|
|||||||
MirSurface *
|
MirSurface *
|
||||||
gdk_mir_window_get_mir_surface (GdkWindow *window)
|
gdk_mir_window_get_mir_surface (GdkWindow *window)
|
||||||
{
|
{
|
||||||
GdkMirWindowImpl *impl;
|
return _gdk_mir_window_get_mir_window (window);
|
||||||
|
}
|
||||||
|
|
||||||
|
MirWindow *
|
||||||
|
_gdk_mir_window_get_mir_window (GdkWindow *window)
|
||||||
|
{
|
||||||
g_return_val_if_fail (GDK_IS_MIR_WINDOW (window), NULL);
|
g_return_val_if_fail (GDK_IS_MIR_WINDOW (window), NULL);
|
||||||
|
|
||||||
impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
return GDK_MIR_WINDOW_IMPL (window->impl)->mir_window;
|
||||||
|
|
||||||
return impl->surface;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_gdk_mir_window_set_surface_output (GdkWindow *window, gdouble scale)
|
_gdk_mir_window_set_scale (GdkWindow *window,
|
||||||
|
gdouble scale)
|
||||||
{
|
{
|
||||||
// g_printerr ("_gdk_mir_window_impl_set_surface_output impl=%p\n", impl);
|
|
||||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||||
GdkRectangle area = {0, 0, window->width, window->height};
|
GdkRectangle area = {0, 0, window->width, window->height};
|
||||||
cairo_region_t *region;
|
cairo_region_t *region;
|
||||||
gint new_scale = (gint) round (scale);
|
gint new_scale = (gint) round (scale);
|
||||||
|
// g_printerr ("_gdk_mir_window_set_scale impl=%p\n", impl);
|
||||||
|
|
||||||
if (impl->output_scale != new_scale)
|
if (impl->output_scale != new_scale)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user