Compare commits

...

2 Commits

Author SHA1 Message Date
Niels De Graef
7efb315568 WIP 2018-11-19 14:19:44 +01:00
Niels De Graef
2dfcf8dcac CI: add uncrustify config.
Run in the repo's root directory with for example

```
$ uncrustify -c data/uncrustify.cfg src/**/*.c
```
2018-11-19 14:19:39 +01:00
192 changed files with 12615 additions and 9525 deletions

112
data/uncrustify.cfg Normal file
View File

@ -0,0 +1,112 @@
# Enorces he code style of Mutter (based on GNU)
code_width = 80
# indent using tabs
output_tab_size = 2
indent_columns = output_tab_size
indent_with_tabs = 0
indent_brace = 2
# indent case
indent_switch_case = 0
# indent_case_brace = 0
# newlines
newlines = lf
nl_after_semicolon = true
nl_start_of_file = remove
nl_end_of_file = force
nl_end_of_file_min = 1
# spaces
sp_return_paren = force # "return (1);" vs "return(1);"
sp_sizeof_paren = force # "sizeof (int)" vs "sizeof(int)"
sp_assign = force
sp_arith = force
sp_bool = force
sp_compare = force
sp_after_comma = force
sp_case_label = force
sp_else_brace = force
sp_brace_else = force
sp_func_call_paren = force # "foo (" vs "foo("
sp_func_proto_paren = force # "int foo ();" vs "int foo();"
sp_before_ptr_star = force
sp_after_ptr_star_qualifier = force # "const char * const" vs. "const char *const"
sp_after_ptr_star = remove
sp_between_ptr_star = remove # "**var" vs "* *var"
sp_inside_paren = remove # "( 1 )" vs "(1)"
sp_inside_fparen = remove # "( 1 )" vs "(1)" - functions
sp_inside_sparen = remove # "( 1 )" vs "(1)" - if/for/etc
sp_after_cast = force # "(int) a" vs "(int)a"
sp_func_call_user_paren = remove # For gettext, "_()" vs. "_ ()"
set func_call_user _ N_ C_ # Needed for sp_after_cast
sp_before_semi = remove
sp_paren_paren = remove # Space between (( and ))
eat_blanks_before_close_brace = true
eat_blanks_after_open_brace = true
# Style for curly braces
nl_assign_brace = add
nl_enum_brace = add
nl_union_brace = add
nl_struct_brace = add
nl_class_brace = add
nl_do_brace = add
nl_if_brace = add
nl_for_brace = add
nl_else_brace = add
nl_elseif_brace = add
nl_while_brace = add
nl_switch_brace = add
nl_fcall_brace = add
nl_fdef_brace = add
nl_brace_else = add
nl_brace_while = add
nl_case_colon_brace = add
nl_after_brace_open = true
# Function calls and parameters
nl_func_paren = remove
nl_func_def_paren = remove
nl_func_decl_start = remove
nl_func_def_start = remove
nl_func_decl_args = ignore
nl_func_def_args = ignore
nl_func_decl_args_multi_line = force
nl_func_def_args_multi_line = force
nl_func_decl_end = remove
nl_func_def_end = remove
# Code modifying options (non-whitespace)
mod_full_brace_function = force
mod_remove_extra_semicolon = true
# Align
align_func_params = true
align_single_line_func = true
align_var_def_star_style = 2
# one liners
nl_func_leave_one_liners = true
nl_enum_leave_one_liners = true
nl_assign_leave_one_liners = true
# Comments
cmt_cpp_to_c = true # "/* */" vs. "//"
cmt_convert_tab_to_spaces = true
#cmt_reflow_mode = 2 # Full reflow (seems doesn't work quite well, it doesn't reorder the comments)
cmt_width = 80 # Line width
cmt_star_cont = true # Whether to put a star on subsequent comment lines
cmt_sp_after_star_cont = 1 # The number of spaces to insert after the star on subsequent comment lines
cmt_c_nl_start = false # false/true
cmt_c_nl_end = true # false/true
# For multi-line comments with a '*' lead, remove leading spaces if the first and last lines of
# the comment are the same length. Default=True
cmt_multi_check_last = false
# Encoding
utf8_bom = remove
utf8_force = true

View File

@ -337,10 +337,14 @@ decode_standard_timings (const uchar *edid, MonitorInfo *info)
switch (get_bits (second, 6, 7))
{
case 0x00: h = (w / 16) * 10; break;
case 0x01: h = (w / 4) * 3; break;
case 0x02: h = (w / 5) * 4; break;
case 0x03: h = (w / 16) * 9; break;
case 0x00: h = (w / 16) * 10;
break;
case 0x01: h = (w / 4) * 3;
break;
case 0x02: h = (w / 5) * 4;
break;
case 0x03: h = (w / 16) * 9;
break;
}
info->standard[i].width = w;
@ -494,7 +498,8 @@ decode_descriptors (const uchar *edid, MonitorInfo *info)
}
else
{
decode_detailed_timing (edid + index, &(info->detailed_timings[timing_idx++]));
decode_detailed_timing (edid + index,
&(info->detailed_timings[timing_idx++]));
}
}

View File

@ -153,7 +153,8 @@ meta_backend_finalize (GObject *object)
#endif
if (priv->sleep_signal_id)
g_dbus_connection_signal_unsubscribe (priv->system_bus, priv->sleep_signal_id);
g_dbus_connection_signal_unsubscribe (priv->system_bus,
priv->sleep_signal_id);
if (priv->upower_watch_id)
g_bus_unwatch_name (priv->upower_watch_id);
g_cancellable_cancel (priv->cancellable);
@ -206,7 +207,8 @@ meta_backend_monitors_changed (MetaBackend *backend)
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
ClutterInputDevice *device = clutter_device_manager_get_core_device (manager,
CLUTTER_POINTER_DEVICE);
ClutterPoint point;
meta_backend_sync_screen_size (backend);
@ -277,7 +279,8 @@ create_device_monitor (MetaBackend *backend,
g_assert (g_hash_table_lookup (priv->device_monitors, &device_id) == NULL);
idle_monitor = meta_backend_create_idle_monitor (backend, device_id);
g_hash_table_insert (priv->device_monitors, &idle_monitor->device_id, idle_monitor);
g_hash_table_insert (priv->device_monitors, &idle_monitor->device_id,
idle_monitor);
}
static void
@ -313,8 +316,10 @@ on_device_added (ClutterDeviceManager *device_manager,
static inline gboolean
device_is_slave_touchscreen (ClutterInputDevice *device)
{
return (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE);
return (clutter_input_device_get_device_mode (device) !=
CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_device_type (device) ==
CLUTTER_TOUCHSCREEN_DEVICE);
}
static inline gboolean
@ -328,10 +333,13 @@ check_has_pointing_device (ClutterDeviceManager *manager)
{
ClutterInputDevice *device = devices->data;
if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER)
if (clutter_input_device_get_device_mode (device) ==
CLUTTER_INPUT_MODE_MASTER)
continue;
if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
clutter_input_device_get_device_type (device) == CLUTTER_KEYBOARD_DEVICE)
if (clutter_input_device_get_device_type (device) ==
CLUTTER_TOUCHSCREEN_DEVICE ||
clutter_input_device_get_device_type (device) ==
CLUTTER_KEYBOARD_DEVICE)
continue;
return TRUE;
@ -351,8 +359,10 @@ check_has_slave_touchscreen (ClutterDeviceManager *manager)
{
ClutterInputDevice *device = devices->data;
if (clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE)
if (clutter_input_device_get_device_mode (device) !=
CLUTTER_INPUT_MODE_MASTER &&
clutter_input_device_get_device_type (device) ==
CLUTTER_TOUCHSCREEN_DEVICE)
return TRUE;
}
@ -458,7 +468,8 @@ meta_backend_real_post_init (MetaBackend *backend)
meta_backend_sync_screen_size (backend);
priv->cursor_renderer = META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend);
priv->cursor_renderer =
META_BACKEND_GET_CLASS (backend)->create_cursor_renderer (backend);
priv->device_monitors =
g_hash_table_new_full (g_int_hash, g_int_equal,
@ -478,7 +489,8 @@ meta_backend_real_post_init (MetaBackend *backend)
#ifdef HAVE_REMOTE_DESKTOP
priv->remote_access_controller =
g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL);
priv->dbus_session_watcher = g_object_new (META_TYPE_DBUS_SESSION_WATCHER, NULL);
priv->dbus_session_watcher = g_object_new (META_TYPE_DBUS_SESSION_WATCHER,
NULL);
priv->screen_cast = meta_screen_cast_new (priv->dbus_session_watcher);
priv->remote_desktop = meta_remote_desktop_new (priv->dbus_session_watcher);
#endif /* HAVE_REMOTE_DESKTOP */
@ -683,7 +695,8 @@ meta_backend_class_init (MetaBackendClass *klass)
klass->grab_device = meta_backend_real_grab_device;
klass->ungrab_device = meta_backend_real_ungrab_device;
klass->select_stage_events = meta_backend_real_select_stage_events;
klass->get_relative_motion_deltas = meta_backend_real_get_relative_motion_deltas;
klass->get_relative_motion_deltas =
meta_backend_real_get_relative_motion_deltas;
klass->is_lid_closed = meta_backend_real_is_lid_closed;
signals[KEYMAP_CHANGED] =
@ -795,7 +808,8 @@ meta_backend_initable_init (GInitable *initable,
priv->egl = g_object_new (META_TYPE_EGL, NULL);
#endif
priv->orientation_manager = g_object_new (META_TYPE_ORIENTATION_MANAGER, NULL);
priv->orientation_manager =
g_object_new (META_TYPE_ORIENTATION_MANAGER, NULL);
priv->monitor_manager = meta_backend_create_monitor_manager (backend, error);
if (!priv->monitor_manager)
@ -967,7 +981,8 @@ meta_backend_grab_device (MetaBackend *backend,
int device_id,
uint32_t timestamp)
{
return META_BACKEND_GET_CLASS (backend)->grab_device (backend, device_id, timestamp);
return META_BACKEND_GET_CLASS (backend)->grab_device (backend, device_id,
timestamp);
}
/**
@ -978,7 +993,8 @@ meta_backend_ungrab_device (MetaBackend *backend,
int device_id,
uint32_t timestamp)
{
return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id, timestamp);
return META_BACKEND_GET_CLASS (backend)->ungrab_device (backend, device_id,
timestamp);
}
/**
@ -1004,7 +1020,8 @@ meta_backend_set_keymap (MetaBackend *backend,
const char *variants,
const char *options)
{
META_BACKEND_GET_CLASS (backend)->set_keymap (backend, layouts, variants, options);
META_BACKEND_GET_CLASS (backend)->set_keymap (backend, layouts, variants,
options);
}
/**
@ -1101,7 +1118,8 @@ meta_backend_update_last_device (MetaBackend *backend,
device = clutter_device_manager_get_device (manager, device_id);
if (!device ||
clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER)
clutter_input_device_get_device_mode (device) ==
CLUTTER_INPUT_MODE_MASTER)
return;
priv->current_device_id = device_id;
@ -1193,7 +1211,8 @@ event_dispatch (GSource *source,
return TRUE;
}
static GSourceFuncs event_funcs = {
static GSourceFuncs event_funcs =
{
event_prepare,
event_check,
event_dispatch

View File

@ -1,4 +1,5 @@
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; c-basic-offset: 2; -*- */
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; c-basic-offset: 2;
* -*- */
/**
* SECTION:barrier
@ -26,7 +27,8 @@
G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrier, meta_barrier, G_TYPE_OBJECT)
G_DEFINE_TYPE (MetaBarrierImpl, meta_barrier_impl, G_TYPE_OBJECT)
enum {
enum
{
PROP_0,
PROP_DISPLAY,
@ -42,7 +44,8 @@ enum {
static GParamSpec *obj_props[PROP_LAST];
enum {
enum
{
HIT,
LEFT,
@ -209,35 +212,40 @@ meta_barrier_class_init (MetaBarrierClass *klass)
"Display",
"The display to construct the pointer barrier on",
META_TYPE_DISPLAY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_X1] =
g_param_spec_int ("x1",
"X1",
"The first X coordinate of the barrier",
0, G_MAXSHORT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_Y1] =
g_param_spec_int ("y1",
"Y1",
"The first Y coordinate of the barrier",
0, G_MAXSHORT, 0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_X2] =
g_param_spec_int ("x2",
"X2",
"The second X coordinate of the barrier",
0, G_MAXSHORT, G_MAXSHORT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_Y2] =
g_param_spec_int ("y2",
"Y2",
"The second Y coordinate of the barrier",
0, G_MAXSHORT, G_MAXSHORT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_DIRECTIONS] =
g_param_spec_flags ("directions",
@ -245,7 +253,8 @@ meta_barrier_class_init (MetaBarrierClass *klass)
"A set of directions to let the pointer through",
META_TYPE_BARRIER_DIRECTION,
0,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
@ -300,7 +309,8 @@ meta_barrier_destroy (MetaBarrier *barrier)
static void
meta_barrier_init (MetaBarrier *barrier)
{
barrier->priv = G_TYPE_INSTANCE_GET_PRIVATE (barrier, META_TYPE_BARRIER, MetaBarrierPrivate);
barrier->priv = G_TYPE_INSTANCE_GET_PRIVATE (barrier, META_TYPE_BARRIER,
MetaBarrierPrivate);
}
void

View File

@ -46,13 +46,15 @@ struct _MetaCursorRendererPrivate
};
typedef struct _MetaCursorRendererPrivate MetaCursorRendererPrivate;
enum {
enum
{
CURSOR_PAINTED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL];
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRenderer, meta_cursor_renderer, G_TYPE_OBJECT);
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRenderer, meta_cursor_renderer,
G_TYPE_OBJECT);
void
meta_cursor_renderer_emit_painted (MetaCursorRenderer *renderer,
@ -65,7 +67,8 @@ static void
queue_redraw (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (
renderer);
MetaBackend *backend = meta_get_backend ();
ClutterActor *stage = meta_backend_get_stage (backend);
CoglTexture *texture;
@ -117,7 +120,8 @@ static void
meta_cursor_renderer_finalize (GObject *object)
{
MetaCursorRenderer *renderer = META_CURSOR_RENDERER (object);
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (
renderer);
MetaBackend *backend = meta_get_backend ();
ClutterActor *stage = meta_backend_get_stage (backend);
@ -180,11 +184,13 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
height = cogl_texture_get_height (texture);
return (ClutterRect) {
.origin = {
.origin =
{
.x = priv->current_x - (hot_x * texture_scale),
.y = priv->current_y - (hot_y * texture_scale)
},
.size = {
.size =
{
.width = width * texture_scale,
.height = height * texture_scale
}
@ -195,7 +201,8 @@ static void
meta_cursor_renderer_update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (
renderer);
gboolean handled_by_backend;
gboolean should_redraw = FALSE;
@ -230,7 +237,8 @@ void
meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (
renderer);
if (priv->displayed_cursor == cursor_sprite)
return;
@ -253,7 +261,8 @@ meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
float x,
float y)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (
renderer);
g_assert (meta_is_wayland_compositor ());
@ -278,7 +287,8 @@ meta_cursor_renderer_get_position (MetaCursorRenderer *renderer)
MetaCursorSprite *
meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer)
{
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (renderer);
MetaCursorRendererPrivate *priv = meta_cursor_renderer_get_instance_private (
renderer);
return priv->displayed_cursor;
}

View File

@ -160,7 +160,8 @@ load_from_current_xcursor_image (MetaCursorSpriteXcursor *sprite_xcursor)
}
void
meta_cursor_sprite_xcursor_set_theme_scale (MetaCursorSpriteXcursor *sprite_xcursor,
meta_cursor_sprite_xcursor_set_theme_scale (
MetaCursorSpriteXcursor *sprite_xcursor,
int theme_scale)
{
if (sprite_xcursor->theme_scale != theme_scale)
@ -178,7 +179,8 @@ meta_cursor_sprite_xcursor_is_animated (MetaCursorSprite *sprite)
}
XcursorImage *
meta_cursor_sprite_xcursor_get_current_image (MetaCursorSpriteXcursor *sprite_xcursor)
meta_cursor_sprite_xcursor_get_current_image (
MetaCursorSpriteXcursor *sprite_xcursor)
{
return sprite_xcursor->xcursor_images->images[sprite_xcursor->current_frame];
}

View File

@ -46,7 +46,8 @@
G_DEFINE_TYPE (MetaCursorTracker, meta_cursor_tracker, G_TYPE_OBJECT);
enum {
enum
{
CURSOR_CHANGED,
LAST_SIGNAL
};
@ -365,7 +366,8 @@ get_pointer_position_clutter (int *x,
ClutterPoint point;
cmanager = clutter_device_manager_get_default ();
cdevice = clutter_device_manager_get_core_device (cmanager, CLUTTER_POINTER_DEVICE);
cdevice = clutter_device_manager_get_core_device (cmanager,
CLUTTER_POINTER_DEVICE);
clutter_input_device_get_coords (cdevice, NULL, &point);
if (x)
@ -382,10 +384,12 @@ meta_cursor_tracker_get_pointer (MetaCursorTracker *tracker,
int *y,
ClutterModifierType *mods)
{
/* We can't use the clutter interface when not running as a wayland compositor,
because we need to query the server, rather than using the last cached value.
OTOH, on wayland we can't use GDK, because that only sees the events
we forward to xwayland.
/* We can't use the clutter interface when not running as a wayland
* compositor,
* because we need to query the server, rather than using the last cached
* value.
* OTOH, on wayland we can't use GDK, because that only sees the events
* we forward to xwayland.
*/
if (meta_is_wayland_compositor ())
get_pointer_position_clutter (x, y, (int *) mods);

View File

@ -92,7 +92,8 @@ meta_dbus_session_client_destroy (MetaDbusSessionClient *client)
}
static void
meta_dbus_session_watcher_destroy_client (MetaDbusSessionWatcher *session_watcher,
meta_dbus_session_watcher_destroy_client (
MetaDbusSessionWatcher *session_watcher,
MetaDbusSessionClient *client)
{
g_hash_table_remove (session_watcher->clients, client->dbus_name);
@ -169,7 +170,8 @@ meta_dbus_session_watcher_get_client (MetaDbusSessionWatcher *session_watcher,
}
void
meta_dbus_session_watcher_watch_session (MetaDbusSessionWatcher *session_watcher,
meta_dbus_session_watcher_watch_session (
MetaDbusSessionWatcher *session_watcher,
const char *client_dbus_name,
MetaDbusSession *session)
{

View File

@ -62,7 +62,8 @@ struct _MetaEgl
PFNEGLSTREAMCONSUMEROUTPUTEXTPROC eglStreamConsumerOutputEXT;
PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC eglStreamConsumerGLTextureExternalKHR;
PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC
eglStreamConsumerGLTextureExternalKHR;
PFNEGLSTREAMCONSUMERACQUIREKHRPROC eglStreamConsumerAcquireKHR;
PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC eglStreamConsumerAcquireAttribNV;
@ -84,46 +85,58 @@ get_egl_error_str (EGLint error_number)
return "The last function succeeded without error.";
break;
case EGL_NOT_INITIALIZED:
return "EGL is not initialized, or could not be initialized, for the specified EGL display connection.";
return
"EGL is not initialized, or could not be initialized, for the specified EGL display connection.";
break;
case EGL_BAD_ACCESS:
return "EGL cannot access a requested resource (for example a context is bound in another thread).";
return
"EGL cannot access a requested resource (for example a context is bound in another thread).";
break;
case EGL_BAD_ALLOC:
return "EGL failed to allocate resources for the requested operation.";
break;
case EGL_BAD_ATTRIBUTE:
return "An unrecognized attribute or attribute value was passed in the attribute list.";
return
"An unrecognized attribute or attribute value was passed in the attribute list.";
break;
case EGL_BAD_CONTEXT:
return "An EGLContext argument does not name a valid EGL rendering context.";
return
"An EGLContext argument does not name a valid EGL rendering context.";
break;
case EGL_BAD_CONFIG:
return "An EGLConfig argument does not name a valid EGL frame buffer configuration.";
return
"An EGLConfig argument does not name a valid EGL frame buffer configuration.";
break;
case EGL_BAD_CURRENT_SURFACE:
return "The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid.";
return
"The current surface of the calling thread is a window, pixel buffer or pixmap that is no longer valid.";
break;
case EGL_BAD_DISPLAY:
return "An EGLDisplay argument does not name a valid EGL display connection.";
return
"An EGLDisplay argument does not name a valid EGL display connection.";
break;
case EGL_BAD_SURFACE:
return "An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.";
return
"An EGLSurface argument does not name a valid surface (window, pixel buffer or pixmap) configured for GL rendering.";
break;
case EGL_BAD_MATCH:
return "Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).";
return
"Arguments are inconsistent (for example, a valid context requires buffers not supplied by a valid surface).";
break;
case EGL_BAD_PARAMETER:
return "One or more argument values are invalid.";
break;
case EGL_BAD_NATIVE_PIXMAP:
return "A NativePixmapType argument does not refer to a valid native pixmap.";
return
"A NativePixmapType argument does not refer to a valid native pixmap.";
break;
case EGL_BAD_NATIVE_WINDOW:
return "A NativeWindowType argument does not refer to a valid native window.";
return
"A NativeWindowType argument does not refer to a valid native window.";
break;
case EGL_CONTEXT_LOST:
return "A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering. ";
return
"A power management event has occurred. The application must destroy all contexts and reinitialise OpenGL ES state and objects to continue rendering. ";
break;
case EGL_BAD_STREAM_KHR:
return "An EGLStreamKHR argument does not name a valid EGL stream.";
@ -135,9 +148,11 @@ get_egl_error_str (EGLint error_number)
return "An EGLDeviceEXT argument does not name a valid EGL device.";
break;
case EGL_BAD_OUTPUT_LAYER_EXT:
return "An EGLOutputLayerEXT argument does not name a valid EGL output layer.";
return
"An EGLOutputLayerEXT argument does not name a valid EGL output layer.";
case EGL_RESOURCE_BUSY_EXT:
return "The operation could not be completed on the requested resource because it is temporary unavailable.";
return
"The operation could not be completed on the requested resource because it is temporary unavailable.";
default:
return "Unknown error";
break;
@ -312,7 +327,8 @@ meta_egl_choose_all_configs (MetaEgl *egl,
configs = g_new0 (EGLConfig, num_configs);
if (!eglChooseConfig (display, attrib_list, configs, num_configs, &num_matches))
if (!eglChooseConfig (display, attrib_list, configs, num_configs,
&num_matches))
{
g_free (configs);
set_egl_error (error);
@ -358,7 +374,8 @@ meta_egl_choose_first_config (MetaEgl *egl,
configs = g_new0 (EGLConfig, num_configs);
if (!eglChooseConfig (display, attrib_list, configs, num_configs, &num_matches))
if (!eglChooseConfig (display, attrib_list, configs, num_configs,
&num_matches))
{
g_free (configs);
set_egl_error (error);

View File

@ -65,7 +65,8 @@ handle_reset_idletime (MetaDBusIdleMonitor *skeleton,
return TRUE;
}
typedef struct {
typedef struct
{
MetaDBusIdleMonitor *dbus_monitor;
MetaIdleMonitor *monitor;
char *dbus_name;
@ -92,11 +93,14 @@ dbus_idle_callback (MetaIdleMonitor *monitor,
gpointer user_data)
{
DBusWatch *watch = user_data;
GDBusInterfaceSkeleton *skeleton = G_DBUS_INTERFACE_SKELETON (watch->dbus_monitor);
GDBusInterfaceSkeleton *skeleton = G_DBUS_INTERFACE_SKELETON (
watch->dbus_monitor);
g_dbus_connection_emit_signal (g_dbus_interface_skeleton_get_connection (skeleton),
g_dbus_connection_emit_signal (g_dbus_interface_skeleton_get_connection (
skeleton),
watch->dbus_name,
g_dbus_interface_skeleton_get_object_path (skeleton),
g_dbus_interface_skeleton_get_object_path (
skeleton),
"org.gnome.Mutter.IdleMonitor",
"WatchFired",
g_variant_new ("(u)", watch_id),
@ -123,8 +127,10 @@ make_dbus_watch (MetaDBusIdleMonitor *skeleton,
watch = g_slice_new (DBusWatch);
watch->dbus_monitor = g_object_ref (skeleton);
watch->monitor = g_object_ref (monitor);
watch->dbus_name = g_strdup (g_dbus_method_invocation_get_sender (invocation));
watch->name_watcher_id = g_bus_watch_name_on_connection (g_dbus_method_invocation_get_connection (invocation),
watch->dbus_name =
g_strdup (g_dbus_method_invocation_get_sender (invocation));
watch->name_watcher_id = g_bus_watch_name_on_connection (g_dbus_method_invocation_get_connection (
invocation),
watch->dbus_name,
G_BUS_NAME_WATCHER_FLAGS_NONE,
NULL, /* appeared */
@ -144,9 +150,11 @@ handle_add_idle_watch (MetaDBusIdleMonitor *skeleton,
watch = make_dbus_watch (skeleton, invocation, monitor);
watch->watch_id = meta_idle_monitor_add_idle_watch (monitor, interval,
dbus_idle_callback, watch, destroy_dbus_watch);
dbus_idle_callback, watch,
destroy_dbus_watch);
meta_dbus_idle_monitor_complete_add_idle_watch (skeleton, invocation, watch->watch_id);
meta_dbus_idle_monitor_complete_add_idle_watch (skeleton, invocation,
watch->watch_id);
return TRUE;
}
@ -160,10 +168,12 @@ handle_add_user_active_watch (MetaDBusIdleMonitor *skeleton,
watch = make_dbus_watch (skeleton, invocation, monitor);
watch->watch_id = meta_idle_monitor_add_user_active_watch (monitor,
dbus_idle_callback, watch,
dbus_idle_callback,
watch,
destroy_dbus_watch);
meta_dbus_idle_monitor_complete_add_user_active_watch (skeleton, invocation, watch->watch_id);
meta_dbus_idle_monitor_complete_add_user_active_watch (skeleton, invocation,
watch->watch_id);
return TRUE;
}
@ -192,7 +202,8 @@ create_monitor_skeleton (GDBusObjectManagerServer *manager,
g_signal_connect_object (skeleton, "handle-add-idle-watch",
G_CALLBACK (handle_add_idle_watch), monitor, 0);
g_signal_connect_object (skeleton, "handle-add-user-active-watch",
G_CALLBACK (handle_add_user_active_watch), monitor, 0);
G_CALLBACK (handle_add_user_active_watch), monitor,
0);
g_signal_connect_object (skeleton, "handle-remove-watch",
G_CALLBACK (handle_remove_watch), monitor, 0);
g_signal_connect_object (skeleton, "handle-reset-idletime",
@ -203,7 +214,8 @@ create_monitor_skeleton (GDBusObjectManagerServer *manager,
object = meta_dbus_object_skeleton_new (path);
meta_dbus_object_skeleton_set_idle_monitor (object, skeleton);
g_dbus_object_manager_server_export (manager, G_DBUS_OBJECT_SKELETON (object));
g_dbus_object_manager_server_export (manager,
G_DBUS_OBJECT_SKELETON (object));
g_object_unref (skeleton);
g_object_unref (object);
@ -214,7 +226,6 @@ on_device_added (ClutterDeviceManager *device_manager,
ClutterInputDevice *device,
GDBusObjectManagerServer *manager)
{
MetaIdleMonitor *monitor;
int device_id;
char *path;
@ -254,8 +265,9 @@ on_bus_acquired (GDBusConnection *connection,
manager = g_dbus_object_manager_server_new ("/org/gnome/Mutter/IdleMonitor");
/* We never clear the core monitor, as that's supposed to cumulate idle times from
all devices */
/* We never clear the core monitor, as that's supposed to cumulate idle times
* from
* all devices */
monitor = meta_idle_monitor_get_core ();
path = g_strdup ("/org/gnome/Mutter/IdleMonitor/Core");
create_monitor_skeleton (manager, monitor, path);

View File

@ -149,8 +149,10 @@ meta_idle_monitor_class_init (MetaIdleMonitorClass *klass)
"Device ID",
"The device to listen to idletime on",
0, 255, 0,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_DEVICE_ID, obj_props[PROP_DEVICE_ID]);
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_DEVICE_ID,
obj_props[PROP_DEVICE_ID]);
}
static void
@ -221,7 +223,8 @@ meta_idle_monitor_inhibited_actions_changed (GDBusProxy *session,
MetaIdleMonitor *monitor = user_data;
GVariant *v;
v = g_variant_lookup_value (changed, "InhibitedActions", G_VARIANT_TYPE_UINT32);
v =
g_variant_lookup_value (changed, "InhibitedActions", G_VARIANT_TYPE_UINT32);
if (v)
{
gboolean inhibited;
@ -323,7 +326,8 @@ idle_monitor_dispatch_timeout (GSource *source,
return TRUE;
}
static GSourceFuncs idle_monitor_source_funcs = {
static GSourceFuncs idle_monitor_source_funcs =
{
.prepare = NULL,
.check = NULL,
.dispatch = idle_monitor_dispatch_timeout,

View File

@ -90,7 +90,8 @@ struct _MetaInputSettingsPrivate
GHashTable *two_finger_devices;
/* Pad ring/strip emission */
struct {
struct
{
ClutterInputDevice *pad;
MetaPadActionType action;
guint number;
@ -108,7 +109,8 @@ typedef void (*ConfigUintFunc) (MetaInputSettings *input_settings,
ClutterInputDevice *device,
guint value);
typedef enum {
typedef enum
{
META_PAD_DIRECTION_NONE = -1,
META_PAD_DIRECTION_UP = 0,
META_PAD_DIRECTION_DOWN,
@ -116,7 +118,8 @@ typedef enum {
META_PAD_DIRECTION_CCW,
} MetaPadDirection;
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettings, meta_input_settings, G_TYPE_OBJECT)
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettings, meta_input_settings,
G_TYPE_OBJECT)
static GSList *
meta_input_settings_get_devices (MetaInputSettings * settings,
@ -134,7 +137,8 @@ meta_input_settings_get_devices (MetaInputSettings *settings,
ClutterInputDevice *device = devices->data;
if (clutter_input_device_get_device_type (device) == type &&
clutter_input_device_get_device_mode (device) != CLUTTER_INPUT_MODE_MASTER)
clutter_input_device_get_device_mode (device) !=
CLUTTER_INPUT_MODE_MASTER)
list = g_slist_prepend (list, device);
devices = devices->next;
@ -147,7 +151,8 @@ static void
meta_input_settings_dispose (GObject *object)
{
MetaInputSettings *settings = META_INPUT_SETTINGS (object);
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (settings);
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (
settings);
g_clear_object (&priv->virtual_pad_keyboard);
@ -426,20 +431,25 @@ update_device_speed (MetaInputSettings *input_settings,
if (device)
{
settings = get_settings_for_device_type (input_settings,
clutter_input_device_get_device_type (device));
clutter_input_device_get_device_type (
device));
if (!settings)
return;
settings_device_set_double_setting (input_settings, device, func,
g_settings_get_double (settings, key));
g_settings_get_double (settings,
key));
}
else
{
settings = get_settings_for_device_type (input_settings, CLUTTER_POINTER_DEVICE);
settings = get_settings_for_device_type (input_settings,
CLUTTER_POINTER_DEVICE);
settings_set_double_setting (input_settings, CLUTTER_POINTER_DEVICE, func,
g_settings_get_double (settings, key));
settings = get_settings_for_device_type (input_settings, CLUTTER_TOUCHPAD_DEVICE);
settings_set_double_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, func,
settings = get_settings_for_device_type (input_settings,
CLUTTER_TOUCHPAD_DEVICE);
settings_set_double_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
func,
g_settings_get_double (settings, key));
}
}
@ -457,7 +467,8 @@ update_device_natural_scroll (MetaInputSettings *input_settings,
if (device)
{
settings = get_settings_for_device_type (input_settings,
clutter_input_device_get_device_type (device));
clutter_input_device_get_device_type (
device));
if (!settings)
return;
@ -466,10 +477,12 @@ update_device_natural_scroll (MetaInputSettings *input_settings,
}
else
{
settings = get_settings_for_device_type (input_settings, CLUTTER_POINTER_DEVICE);
settings = get_settings_for_device_type (input_settings,
CLUTTER_POINTER_DEVICE);
settings_set_bool_setting (input_settings, CLUTTER_POINTER_DEVICE, func,
g_settings_get_boolean (settings, key));
settings = get_settings_for_device_type (input_settings, CLUTTER_TOUCHPAD_DEVICE);
settings = get_settings_for_device_type (input_settings,
CLUTTER_TOUCHPAD_DEVICE);
settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE, func,
g_settings_get_boolean (settings, key));
}
@ -496,7 +509,8 @@ update_touchpad_disable_while_typing (MetaInputSettings *input_settings,
if (device)
{
settings = get_settings_for_device_type (input_settings,
clutter_input_device_get_device_type (device));
clutter_input_device_get_device_type (
device));
if (!settings)
return;
@ -589,12 +603,16 @@ update_touchpad_edge_scroll (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
edge_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, "edge-scrolling-enabled");
two_finger_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, "two-finger-scrolling-enabled");
two_finger_scroll_available = g_hash_table_size (priv->two_finger_devices) > 0;
edge_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings,
"edge-scrolling-enabled");
two_finger_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings,
"two-finger-scrolling-enabled");
two_finger_scroll_available = g_hash_table_size (priv->two_finger_devices) >
0;
/* If both are enabled we prefer two finger. */
if (edge_scroll_enabled && two_finger_scroll_enabled && two_finger_scroll_available)
if (edge_scroll_enabled && two_finger_scroll_enabled &&
two_finger_scroll_available)
edge_scroll_enabled = FALSE;
if (device)
@ -625,7 +643,8 @@ update_touchpad_two_finger_scroll (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
two_finger_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings, "two-finger-scrolling-enabled");
two_finger_scroll_enabled = g_settings_get_boolean (priv->touchpad_settings,
"two-finger-scrolling-enabled");
/* Disable edge since they can't both be set. */
if (two_finger_scroll_enabled)
@ -720,12 +739,14 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
if (device && !input_settings_class->is_trackball_device (input_settings, device))
if (device &&
!input_settings_class->is_trackball_device (input_settings, device))
return;
/* This key is 'i' in the schema but it also specifies a minimum
* range of 0 so the cast here is safe. */
button = (guint) g_settings_get_int (priv->trackball_settings, "scroll-wheel-emulation-button");
button = (guint) g_settings_get_int (priv->trackball_settings,
"scroll-wheel-emulation-button");
if (device)
{
@ -741,8 +762,10 @@ update_trackball_scroll_button (MetaInputSettings *input_settings,
{
device = devices->data;
if (input_settings_class->is_trackball_device (input_settings, device))
input_settings_class->set_scroll_button (input_settings, device, button);
if (input_settings_class->is_trackball_device (input_settings,
device))
input_settings_class->set_scroll_button (input_settings, device,
button);
devices = devices->next;
}
@ -868,7 +891,8 @@ update_tablet_keep_aspect (MetaInputSettings *input_settings,
device);
/* Keep aspect only makes sense in external tablets */
if (wacom_device &&
libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE)
libwacom_get_integration_flags (wacom_device) !=
WACOM_DEVICE_INTEGRATED_NONE)
return;
}
#endif
@ -905,14 +929,16 @@ update_device_display (MetaInputSettings *input_settings,
if (clutter_input_device_get_device_type (device) != CLUTTER_TABLET_DEVICE &&
clutter_input_device_get_device_type (device) != CLUTTER_PEN_DEVICE &&
clutter_input_device_get_device_type (device) != CLUTTER_ERASER_DEVICE &&
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHSCREEN_DEVICE)
clutter_input_device_get_device_type (device) !=
CLUTTER_TOUCHSCREEN_DEVICE)
return;
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
/* If mapping is relative, the device can move on all displays */
if (clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE ||
if (clutter_input_device_get_device_type (device) ==
CLUTTER_TOUCHSCREEN_DEVICE ||
clutter_input_device_get_mapping_mode (device) ==
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE)
meta_input_settings_find_monitor (input_settings, settings, device,
@ -949,7 +975,8 @@ update_tablet_mapping (MetaInputSettings *input_settings,
device);
/* Tablet mapping only makes sense on external tablets */
if (wacom_device &&
(libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE))
(libwacom_get_integration_flags (wacom_device) !=
WACOM_DEVICE_INTEGRATED_NONE))
return;
}
#endif
@ -990,7 +1017,8 @@ update_tablet_area (MetaInputSettings *input_settings,
/* Tablet area only makes sense on system/display integrated tablets */
if (wacom_device &&
(libwacom_get_integration_flags (wacom_device) &
(WACOM_DEVICE_INTEGRATED_SYSTEM | WACOM_DEVICE_INTEGRATED_DISPLAY)) == 0)
(WACOM_DEVICE_INTEGRATED_SYSTEM | WACOM_DEVICE_INTEGRATED_DISPLAY)) ==
0)
return;
}
#endif
@ -1031,7 +1059,8 @@ update_tablet_left_handed (MetaInputSettings *input_settings,
device);
/* Left handed mode only makes sense on external tablets */
if (wacom_device &&
(libwacom_get_integration_flags (wacom_device) != WACOM_DEVICE_INTEGRATED_NONE))
(libwacom_get_integration_flags (wacom_device) !=
WACOM_DEVICE_INTEGRATED_NONE))
return;
}
#endif
@ -1050,7 +1079,8 @@ meta_input_settings_changed_cb (GSettings *settings,
gpointer user_data)
{
MetaInputSettings *input_settings = META_INPUT_SETTINGS (user_data);
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings);
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (
input_settings);
if (settings == priv->mouse_settings)
{
@ -1140,10 +1170,12 @@ apply_mappable_device_settings (MetaInputSettings *input_settings,
}
}
struct _a11y_settings_flags_pair {
struct _a11y_settings_flags_pair
{
const char *name;
ClutterKeyboardA11yFlags flag;
} settings_flags_pair[] = {
} settings_flags_pair[] =
{
{ "enable", CLUTTER_A11Y_KEYBOARD_ENABLED },
{ "timeout-enable", CLUTTER_A11Y_TIMEOUT_ENABLED },
{ "mousekeys-enable", CLUTTER_A11Y_MOUSE_KEYS_ENABLED },
@ -1164,19 +1196,22 @@ static void
load_keyboard_a11y_settings (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings);
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (
input_settings);
ClutterKbdA11ySettings kbd_a11y_settings;
ClutterInputDevice *core_keyboard;
guint i;
core_keyboard = clutter_device_manager_get_core_device (priv->device_manager, CLUTTER_KEYBOARD_DEVICE);
core_keyboard = clutter_device_manager_get_core_device (priv->device_manager,
CLUTTER_KEYBOARD_DEVICE);
if (device && device != core_keyboard)
return;
kbd_a11y_settings.controls = 0;
for (i = 0; i < G_N_ELEMENTS (settings_flags_pair); i++)
{
if (g_settings_get_boolean (priv->a11y_settings, settings_flags_pair[i].name))
if (g_settings_get_boolean (priv->a11y_settings,
settings_flags_pair[i].name))
kbd_a11y_settings.controls |= settings_flags_pair[i].flag;
}
@ -1186,14 +1221,18 @@ load_keyboard_a11y_settings (MetaInputSettings *input_settings,
"slowkeys-delay");
kbd_a11y_settings.debounce_delay = g_settings_get_int (priv->a11y_settings,
"bouncekeys-delay");
kbd_a11y_settings.mousekeys_init_delay = g_settings_get_int (priv->a11y_settings,
kbd_a11y_settings.mousekeys_init_delay = g_settings_get_int (
priv->a11y_settings,
"mousekeys-init-delay");
kbd_a11y_settings.mousekeys_max_speed = g_settings_get_int (priv->a11y_settings,
kbd_a11y_settings.mousekeys_max_speed = g_settings_get_int (
priv->a11y_settings,
"mousekeys-max-speed");
kbd_a11y_settings.mousekeys_accel_time = g_settings_get_int (priv->a11y_settings,
kbd_a11y_settings.mousekeys_accel_time = g_settings_get_int (
priv->a11y_settings,
"mousekeys-accel-time");
clutter_device_manager_set_kbd_a11y_settings (priv->device_manager, &kbd_a11y_settings);
clutter_device_manager_set_kbd_a11y_settings (priv->device_manager,
&kbd_a11y_settings);
}
static void
@ -1202,7 +1241,8 @@ on_keyboard_a11y_settings_changed (ClutterDeviceManager *device_manager,
ClutterKeyboardA11yFlags what_changed,
MetaInputSettings *input_settings)
{
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (input_settings);
MetaInputSettingsPrivate *priv = meta_input_settings_get_instance_private (
input_settings);
guint i;
for (i = 0; i < G_N_ELEMENTS (settings_flags_pair); i++)
@ -1210,7 +1250,8 @@ on_keyboard_a11y_settings_changed (ClutterDeviceManager *device_manager,
if (settings_flags_pair[i].flag & what_changed)
g_settings_set_boolean (priv->a11y_settings,
settings_flags_pair[i].name,
(new_flags & settings_flags_pair[i].flag) ? TRUE : FALSE);
(new_flags &
settings_flags_pair[i].flag) ? TRUE : FALSE);
}
}
@ -1278,13 +1319,15 @@ lookup_tool_settings (ClutterInputDeviceTool *tool,
if (serial == 0)
{
path = g_strdup_printf ("/org/gnome/desktop/peripherals/stylus/default-%s:%s/",
path = g_strdup_printf (
"/org/gnome/desktop/peripherals/stylus/default-%s:%s/",
clutter_input_device_get_vendor_id (device),
clutter_input_device_get_product_id (device));
}
else
{
path = g_strdup_printf ("/org/gnome/desktop/peripherals/stylus/%lx/", serial);
path = g_strdup_printf ("/org/gnome/desktop/peripherals/stylus/%lx/",
serial);
}
tool_settings =
@ -1336,7 +1379,8 @@ lookup_pad_action_settings (ClutterInputDevice *device,
}
path = g_string_new (NULL);
g_string_append_printf (path, "/org/gnome/desktop/peripherals/tablets/%s:%s/%s%c",
g_string_append_printf (path,
"/org/gnome/desktop/peripherals/tablets/%s:%s/%s%c",
vendor, product, action_type, action_label);
if (detail_type)
@ -1347,7 +1391,8 @@ lookup_pad_action_settings (ClutterInputDevice *device,
g_string_append_c (path, '/');
settings = g_settings_new_with_path ("org.gnome.desktop.peripherals.tablet.pad-button",
settings = g_settings_new_with_path (
"org.gnome.desktop.peripherals.tablet.pad-button",
path->str);
g_string_free (path, TRUE);
@ -1421,7 +1466,8 @@ check_add_mappable_device (MetaInputSettings *input_settings,
WacomError *error = libwacom_error_new ();
info->wacom_device = libwacom_new_from_path (priv->wacom_db,
clutter_input_device_get_device_node (device),
clutter_input_device_get_device_node (
device),
WFALLBACK_NONE, error);
if (!info->wacom_device)
{
@ -1514,7 +1560,8 @@ update_stylus_pressure (MetaInputSettings *input_settings,
return;
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
input_settings_class->set_stylus_pressure (input_settings, device, tool, curve);
input_settings_class->set_stylus_pressure (input_settings, device, tool,
curve);
}
static void
@ -1576,7 +1623,8 @@ meta_input_settings_device_added (ClutterDeviceManager *device_manager,
ClutterInputDevice *device,
MetaInputSettings *input_settings)
{
if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER)
if (clutter_input_device_get_device_mode (device) ==
CLUTTER_INPUT_MODE_MASTER)
return;
evaluate_two_finger_scrolling (input_settings, device);
@ -1674,7 +1722,8 @@ check_mappable_devices (MetaInputSettings *input_settings)
{
ClutterInputDevice *device = l->data;
if (clutter_input_device_get_device_mode (device) == CLUTTER_INPUT_MODE_MASTER)
if (clutter_input_device_get_device_mode (device) ==
CLUTTER_INPUT_MODE_MASTER)
continue;
check_add_mappable_device (input_settings, device);
@ -1687,7 +1736,8 @@ meta_input_settings_constructed (GObject *object)
MetaInputSettings *input_settings = META_INPUT_SETTINGS (object);
GSList *devices, *d;
devices = meta_input_settings_get_devices (input_settings, CLUTTER_TOUCHPAD_DEVICE);
devices = meta_input_settings_get_devices (input_settings,
CLUTTER_TOUCHPAD_DEVICE);
for (d = devices; d; d = d->next)
evaluate_two_finger_scrolling (input_settings, d->data);
@ -1728,19 +1778,23 @@ meta_input_settings_init (MetaInputSettings *settings)
g_signal_connect (priv->mouse_settings, "changed",
G_CALLBACK (meta_input_settings_changed_cb), settings);
priv->touchpad_settings = g_settings_new ("org.gnome.desktop.peripherals.touchpad");
priv->touchpad_settings = g_settings_new (
"org.gnome.desktop.peripherals.touchpad");
g_signal_connect (priv->touchpad_settings, "changed",
G_CALLBACK (meta_input_settings_changed_cb), settings);
priv->trackball_settings = g_settings_new ("org.gnome.desktop.peripherals.trackball");
priv->trackball_settings = g_settings_new (
"org.gnome.desktop.peripherals.trackball");
g_signal_connect (priv->trackball_settings, "changed",
G_CALLBACK (meta_input_settings_changed_cb), settings);
priv->keyboard_settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
priv->keyboard_settings = g_settings_new (
"org.gnome.desktop.peripherals.keyboard");
g_signal_connect (priv->keyboard_settings, "changed",
G_CALLBACK (meta_input_settings_changed_cb), settings);
priv->gsd_settings = g_settings_new ("org.gnome.settings-daemon.peripherals.mouse");
priv->gsd_settings = g_settings_new (
"org.gnome.settings-daemon.peripherals.mouse");
g_settings_bind (priv->gsd_settings, "double-click",
clutter_settings_get_default (), "double-click-time",
@ -1753,10 +1807,12 @@ meta_input_settings_init (MetaInputSettings *settings)
G_CALLBACK (on_keyboard_a11y_settings_changed), settings);
priv->mappable_devices =
g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) device_mapping_info_free);
g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) device_mapping_info_free);
priv->current_tools =
g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) current_tool_info_free);
g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) current_tool_info_free);
priv->monitor_manager = g_object_ref (meta_monitor_manager_get ());
g_signal_connect (priv->monitor_manager, "monitors-changed-internal",
@ -1917,8 +1973,10 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings *input_settings,
g_return_if_fail (META_IS_INPUT_SETTINGS (input_settings));
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
g_return_if_fail (clutter_input_device_get_device_type (device) == CLUTTER_TABLET_DEVICE ||
clutter_input_device_get_device_type (device) == CLUTTER_PAD_DEVICE);
g_return_if_fail (clutter_input_device_get_device_type (
device) == CLUTTER_TABLET_DEVICE ||
clutter_input_device_get_device_type (
device) == CLUTTER_PAD_DEVICE);
priv = meta_input_settings_get_instance_private (input_settings);
info = g_hash_table_lookup (priv->mappable_devices, device);
@ -1928,7 +1986,8 @@ meta_input_settings_cycle_tablet_output (MetaInputSettings *input_settings,
if (info->wacom_device)
{
/* Output rotation only makes sense on external tablets */
if (libwacom_get_integration_flags (info->wacom_device) != WACOM_DEVICE_INTEGRATED_NONE)
if (libwacom_get_integration_flags (info->wacom_device) !=
WACOM_DEVICE_INTEGRATED_NONE)
return;
pretty_name = libwacom_get_name (info->wacom_device);
@ -1971,10 +2030,12 @@ emulate_modifiers (ClutterVirtualInputDevice *device,
ClutterKeyState state)
{
guint i;
struct {
struct
{
ClutterModifierType mod;
guint keyval;
} mod_map[] = {
} mod_map[] =
{
{ CLUTTER_SHIFT_MASK, CLUTTER_KEY_Shift_L },
{ CLUTTER_CONTROL_MASK, CLUTTER_KEY_Control_L },
{ CLUTTER_MOD1_MASK, CLUTTER_KEY_Meta_L }
@ -2039,12 +2100,14 @@ meta_input_settings_is_pad_button_grabbed (MetaInputSettings *input_settings,
g_return_val_if_fail (clutter_input_device_get_device_type (pad) ==
CLUTTER_PAD_DEVICE, FALSE);
return (meta_input_settings_get_pad_button_action (input_settings, pad, button) !=
return (meta_input_settings_get_pad_button_action (input_settings, pad,
button) !=
G_DESKTOP_PAD_BUTTON_ACTION_NONE);
}
static gboolean
meta_input_settings_handle_pad_button (MetaInputSettings *input_settings,
meta_input_settings_handle_pad_button (
MetaInputSettings *input_settings,
ClutterInputDevice *pad,
const ClutterPadButtonEvent *event)
{
@ -2082,7 +2145,8 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin
info->group_modes[group] = mode;
}
action = meta_input_settings_get_pad_button_action (input_settings, pad, button);
action = meta_input_settings_get_pad_button_action (input_settings, pad,
button);
switch (action)
{
@ -2096,7 +2160,8 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin
return TRUE;
case G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING:
settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON,
button, META_PAD_DIRECTION_NONE, -1);
button, META_PAD_DIRECTION_NONE,
-1);
accel = g_settings_get_string (settings, "keybinding");
meta_input_settings_emulate_keybinding (input_settings, accel, is_press);
g_object_unref (settings);
@ -2137,7 +2202,8 @@ meta_input_settings_handle_pad_action (MetaInputSettings *input_settings
}
static gboolean
meta_input_settings_get_pad_action_direction (MetaInputSettings *input_settings,
meta_input_settings_get_pad_action_direction (
MetaInputSettings *input_settings,
const ClutterEvent *event,
MetaPadDirection *direction)
{
@ -2310,7 +2376,8 @@ meta_input_settings_get_button_label (MetaInputSettings *input_settings,
return g_strdup_printf (_("Mode Switch (Group %d)"), group);
}
action = meta_input_settings_get_pad_button_action (input_settings, pad, button);
action = meta_input_settings_get_pad_button_action (input_settings, pad,
button);
switch (action)
{
@ -2320,7 +2387,8 @@ meta_input_settings_get_button_label (MetaInputSettings *input_settings,
gchar *accel;
settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON,
button, META_PAD_DIRECTION_NONE, -1);
button, META_PAD_DIRECTION_NONE,
-1);
accel = g_settings_get_string (settings, "keybinding");
g_object_unref (settings);

View File

@ -240,7 +240,8 @@ meta_logical_monitor_foreach_crtc (MetaLogicalMonitor *logical_monitor,
{
MetaMonitor *monitor = l->data;
MetaMonitorMode *mode;
ForeachCrtcData data = {
ForeachCrtcData data =
{
.logical_monitor = logical_monitor,
.func = func,
.user_data = user_data

View File

@ -337,7 +337,8 @@ is_lid_closed (MetaMonitorManager *monitor_manager)
}
MetaMonitorsConfigKey *
meta_create_monitors_config_key_for_current_state (MetaMonitorManager *monitor_manager)
meta_create_monitors_config_key_for_current_state (
MetaMonitorManager *monitor_manager)
{
MetaMonitorsConfigKey *config_key;
GList *l;
@ -399,7 +400,8 @@ meta_monitor_config_manager_get_stored (MetaMonitorConfigManager *config_manager
g_warning ("Failed to finish monitors config migration: %s",
error->message);
g_error_free (error);
meta_monitor_config_store_remove (config_manager->config_store, config);
meta_monitor_config_store_remove (config_manager->config_store,
config);
return NULL;
}
}
@ -414,7 +416,8 @@ typedef enum _MonitorMatchRule
} MonitorMatchRule;
static MetaMonitor *
find_monitor_with_highest_preferred_resolution (MetaMonitorManager *monitor_manager,
find_monitor_with_highest_preferred_resolution (
MetaMonitorManager *monitor_manager,
MonitorMatchRule match_rule)
{
GList *monitors;
@ -517,7 +520,8 @@ create_monitor_config (MetaMonitor *monitor,
}
static MetaLogicalMonitorConfig *
create_preferred_logical_monitor_config (MetaMonitorManager *monitor_manager,
create_preferred_logical_monitor_config (
MetaMonitorManager *monitor_manager,
MetaMonitor *monitor,
int x,
int y,
@ -570,7 +574,8 @@ create_preferred_logical_monitor_config (MetaMonitorManager *monitor_ma
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_create_linear (
MetaMonitorConfigManager *config_manager)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
GList *logical_monitor_configs;
@ -630,7 +635,8 @@ meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_mana
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_create_fallback (
MetaMonitorConfigManager *config_manager)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
MetaMonitor *primary_monitor;
@ -661,7 +667,8 @@ meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_ma
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_create_suggested (
MetaMonitorConfigManager *config_manager)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
MetaLogicalMonitorConfig *primary_logical_monitor_config = NULL;
@ -717,7 +724,8 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
if (meta_rectangle_overlaps_with_region (region,
&logical_monitor_config->layout))
{
g_warning ("Suggested monitor config has overlapping region, rejecting");
g_warning (
"Suggested monitor config has overlapping region, rejecting");
g_list_free (region);
g_list_free_full (logical_monitor_configs,
(GDestroyNotify) meta_logical_monitor_config_free);
@ -751,19 +759,23 @@ create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager,
MetaMonitorConfig *monitor_config;
MetaMonitorConfig *current_monitor_config;
if (!meta_monitor_manager_get_is_builtin_display_on (config_manager->monitor_manager))
if (!meta_monitor_manager_get_is_builtin_display_on (config_manager->
monitor_manager))
return NULL;
if (!config_manager->current_config)
return NULL;
if (g_list_length (config_manager->current_config->logical_monitor_configs) != 1)
if (g_list_length (config_manager->current_config->logical_monitor_configs) !=
1)
return NULL;
current_logical_monitor_config = config_manager->current_config->logical_monitor_configs->data;
current_logical_monitor_config =
config_manager->current_config->logical_monitor_configs->data;
if (rotate)
transform = (current_logical_monitor_config->transform + 1) % META_MONITOR_TRANSFORM_FLIPPED;
transform = (current_logical_monitor_config->transform + 1) %
META_MONITOR_TRANSFORM_FLIPPED;
else
{
/*
@ -785,24 +797,33 @@ create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager,
if (g_list_length (current_logical_monitor_config->monitor_configs) != 1)
return NULL;
current_monitor_config = current_logical_monitor_config->monitor_configs->data;
current_monitor_config =
current_logical_monitor_config->monitor_configs->data;
monitor_config = g_new0 (MetaMonitorConfig, 1);
*monitor_config = (MetaMonitorConfig) {
.monitor_spec = meta_monitor_spec_clone (current_monitor_config->monitor_spec),
.mode_spec = g_memdup (current_monitor_config->mode_spec, sizeof (MetaMonitorModeSpec)),
.monitor_spec = meta_monitor_spec_clone (
current_monitor_config->monitor_spec),
.mode_spec =
g_memdup (current_monitor_config->mode_spec,
sizeof (MetaMonitorModeSpec)),
.enable_underscanning = current_monitor_config->enable_underscanning
};
logical_monitor_config = g_memdup (current_logical_monitor_config, sizeof (MetaLogicalMonitorConfig));
logical_monitor_config->monitor_configs = g_list_append (NULL, monitor_config);
logical_monitor_config =
g_memdup (current_logical_monitor_config,
sizeof (MetaLogicalMonitorConfig));
logical_monitor_config->monitor_configs =
g_list_append (NULL, monitor_config);
logical_monitor_config->transform = transform;
if (meta_monitor_transform_is_rotated (current_logical_monitor_config->transform) !=
if (meta_monitor_transform_is_rotated (current_logical_monitor_config->
transform) !=
meta_monitor_transform_is_rotated (logical_monitor_config->transform))
{
int temp = logical_monitor_config->layout.width;
logical_monitor_config->layout.width = logical_monitor_config->layout.height;
logical_monitor_config->layout.width =
logical_monitor_config->layout.height;
logical_monitor_config->layout.height = temp;
}
@ -815,16 +836,19 @@ create_for_builtin_display_rotation (MetaMonitorConfigManager *config_manager,
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_for_orientation (MetaMonitorConfigManager *config_manager,
meta_monitor_config_manager_create_for_orientation (
MetaMonitorConfigManager *config_manager,
MetaMonitorTransform transform)
{
return create_for_builtin_display_rotation (config_manager, FALSE, transform);
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_for_rotate_monitor (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_create_for_rotate_monitor (
MetaMonitorConfigManager *config_manager)
{
return create_for_builtin_display_rotation (config_manager, TRUE, META_MONITOR_TRANSFORM_NORMAL);
return create_for_builtin_display_rotation (config_manager, TRUE,
META_MONITOR_TRANSFORM_NORMAL);
}
static MetaMonitorsConfig *
@ -914,9 +938,11 @@ create_for_switch_config_all_mirror (MetaMonitorConfigManager *config_manager)
if (!mode)
continue;
scale = meta_monitor_manager_calculate_monitor_mode_scale (monitor_manager, monitor, mode);
scale = meta_monitor_manager_calculate_monitor_mode_scale (
monitor_manager, monitor, mode);
best_scale = MAX (best_scale, scale);
monitor_configs = g_list_prepend (monitor_configs, create_monitor_config (monitor, mode));
monitor_configs =
g_list_prepend (monitor_configs, create_monitor_config (monitor, mode));
}
logical_monitor_config = g_new0 (MetaLogicalMonitorConfig, 1);
@ -1013,7 +1039,8 @@ create_for_switch_config_builtin (MetaMonitorConfigManager *config_manager)
}
MetaMonitorsConfig *
meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager *config_manager,
meta_monitor_config_manager_create_for_switch_config (
MetaMonitorConfigManager *config_manager,
MetaMonitorSwitchConfigType config_type)
{
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
@ -1049,7 +1076,8 @@ meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager
}
void
meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_manager,
meta_monitor_config_manager_set_current (
MetaMonitorConfigManager *config_manager,
MetaMonitorsConfig *config)
{
if (config_manager->current_config)
@ -1065,7 +1093,8 @@ meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_manage
}
void
meta_monitor_config_manager_save_current (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_save_current (
MetaMonitorConfigManager *config_manager)
{
g_return_if_fail (config_manager->current_config);
@ -1074,27 +1103,32 @@ meta_monitor_config_manager_save_current (MetaMonitorConfigManager *config_manag
}
MetaMonitorsConfig *
meta_monitor_config_manager_get_current (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_get_current (
MetaMonitorConfigManager *config_manager)
{
return config_manager->current_config;
}
MetaMonitorsConfig *
meta_monitor_config_manager_pop_previous (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_pop_previous (
MetaMonitorConfigManager *config_manager)
{
return g_queue_pop_head (&config_manager->config_history);
}
MetaMonitorsConfig *
meta_monitor_config_manager_get_previous (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_get_previous (
MetaMonitorConfigManager *config_manager)
{
return g_queue_peek_head (&config_manager->config_history);
}
void
meta_monitor_config_manager_clear_history (MetaMonitorConfigManager *config_manager)
meta_monitor_config_manager_clear_history (
MetaMonitorConfigManager *config_manager)
{
g_queue_foreach (&config_manager->config_history, (GFunc) g_object_unref, NULL);
g_queue_foreach (&config_manager->config_history, (GFunc) g_object_unref,
NULL);
g_queue_clear (&config_manager->config_history);
}
@ -1133,7 +1167,8 @@ meta_monitor_config_free (MetaMonitorConfig *monitor_config)
}
void
meta_logical_monitor_config_free (MetaLogicalMonitorConfig *logical_monitor_config)
meta_logical_monitor_config_free (
MetaLogicalMonitorConfig *logical_monitor_config)
{
g_list_free_full (logical_monitor_config->monitor_configs,
(GDestroyNotify) meta_monitor_config_free);
@ -1251,7 +1286,8 @@ meta_monitors_config_set_switch_config (MetaMonitorsConfig *config,
}
MetaMonitorsConfig *
meta_monitors_config_new_full (GList *logical_monitor_configs,
meta_monitors_config_new_full (
GList *logical_monitor_configs,
GList *disabled_monitor_specs,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitorsConfigFlag flags)
@ -1400,7 +1436,8 @@ meta_verify_monitor_config (MetaMonitorConfig *monitor_config,
}
gboolean
meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config,
meta_verify_logical_monitor_config (
MetaLogicalMonitorConfig *logical_monitor_config,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitorManager *monitor_manager,
GError **error)
@ -1494,7 +1531,8 @@ has_adjecent_neighbour (MetaMonitorsConfig *config,
}
gboolean
meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs,
meta_logical_monitor_configs_have_monitor (
GList *logical_monitor_configs,
MetaMonitorSpec *monitor_spec)
{
GList *l;
@ -1521,7 +1559,8 @@ static gboolean
meta_monitors_config_is_monitor_enabled (MetaMonitorsConfig *config,
MetaMonitorSpec *monitor_spec)
{
return meta_logical_monitor_configs_have_monitor (config->logical_monitor_configs,
return meta_logical_monitor_configs_have_monitor (
config->logical_monitor_configs,
monitor_spec);
}

View File

@ -24,7 +24,8 @@
*/
/*
* Portions of this file are derived from gnome-desktop/libgnome-desktop/gnome-rr-config.c
* Portions of this file are derived from
*gnome-desktop/libgnome-desktop/gnome-rr-config.c
*
* Copyright 2007, 2008, Red Hat, Inc.
* Copyright 2010 Giovanni Campagna
@ -44,7 +45,8 @@
#include "backends/meta-monitor-manager-private.h"
#include "meta/boxes.h"
#define META_MONITORS_CONFIG_MIGRATION_ERROR (meta_monitors_config_migration_error_quark ())
#define META_MONITORS_CONFIG_MIGRATION_ERROR ( \
meta_monitors_config_migration_error_quark ())
static GQuark meta_monitors_config_migration_error_quark (void);
G_DEFINE_QUARK (meta - monitors - config - migration - error - quark,
@ -616,7 +618,8 @@ handle_text (GMarkupParseContext *context,
}
}
static const GMarkupParser config_parser = {
static const GMarkupParser config_parser =
{
.start_element = handle_start_element,
.end_element = handle_end_element,
.text = handle_text,

View File

@ -207,9 +207,11 @@ handle_start_element (GMarkupParseContext *context,
return;
}
if (!g_markup_collect_attributes (element_name, attribute_names, attribute_values,
if (!g_markup_collect_attributes (element_name, attribute_names,
attribute_values,
error,
G_MARKUP_COLLECT_STRING, "version", &version,
G_MARKUP_COLLECT_STRING, "version",
&version,
G_MARKUP_COLLECT_INVALID))
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
@ -315,14 +317,15 @@ handle_start_element (GMarkupParseContext *context,
}
else if (g_str_equal (element_name, "monitor"))
{
parser->current_monitor_config = g_new0 (MetaMonitorConfig, 1);;
parser->current_monitor_config = g_new0 (MetaMonitorConfig, 1);
parser->state = STATE_MONITOR;
}
else
{
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
"Invalid monitor logicalmonitor element '%s'", element_name);
"Invalid monitor logicalmonitor element '%s'",
element_name);
return;
}
@ -492,7 +495,8 @@ handle_start_element (GMarkupParseContext *context,
}
static gboolean
derive_logical_monitor_layout (MetaLogicalMonitorConfig *logical_monitor_config,
derive_logical_monitor_layout (
MetaLogicalMonitorConfig *logical_monitor_config,
MetaLogicalMonitorLayoutMode layout_mode,
GError **error)
{
@ -1071,7 +1075,8 @@ handle_text (GMarkupParseContext *context,
}
}
static const GMarkupParser config_parser = {
static const GMarkupParser config_parser =
{
.start_element = handle_start_element,
.end_element = handle_end_element,
.text = handle_text
@ -1175,7 +1180,8 @@ append_monitors (GString *buffer,
g_string_append_printf (buffer, " <flag>interlace</flag>\n");
g_string_append (buffer, " </mode>\n");
if (monitor_config->enable_underscanning)
g_string_append (buffer, " <underscanning>yes</underscanning>\n");
g_string_append (buffer,
" <underscanning>yes</underscanning>\n");
g_string_append (buffer, " </monitor>\n");
}
}
@ -1324,7 +1330,8 @@ saved_cb (GObject *object,
{
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
g_warning ("Saving monitor configuration failed: %s\n", error->message);
g_warning ("Saving monitor configuration failed: %s\n",
error->message);
g_clear_object (&data->config_store->save_cancellable);
}
@ -1468,7 +1475,8 @@ meta_monitor_config_store_get_config_count (MetaMonitorConfigStore *config_store
}
MetaMonitorManager *
meta_monitor_config_store_get_monitor_manager (MetaMonitorConfigStore *config_store)
meta_monitor_config_store_get_monitor_manager (
MetaMonitorConfigStore *config_store)
{
return config_store->monitor_manager;
}

View File

@ -62,7 +62,8 @@ typedef struct _MetaOutputDummy
float scale;
} MetaOutputDummy;
G_DEFINE_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy, META_TYPE_MONITOR_MANAGER);
G_DEFINE_TYPE (MetaMonitorManagerDummy, meta_monitor_manager_dummy,
META_TYPE_MONITOR_MANAGER);
struct _MetaGpuDummy
{
@ -106,7 +107,8 @@ append_monitor (MetaMonitorManager *manager,
{
MetaMonitorManagerDummy *manager_dummy = META_MONITOR_MANAGER_DUMMY (manager);
MetaGpu *gpu = manager_dummy->gpu;
CrtcModeSpec mode_specs[] = {
CrtcModeSpec mode_specs[] =
{
{
.width = 800,
.height = 600,
@ -195,7 +197,8 @@ append_tiled_monitor (MetaMonitorManager *manager,
{
MetaMonitorManagerDummy *manager_dummy = META_MONITOR_MANAGER_DUMMY (manager);
MetaGpu *gpu = manager_dummy->gpu;
CrtcModeSpec mode_specs[] = {
CrtcModeSpec mode_specs[] =
{
{
.width = 800,
.height = 600,
@ -566,7 +569,8 @@ update_screen_size (MetaMonitorManager *manager,
}
static gboolean
meta_monitor_manager_dummy_apply_monitors_config (MetaMonitorManager *manager,
meta_monitor_manager_dummy_apply_monitors_config (
MetaMonitorManager *manager,
MetaMonitorsConfig *config,
MetaMonitorsConfigMethod method,
GError **error)
@ -621,7 +625,8 @@ meta_monitor_manager_dummy_is_transform_handled (MetaMonitorManager *manager,
}
static float
meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *manager,
meta_monitor_manager_dummy_calculate_monitor_mode_scale (
MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
@ -635,7 +640,8 @@ meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *man
}
static float *
meta_monitor_manager_dummy_calculate_supported_scales (MetaMonitorManager *manager,
meta_monitor_manager_dummy_calculate_supported_scales (
MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
@ -718,14 +724,21 @@ meta_monitor_manager_dummy_class_init (MetaMonitorManagerDummyClass *klass)
{
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_CLASS (klass);
manager_class->ensure_initial_config = meta_monitor_manager_dummy_ensure_initial_config;
manager_class->apply_monitors_config = meta_monitor_manager_dummy_apply_monitors_config;
manager_class->is_transform_handled = meta_monitor_manager_dummy_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_dummy_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_dummy_calculate_supported_scales;
manager_class->ensure_initial_config =
meta_monitor_manager_dummy_ensure_initial_config;
manager_class->apply_monitors_config =
meta_monitor_manager_dummy_apply_monitors_config;
manager_class->is_transform_handled =
meta_monitor_manager_dummy_is_transform_handled;
manager_class->calculate_monitor_mode_scale =
meta_monitor_manager_dummy_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales =
meta_monitor_manager_dummy_calculate_supported_scales;
manager_class->get_capabilities = meta_monitor_manager_dummy_get_capabilities;
manager_class->get_max_screen_size = meta_monitor_manager_dummy_get_max_screen_size;
manager_class->get_default_layout_mode = meta_monitor_manager_dummy_get_default_layout_mode;
manager_class->get_max_screen_size =
meta_monitor_manager_dummy_get_max_screen_size;
manager_class->get_default_layout_mode =
meta_monitor_manager_dummy_get_default_layout_mode;
}
static void

View File

@ -58,14 +58,16 @@ enum
static GParamSpec *obj_props[PROP_LAST];
enum {
enum
{
MONITORS_CHANGED_INTERNAL,
CONFIRM_DISPLAY_CHANGE,
SIGNALS_LAST
};
/* Array index matches MetaMonitorTransform */
static gfloat transform_matrices[][6] = {
static gfloat transform_matrices[][6] =
{
{ 1, 0, 0, 0, 1, 0 }, /* normal */
{ 0, -1, 1, 1, 0, 0 }, /* 90° */
{ -1, 0, 1, 0, -1, 1 }, /* 180° */
@ -78,10 +80,14 @@ static gfloat transform_matrices[][6] = {
static int signals[SIGNALS_LAST];
static void meta_monitor_manager_display_config_init (MetaDBusDisplayConfigIface *iface);
static void meta_monitor_manager_display_config_init (
MetaDBusDisplayConfigIface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaMonitorManager, meta_monitor_manager, META_DBUS_TYPE_DISPLAY_CONFIG_SKELETON,
G_IMPLEMENT_INTERFACE (META_DBUS_TYPE_DISPLAY_CONFIG, meta_monitor_manager_display_config_init));
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaMonitorManager, meta_monitor_manager,
META_DBUS_TYPE_DISPLAY_CONFIG_SKELETON,
G_IMPLEMENT_INTERFACE (
META_DBUS_TYPE_DISPLAY_CONFIG,
meta_monitor_manager_display_config_init));
static void initialize_dbus_interface (MetaMonitorManager *manager);
@ -234,7 +240,8 @@ derive_scale_from_config (MetaMonitorManager *manager,
}
static void
meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager *manager,
meta_monitor_manager_rebuild_logical_monitors_derived (
MetaMonitorManager *manager,
MetaMonitorsConfig *config)
{
GList *logical_monitors = NULL;
@ -320,7 +327,8 @@ power_save_mode_changed (MetaMonitorManager *manager,
gpointer user_data)
{
MetaMonitorManagerClass *klass;
int mode = meta_dbus_display_config_get_power_save_mode (META_DBUS_DISPLAY_CONFIG (manager));
int mode = meta_dbus_display_config_get_power_save_mode (META_DBUS_DISPLAY_CONFIG (
manager));
if (mode == META_POWER_SAVE_UNSUPPORTED)
return;
@ -328,7 +336,9 @@ power_save_mode_changed (MetaMonitorManager *manager,
/* If DPMS is unsupported, force the property back. */
if (manager->power_save_mode == META_POWER_SAVE_UNSUPPORTED)
{
meta_dbus_display_config_set_power_save_mode (META_DBUS_DISPLAY_CONFIG (manager), META_POWER_SAVE_UNSUPPORTED);
meta_dbus_display_config_set_power_save_mode (META_DBUS_DISPLAY_CONFIG (
manager),
META_POWER_SAVE_UNSUPPORTED);
return;
}
@ -374,7 +384,8 @@ meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager,
}
float *
meta_monitor_manager_calculate_supported_scales (MetaMonitorManager *manager,
meta_monitor_manager_calculate_supported_scales (
MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
@ -516,7 +527,8 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
}
}
config = meta_monitor_config_manager_create_suggested (manager->config_manager);
config =
meta_monitor_config_manager_create_suggested (manager->config_manager);
if (config)
{
if (!meta_monitor_manager_apply_monitors_config (manager,
@ -561,7 +573,8 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
}
config =
meta_monitor_config_manager_create_for_switch_config (manager->config_manager,
meta_monitor_config_manager_create_for_switch_config (
manager->config_manager,
META_MONITOR_SWITCH_CONFIG_ALL_LINEAR);
if (config)
{
@ -581,7 +594,8 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
}
}
config = meta_monitor_config_manager_create_fallback (manager->config_manager);
config =
meta_monitor_config_manager_create_fallback (manager->config_manager);
if (config)
{
if (!meta_monitor_manager_apply_monitors_config (manager,
@ -853,7 +867,8 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
}
static const double known_diagonals[] = {
static const double known_diagonals[] =
{
12.1,
13.3,
15.6
@ -973,7 +988,8 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
GDBusMethodInvocation *invocation)
{
MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton);
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (skeleton);
MetaMonitorManagerClass *manager_class = META_MONITOR_MANAGER_GET_CLASS (
skeleton);
GList *combined_modes;
GList *combined_outputs;
GList *combined_crtcs;
@ -988,7 +1004,8 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
combined_crtcs = combine_gpu_lists (manager, meta_gpu_get_crtcs);
g_variant_builder_init (&crtc_builder, G_VARIANT_TYPE ("a(uxiiiiiuaua{sv})"));
g_variant_builder_init (&output_builder, G_VARIANT_TYPE ("a(uxiausauaua{sv})"));
g_variant_builder_init (&output_builder,
G_VARIANT_TYPE ("a(uxiausauaua{sv})"));
g_variant_builder_init (&mode_builder, G_VARIANT_TYPE ("a(uxuudu)"));
for (l = combined_crtcs, i = 0; l; l = l->next, i++)
@ -1069,22 +1086,28 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
g_variant_builder_add (&properties, "{sv}", "height-mm",
g_variant_new_int32 (output->height_mm));
g_variant_builder_add (&properties, "{sv}", "display-name",
g_variant_new_take_string (make_display_name (manager, output)));
g_variant_new_take_string (make_display_name (
manager, output)));
g_variant_builder_add (&properties, "{sv}", "backlight",
g_variant_new_int32 (output->backlight));
g_variant_builder_add (&properties, "{sv}", "min-backlight-step",
g_variant_new_int32 ((output->backlight_max - output->backlight_min) ?
100 / (output->backlight_max - output->backlight_min) : -1));
g_variant_new_int32 ((output->backlight_max -
output->backlight_min) ?
100 /
(output->backlight_max -
output->backlight_min) : -1));
g_variant_builder_add (&properties, "{sv}", "primary",
g_variant_new_boolean (output->is_primary));
g_variant_builder_add (&properties, "{sv}", "presentation",
g_variant_new_boolean (output->is_presentation));
g_variant_builder_add (&properties, "{sv}", "connector-type",
g_variant_new_string (get_connector_type_name (output->connector_type)));
g_variant_new_string (get_connector_type_name (
output->connector_type)));
g_variant_builder_add (&properties, "{sv}", "underscanning",
g_variant_new_boolean (output->is_underscanning));
g_variant_builder_add (&properties, "{sv}", "supports-underscanning",
g_variant_new_boolean (output->supports_underscanning));
g_variant_new_boolean (output->
supports_underscanning));
edid_file = manager_class->get_edid_file (manager, output);
if (edid_file)
@ -1099,7 +1122,8 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
if (edid)
{
g_variant_builder_add (&properties, "{sv}", "edid",
g_variant_new_from_bytes (G_VARIANT_TYPE ("ay"),
g_variant_new_from_bytes (G_VARIANT_TYPE (
"ay"),
edid, TRUE));
g_bytes_unref (edid);
}
@ -1157,9 +1181,12 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
meta_dbus_display_config_complete_get_resources (skeleton,
invocation,
manager->serial,
g_variant_builder_end (&crtc_builder),
g_variant_builder_end (&output_builder),
g_variant_builder_end (&mode_builder),
g_variant_builder_end (&
crtc_builder),
g_variant_builder_end (&
output_builder),
g_variant_builder_end (&
mode_builder),
max_screen_width,
max_screen_height);
@ -1231,7 +1258,8 @@ cancel_persistent_confirmation (MetaMonitorManager *manager)
static void
request_persistent_confirmation (MetaMonitorManager *manager)
{
manager->persistent_timeout_id = g_timeout_add_seconds (meta_monitor_manager_get_display_configuration_timeout (),
manager->persistent_timeout_id = g_timeout_add_seconds (
meta_monitor_manager_get_display_configuration_timeout (),
save_config_timeout,
manager);
g_source_set_name_by_id (manager->persistent_timeout_id,
@ -1633,7 +1661,6 @@ create_monitor_config_from_variant (MetaMonitorManager *manager,
GVariant *monitor_config_variant,
GError **error)
{
MetaMonitorConfig *monitor_config = NULL;
g_autofree char *connector = NULL;
g_autofree char *mode_id = NULL;
@ -1665,7 +1692,8 @@ create_monitor_config_from_variant (MetaMonitorManager *manager,
return NULL;
}
g_variant_lookup (properties_variant, "underscanning", "b", &enable_underscanning);
g_variant_lookup (properties_variant, "underscanning", "b",
&enable_underscanning);
monitor_spec = meta_monitor_spec_clone (meta_monitor_get_spec (monitor));
@ -1781,7 +1809,8 @@ derive_logical_monitor_size (MetaMonitorConfig *monitor_config,
}
static MetaLogicalMonitorConfig *
create_logical_monitor_config_from_variant (MetaMonitorManager *manager,
create_logical_monitor_config_from_variant (
MetaMonitorManager *manager,
GVariant *logical_monitor_config_variant,
MetaLogicalMonitorLayoutMode layout_mode,
GError **error)
@ -1854,7 +1883,8 @@ create_logical_monitor_config_from_variant (MetaMonitorManager *manager
logical_monitor_config = g_new0 (MetaLogicalMonitorConfig, 1);
*logical_monitor_config = (MetaLogicalMonitorConfig) {
.layout = {
.layout =
{
.x = x,
.y = y,
.width = width,
@ -1896,7 +1926,8 @@ is_valid_layout_mode (MetaLogicalMonitorLayoutMode layout_mode)
}
static gboolean
meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skeleton,
meta_monitor_manager_handle_apply_monitors_config (
MetaDBusDisplayConfig *skeleton,
GDBusMethodInvocation *invocation,
guint serial,
guint method,
@ -2030,7 +2061,8 @@ meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skelet
if (method == META_MONITORS_CONFIG_METHOD_PERSISTENT)
request_persistent_confirmation (manager);
meta_dbus_display_config_complete_apply_monitors_config (skeleton, invocation);
meta_dbus_display_config_complete_apply_monitors_config (skeleton,
invocation);
return TRUE;
}
@ -2113,9 +2145,11 @@ meta_monitor_manager_handle_change_backlight (MetaDBusDisplayConfig *skeleton,
return TRUE;
}
META_MONITOR_MANAGER_GET_CLASS (manager)->change_backlight (manager, output, value);
META_MONITOR_MANAGER_GET_CLASS (manager)->change_backlight (manager, output,
value);
meta_dbus_display_config_complete_change_backlight (skeleton, invocation, output->backlight);
meta_dbus_display_config_complete_change_backlight (skeleton, invocation,
output->backlight);
return TRUE;
}
@ -2253,8 +2287,10 @@ meta_monitor_manager_display_config_init (MetaDBusDisplayConfigIface *iface)
iface->handle_change_backlight = meta_monitor_manager_handle_change_backlight;
iface->handle_get_crtc_gamma = meta_monitor_manager_handle_get_crtc_gamma;
iface->handle_set_crtc_gamma = meta_monitor_manager_handle_set_crtc_gamma;
iface->handle_get_current_state = meta_monitor_manager_handle_get_current_state;
iface->handle_apply_monitors_config = meta_monitor_manager_handle_apply_monitors_config;
iface->handle_get_current_state =
meta_monitor_manager_handle_get_current_state;
iface->handle_apply_monitors_config =
meta_monitor_manager_handle_apply_monitors_config;
}
static void
@ -2329,10 +2365,12 @@ meta_monitor_manager_get_logical_monitors (MetaMonitorManager *manager)
}
MetaLogicalMonitor *
meta_monitor_manager_get_logical_monitor_from_number (MetaMonitorManager *manager,
meta_monitor_manager_get_logical_monitor_from_number (
MetaMonitorManager *manager,
int number)
{
g_return_val_if_fail ((unsigned int) number < g_list_length (manager->logical_monitors), NULL);
g_return_val_if_fail ((unsigned int) number <
g_list_length (manager->logical_monitors), NULL);
return g_list_nth (manager->logical_monitors, number)->data;
}
@ -2784,7 +2822,8 @@ meta_output_parse_edid (MetaOutput *output,
output->product[0] == '\0')
{
g_clear_pointer (&output->product, g_free);
output->product = g_strdup_printf ("0x%04x", (unsigned) parsed_edid->product_code);
output->product = g_strdup_printf ("0x%04x",
(unsigned) parsed_edid->product_code);
}
output->serial = g_strndup (parsed_edid->dsc_serial_number, 14);
@ -2792,7 +2831,8 @@ meta_output_parse_edid (MetaOutput *output,
output->serial[0] == '\0')
{
g_clear_pointer (&output->serial, g_free);
output->serial = g_strdup_printf ("0x%08x", parsed_edid->serial_number);
output->serial =
g_strdup_printf ("0x%08x", parsed_edid->serial_number);
}
g_free (parsed_edid);
@ -2928,7 +2968,8 @@ meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager)
{
GError *error = NULL;
MetaMonitorsConfig *config =
meta_monitor_config_manager_create_for_rotate_monitor (manager->config_manager);
meta_monitor_config_manager_create_for_rotate_monitor (
manager->config_manager);
if (!config)
return;
@ -2955,7 +2996,8 @@ meta_monitor_manager_switch_config (MetaMonitorManager *manager,
g_return_if_fail (config_type != META_MONITOR_SWITCH_CONFIG_UNKNOWN);
config =
meta_monitor_config_manager_create_for_switch_config (manager->config_manager,
meta_monitor_config_manager_create_for_switch_config (
manager->config_manager,
config_type);
if (!config)
return;

View File

@ -123,7 +123,8 @@ gboolean
meta_monitor_spec_equals (MetaMonitorSpec *monitor_spec,
MetaMonitorSpec *other_monitor_spec)
{
return (g_str_equal (monitor_spec->connector, other_monitor_spec->connector) &&
return (g_str_equal (monitor_spec->connector,
other_monitor_spec->connector) &&
g_str_equal (monitor_spec->vendor, other_monitor_spec->vendor) &&
g_str_equal (monitor_spec->product, other_monitor_spec->product) &&
g_str_equal (monitor_spec->serial, other_monitor_spec->serial));
@ -638,7 +639,8 @@ meta_monitor_normal_class_init (MetaMonitorNormalClass *klass)
monitor_class->get_main_output = meta_monitor_normal_get_main_output;
monitor_class->derive_layout = meta_monitor_normal_derive_layout;
monitor_class->calculate_crtc_pos = meta_monitor_normal_calculate_crtc_pos;
monitor_class->get_suggested_position = meta_monitor_normal_get_suggested_position;
monitor_class->get_suggested_position =
meta_monitor_normal_get_suggested_position;
}
uint32_t
@ -702,37 +704,45 @@ calculate_tile_coordinate (MetaMonitor *monitor,
{
case META_MONITOR_TRANSFORM_NORMAL:
case META_MONITOR_TRANSFORM_FLIPPED:
if (other_output->tile_info.loc_v_tile == output->tile_info.loc_v_tile &&
if (other_output->tile_info.loc_v_tile ==
output->tile_info.loc_v_tile &&
other_output->tile_info.loc_h_tile < output->tile_info.loc_h_tile)
x += other_output->tile_info.tile_w;
if (other_output->tile_info.loc_h_tile == output->tile_info.loc_h_tile &&
if (other_output->tile_info.loc_h_tile ==
output->tile_info.loc_h_tile &&
other_output->tile_info.loc_v_tile < output->tile_info.loc_v_tile)
y += other_output->tile_info.tile_h;
break;
case META_MONITOR_TRANSFORM_180:
case META_MONITOR_TRANSFORM_FLIPPED_180:
if (other_output->tile_info.loc_v_tile == output->tile_info.loc_v_tile &&
if (other_output->tile_info.loc_v_tile ==
output->tile_info.loc_v_tile &&
other_output->tile_info.loc_h_tile > output->tile_info.loc_h_tile)
x += other_output->tile_info.tile_w;
if (other_output->tile_info.loc_h_tile == output->tile_info.loc_h_tile &&
if (other_output->tile_info.loc_h_tile ==
output->tile_info.loc_h_tile &&
other_output->tile_info.loc_v_tile > output->tile_info.loc_v_tile)
y += other_output->tile_info.tile_h;
break;
case META_MONITOR_TRANSFORM_270:
case META_MONITOR_TRANSFORM_FLIPPED_270:
if (other_output->tile_info.loc_v_tile == output->tile_info.loc_v_tile &&
if (other_output->tile_info.loc_v_tile ==
output->tile_info.loc_v_tile &&
other_output->tile_info.loc_h_tile < output->tile_info.loc_h_tile)
y += other_output->tile_info.tile_w;
if (other_output->tile_info.loc_h_tile == output->tile_info.loc_h_tile &&
if (other_output->tile_info.loc_h_tile ==
output->tile_info.loc_h_tile &&
other_output->tile_info.loc_v_tile < output->tile_info.loc_v_tile)
x += other_output->tile_info.tile_h;
break;
case META_MONITOR_TRANSFORM_90:
case META_MONITOR_TRANSFORM_FLIPPED_90:
if (other_output->tile_info.loc_v_tile == output->tile_info.loc_v_tile &&
if (other_output->tile_info.loc_v_tile ==
output->tile_info.loc_v_tile &&
other_output->tile_info.loc_h_tile > output->tile_info.loc_h_tile)
y += other_output->tile_info.tile_w;
if (other_output->tile_info.loc_h_tile == output->tile_info.loc_h_tile &&
if (other_output->tile_info.loc_h_tile ==
output->tile_info.loc_h_tile &&
other_output->tile_info.loc_v_tile > output->tile_info.loc_v_tile)
x += other_output->tile_info.tile_h;
break;
@ -1318,7 +1328,8 @@ meta_monitor_tiled_class_init (MetaMonitorTiledClass *klass)
monitor_class->get_main_output = meta_monitor_tiled_get_main_output;
monitor_class->derive_layout = meta_monitor_tiled_derive_layout;
monitor_class->calculate_crtc_pos = meta_monitor_tiled_calculate_crtc_pos;
monitor_class->get_suggested_position = meta_monitor_tiled_get_suggested_position;
monitor_class->get_suggested_position =
meta_monitor_tiled_get_suggested_position;
}
static void
@ -1368,7 +1379,8 @@ meta_monitor_mode_spec_equals (MetaMonitorModeSpec *monitor_mode_spec,
return (monitor_mode_spec->width == other_monitor_mode_spec->width &&
monitor_mode_spec->height == other_monitor_mode_spec->height &&
ABS (monitor_mode_spec->refresh_rate -
other_monitor_mode_spec->refresh_rate) < MAXIMUM_REFRESH_RATE_DIFF &&
other_monitor_mode_spec->refresh_rate) <
MAXIMUM_REFRESH_RATE_DIFF &&
monitor_mode_spec->flags == other_monitor_mode_spec->flags);
}
@ -1485,7 +1497,8 @@ meta_monitor_calculate_crtc_pos (MetaMonitor *monitor,
*/
#define HIDPI_MIN_HEIGHT 1200
/* From http://en.wikipedia.org/wiki/4K_resolution#Resolutions_of_common_formats */
/* From http://en.wikipedia.org/wiki/4K_resolution#Resolutions_of_common_formats
* */
#define SMALLEST_4K_WIDTH 3656
static float
@ -1612,7 +1625,6 @@ get_closest_scale_factor_for_resolution (float width,
do
{
for (j = 0; j < 2; j++)
{
float current_scale;

View File

@ -88,10 +88,13 @@ read_iio_proxy (MetaOrientationManager *self)
if (has_accel)
{
v = g_dbus_proxy_get_cached_property (self->iio_proxy, "AccelerometerOrientation");
v = g_dbus_proxy_get_cached_property (self->iio_proxy,
"AccelerometerOrientation");
if (v)
{
self->curr_orientation = orientation_from_string (g_variant_get_string (v, NULL));
self->curr_orientation = orientation_from_string (g_variant_get_string (
v,
NULL));
g_variant_unref (v);
}
}

View File

@ -87,7 +87,8 @@ meta_remote_access_handle_notify_stopped (MetaRemoteAccessHandle *handle)
}
void
meta_remote_access_controller_notify_new_handle (MetaRemoteAccessController *controller,
meta_remote_access_controller_notify_new_handle (
MetaRemoteAccessController *controller,
MetaRemoteAccessHandle *handle)
{
g_signal_emit (controller, controller_signals[CONTROLLER_NEW_HANDLE], 0,

View File

@ -38,7 +38,8 @@
#include "meta-dbus-remote-desktop.h"
#define META_REMOTE_DESKTOP_SESSION_DBUS_PATH "/org/gnome/Mutter/RemoteDesktop/Session"
#define META_REMOTE_DESKTOP_SESSION_DBUS_PATH \
"/org/gnome/Mutter/RemoteDesktop/Session"
enum _MetaRemoteDesktopNotifyAxisFlags
{
@ -65,7 +66,8 @@ struct _MetaRemoteDesktopSession
};
static void
meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface);
meta_remote_desktop_session_init_iface (
MetaDBusRemoteDesktopSessionIface *iface);
static void
meta_dbus_session_init_iface (MetaDbusSessionInterface *iface);
@ -73,7 +75,8 @@ meta_dbus_session_init_iface (MetaDbusSessionInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaRemoteDesktopSession,
meta_remote_desktop_session,
META_DBUS_TYPE_REMOTE_DESKTOP_SESSION_SKELETON,
G_IMPLEMENT_INTERFACE (META_DBUS_TYPE_REMOTE_DESKTOP_SESSION,
G_IMPLEMENT_INTERFACE (
META_DBUS_TYPE_REMOTE_DESKTOP_SESSION,
meta_remote_desktop_session_init_iface)
G_IMPLEMENT_INTERFACE (META_TYPE_DBUS_SESSION,
meta_dbus_session_init_iface))
@ -107,7 +110,8 @@ init_remote_access_handle (MetaRemoteDesktopSession *session)
session->handle = meta_remote_desktop_session_handle_new (session);
remote_access_controller = meta_backend_get_remote_access_controller (backend);
remote_access_controller =
meta_backend_get_remote_access_controller (backend);
remote_access_handle = META_REMOTE_ACCESS_HANDLE (session->handle);
meta_remote_access_controller_notify_new_handle (remote_access_controller,
remote_access_handle);
@ -197,7 +201,8 @@ on_screen_cast_session_closed (MetaScreenCastSession *screen_cast_session,
}
gboolean
meta_remote_desktop_session_register_screen_cast (MetaRemoteDesktopSession *session,
meta_remote_desktop_session_register_screen_cast (
MetaRemoteDesktopSession *session,
MetaScreenCastSession *screen_cast_session,
GError **error)
{
@ -452,7 +457,8 @@ handle_notify_pointer_axis (MetaDBusRemoteDesktopSession *skeleton,
CLUTTER_SCROLL_FINISHED_VERTICAL);
}
clutter_virtual_input_device_notify_scroll_continuous (session->virtual_pointer,
clutter_virtual_input_device_notify_scroll_continuous (
session->virtual_pointer,
CLUTTER_CURRENT_TIME,
dx, dy,
CLUTTER_SCROLL_SOURCE_FINGER,
@ -522,12 +528,14 @@ handle_notify_pointer_axis_discrete (MetaDBusRemoteDesktopSession *skeleton,
direction = discrete_steps_to_scroll_direction (axis, steps);
for (step_count = 0; step_count < abs (steps); step_count++)
clutter_virtual_input_device_notify_discrete_scroll (session->virtual_pointer,
clutter_virtual_input_device_notify_discrete_scroll (
session->virtual_pointer,
CLUTTER_CURRENT_TIME,
direction,
CLUTTER_SCROLL_SOURCE_WHEEL);
meta_dbus_remote_desktop_session_complete_notify_pointer_axis_discrete (skeleton,
meta_dbus_remote_desktop_session_complete_notify_pointer_axis_discrete (
skeleton,
invocation);
return TRUE;
@ -553,7 +561,8 @@ handle_notify_pointer_motion_relative (MetaDBusRemoteDesktopSession *skeleton,
CLUTTER_CURRENT_TIME,
dx, dy);
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_relative (skeleton,
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_relative (
skeleton,
invocation);
return TRUE;
@ -602,7 +611,8 @@ handle_notify_pointer_motion_absolute (MetaDBusRemoteDesktopSession *skeleton,
CLUTTER_CURRENT_TIME,
abs_x, abs_y);
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_absolute (skeleton,
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_absolute (
skeleton,
invocation);
return TRUE;
@ -699,7 +709,8 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
meta_screen_cast_stream_transform_position (stream, x, y, &abs_x, &abs_y);
clutter_virtual_input_device_notify_touch_motion (session->virtual_touchscreen,
clutter_virtual_input_device_notify_touch_motion (
session->virtual_touchscreen,
CLUTTER_CURRENT_TIME,
slot,
abs_x, abs_y);
@ -744,9 +755,12 @@ meta_remote_desktop_session_init_iface (MetaDBusRemoteDesktopSessionIface *iface
iface->handle_notify_keyboard_keysym = handle_notify_keyboard_keysym;
iface->handle_notify_pointer_button = handle_notify_pointer_button;
iface->handle_notify_pointer_axis = handle_notify_pointer_axis;
iface->handle_notify_pointer_axis_discrete = handle_notify_pointer_axis_discrete;
iface->handle_notify_pointer_motion_relative = handle_notify_pointer_motion_relative;
iface->handle_notify_pointer_motion_absolute = handle_notify_pointer_motion_absolute;
iface->handle_notify_pointer_axis_discrete =
handle_notify_pointer_axis_discrete;
iface->handle_notify_pointer_motion_relative =
handle_notify_pointer_motion_relative;
iface->handle_notify_pointer_motion_absolute =
handle_notify_pointer_motion_absolute;
iface->handle_notify_touch_down = handle_notify_touch_down;
iface->handle_notify_touch_motion = handle_notify_touch_motion;
iface->handle_notify_touch_up = handle_notify_touch_up;
@ -791,7 +805,8 @@ meta_remote_desktop_session_init (MetaRemoteDesktopSession *session)
session->session_id = meta_generate_random_id (rand, 32);
g_rand_free (rand);
meta_dbus_remote_desktop_session_set_session_id (skeleton, session->session_id);
meta_dbus_remote_desktop_session_set_session_id (skeleton,
session->session_id);
session->object_path =
g_strdup_printf (META_REMOTE_DESKTOP_SESSION_DBUS_PATH "/u%u",
@ -801,7 +816,6 @@ meta_remote_desktop_session_init (MetaRemoteDesktopSession *session)
static void
meta_remote_desktop_session_class_init (MetaRemoteDesktopSessionClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_remote_desktop_session_finalize;
@ -836,7 +850,8 @@ meta_remote_desktop_session_handle_init (MetaRemoteDesktopSessionHandle *handle)
}
static void
meta_remote_desktop_session_handle_class_init (MetaRemoteDesktopSessionHandleClass *klass)
meta_remote_desktop_session_handle_class_init (
MetaRemoteDesktopSessionHandleClass *klass)
{
MetaRemoteAccessHandleClass *remote_access_handle_class =
META_REMOTE_ACCESS_HANDLE_CLASS (klass);

View File

@ -120,7 +120,8 @@ meta_renderer_view_set_transform (MetaRendererView *view,
return;
view->transform = transform;
clutter_stage_view_invalidate_offscreen_blit_pipeline (CLUTTER_STAGE_VIEW (view));
clutter_stage_view_invalidate_offscreen_blit_pipeline (CLUTTER_STAGE_VIEW (
view));
}
static void

View File

@ -146,7 +146,8 @@ meta_screen_cast_monitor_stream_src_record_frame (MetaScreenCastStreamSrc *src,
}
MetaScreenCastMonitorStreamSrc *
meta_screen_cast_monitor_stream_src_new (MetaScreenCastMonitorStream *monitor_stream,
meta_screen_cast_monitor_stream_src_new (
MetaScreenCastMonitorStream *monitor_stream,
GError **error)
{
return g_initable_new (META_TYPE_SCREEN_CAST_MONITOR_STREAM_SRC, NULL, error,
@ -155,12 +156,14 @@ meta_screen_cast_monitor_stream_src_new (MetaScreenCastMonitorStream *monitor_s
}
static void
meta_screen_cast_monitor_stream_src_init (MetaScreenCastMonitorStreamSrc *monitor_src)
meta_screen_cast_monitor_stream_src_init (
MetaScreenCastMonitorStreamSrc *monitor_src)
{
}
static void
meta_screen_cast_monitor_stream_src_class_init (MetaScreenCastMonitorStreamSrcClass *klass)
meta_screen_cast_monitor_stream_src_class_init (
MetaScreenCastMonitorStreamSrcClass *klass)
{
MetaScreenCastStreamSrcClass *src_class =
META_SCREEN_CAST_STREAM_SRC_CLASS (klass);

View File

@ -93,13 +93,15 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
}
ClutterStage *
meta_screen_cast_monitor_stream_get_stage (MetaScreenCastMonitorStream *monitor_stream)
meta_screen_cast_monitor_stream_get_stage (
MetaScreenCastMonitorStream *monitor_stream)
{
return monitor_stream->stage;
}
MetaMonitor *
meta_screen_cast_monitor_stream_get_monitor (MetaScreenCastMonitorStream *monitor_stream)
meta_screen_cast_monitor_stream_get_monitor (
MetaScreenCastMonitorStream *monitor_stream)
{
return monitor_stream->monitor;
}
@ -177,7 +179,8 @@ meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream,
}
static void
meta_screen_cast_monitor_stream_transform_position (MetaScreenCastStream *stream,
meta_screen_cast_monitor_stream_transform_position (
MetaScreenCastStream *stream,
double stream_x,
double stream_y,
double *x,
@ -208,7 +211,8 @@ meta_screen_cast_monitor_stream_set_property (GObject *object,
{
case PROP_MONITOR:
g_set_object (&monitor_stream->monitor, g_value_get_object (value));
logical_monitor = meta_monitor_get_logical_monitor (monitor_stream->monitor);
logical_monitor = meta_monitor_get_logical_monitor (
monitor_stream->monitor);
g_set_object (&monitor_stream->logical_monitor, logical_monitor);
break;
default:
@ -244,16 +248,19 @@ meta_screen_cast_monitor_stream_finalize (GObject *object)
g_clear_object (&monitor_stream->monitor);
g_clear_object (&monitor_stream->logical_monitor);
G_OBJECT_CLASS (meta_screen_cast_monitor_stream_parent_class)->finalize (object);
G_OBJECT_CLASS (meta_screen_cast_monitor_stream_parent_class)->finalize (
object);
}
static void
meta_screen_cast_monitor_stream_init (MetaScreenCastMonitorStream *monitor_stream)
meta_screen_cast_monitor_stream_init (
MetaScreenCastMonitorStream *monitor_stream)
{
}
static void
meta_screen_cast_monitor_stream_class_init (MetaScreenCastMonitorStreamClass *klass)
meta_screen_cast_monitor_stream_class_init (
MetaScreenCastMonitorStreamClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaScreenCastStreamClass *stream_class =
@ -265,7 +272,8 @@ meta_screen_cast_monitor_stream_class_init (MetaScreenCastMonitorStreamClass *kl
stream_class->create_src = meta_screen_cast_monitor_stream_create_src;
stream_class->set_parameters = meta_screen_cast_monitor_stream_set_parameters;
stream_class->transform_position = meta_screen_cast_monitor_stream_transform_position;
stream_class->transform_position =
meta_screen_cast_monitor_stream_transform_position;
g_object_class_install_property (object_class,
PROP_MONITOR,

View File

@ -30,7 +30,8 @@
#include "backends/meta-screen-cast-stream.h"
#include "backends/meta-remote-access-controller-private.h"
#define META_SCREEN_CAST_SESSION_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Session"
#define META_SCREEN_CAST_SESSION_DBUS_PATH \
"/org/gnome/Mutter/ScreenCast/Session"
struct _MetaScreenCastSession
{
@ -55,7 +56,8 @@ meta_dbus_session_init_iface (MetaDbusSessionInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaScreenCastSession,
meta_screen_cast_session,
META_DBUS_TYPE_SCREEN_CAST_SESSION_SKELETON,
G_IMPLEMENT_INTERFACE (META_DBUS_TYPE_SCREEN_CAST_SESSION,
G_IMPLEMENT_INTERFACE (
META_DBUS_TYPE_SCREEN_CAST_SESSION,
meta_screen_cast_session_init_iface)
G_IMPLEMENT_INTERFACE (META_TYPE_DBUS_SESSION,
meta_dbus_session_init_iface))
@ -83,7 +85,8 @@ init_remote_access_handle (MetaScreenCastSession *session)
session->handle = meta_screen_cast_session_handle_new (session);
remote_access_controller = meta_backend_get_remote_access_controller (backend);
remote_access_controller =
meta_backend_get_remote_access_controller (backend);
remote_access_handle = META_REMOTE_ACCESS_HANDLE (session->handle);
meta_remote_access_controller_notify_new_handle (remote_access_controller,
remote_access_handle);
@ -452,7 +455,8 @@ meta_screen_cast_session_handle_init (MetaScreenCastSessionHandle *handle)
}
static void
meta_screen_cast_session_handle_class_init (MetaScreenCastSessionHandleClass *klass)
meta_screen_cast_session_handle_class_init (
MetaScreenCastSessionHandleClass *klass)
{
MetaRemoteAccessHandleClass *remote_access_handle_class =
META_REMOTE_ACCESS_HANDLE_CLASS (klass);

View File

@ -38,7 +38,8 @@
#include "meta/boxes.h"
#define PRIVATE_OWNER_FROM_FIELD(TypeName, field_ptr, field_name) \
(TypeName *)((guint8 *)(field_ptr) - G_PRIVATE_OFFSET (TypeName, field_name))
(TypeName *) ((guint8 *) (field_ptr) - \
G_PRIVATE_OFFSET (TypeName, field_name))
enum
{
@ -163,7 +164,8 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src)
}
else if (spa_buffer->datas[0].type == priv->pipewire_type->data.MemFd)
{
map = mmap (NULL, spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
map = mmap (NULL,
spa_buffer->datas[0].maxsize + spa_buffer->datas[0].mapoffset,
PROT_READ | PROT_WRITE, MAP_SHARED,
spa_buffer->datas[0].fd, 0);
if (map == MAP_FAILED)
@ -307,7 +309,8 @@ on_stream_format_changed (void *data,
params, G_N_ELEMENTS (params));
}
static const struct pw_stream_events stream_events = {
static const struct pw_stream_events stream_events =
{
PW_VERSION_STREAM_EVENTS,
.state_changed = on_stream_state_changed,
.format_changed = on_stream_format_changed,
@ -496,7 +499,8 @@ create_pipewire_source (void)
return pipewire_source;
}
static const struct pw_remote_events remote_events = {
static const struct pw_remote_events remote_events =
{
PW_VERSION_REMOTE_EVENTS,
.state_changed = on_state_changed,
};
@ -600,7 +604,7 @@ meta_screen_cast_stream_src_set_property (GObject *object,
{
case PROP_STREAM:
priv->stream = g_value_get_object (value);
break;;
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}

View File

@ -381,7 +381,6 @@ wayland_settings_changed (GSettings *wayland_settings,
gchar *key,
MetaSettings *settings)
{
if (g_str_equal (key, "xwayland-allow-grabs"))
{
update_xwayland_allow_grabs (settings);

View File

@ -30,7 +30,8 @@
#include "meta/meta-monitor-manager.h"
#include "meta/util.h"
struct _MetaOverlay {
struct _MetaOverlay
{
gboolean enabled;
CoglPipeline *pipeline;
@ -55,7 +56,8 @@ static MetaOverlay *
meta_overlay_new (void)
{
MetaOverlay *overlay;
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
CoglContext *ctx = clutter_backend_get_cogl_context (
clutter_get_default_backend ());
overlay = g_slice_new0 (MetaOverlay);
overlay->pipeline = cogl_pipeline_new (ctx);

View File

@ -64,7 +64,8 @@ static GInitableIface *initable_parent_iface;
static void
initable_iface_init (GInitableIface *initable_iface);
G_DEFINE_TYPE_WITH_CODE (MetaBackendNative, meta_backend_native, META_TYPE_BACKEND,
G_DEFINE_TYPE_WITH_CODE (MetaBackendNative, meta_backend_native,
META_TYPE_BACKEND,
G_ADD_PRIVATE (MetaBackendNative)
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE,
initable_iface_init))
@ -73,7 +74,8 @@ static void
meta_backend_native_finalize (GObject *object)
{
MetaBackendNative *native = META_BACKEND_NATIVE (object);
MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native);
MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (
native);
meta_launcher_free (priv->launcher);
@ -220,20 +222,36 @@ relative_motion_across_outputs (MetaMonitorManager *monitor_manager,
.b = { x + (dx * cur->scale), y + (dy * cur->scale) }
};
left = (MetaLine2) {
{ cur->rect.x, cur->rect.y },
{ cur->rect.x, cur->rect.y + cur->rect.height }
{
cur->rect.x, cur->rect.y
},
{
cur->rect.x, cur->rect.y + cur->rect.height
}
};
right = (MetaLine2) {
{ cur->rect.x + cur->rect.width, cur->rect.y },
{ cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height }
{
cur->rect.x + cur->rect.width, cur->rect.y
},
{
cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height
}
};
top = (MetaLine2) {
{ cur->rect.x, cur->rect.y },
{ cur->rect.x + cur->rect.width, cur->rect.y }
{
cur->rect.x, cur->rect.y
},
{
cur->rect.x + cur->rect.width, cur->rect.y
}
};
bottom = (MetaLine2) {
{ cur->rect.x, cur->rect.y + cur->rect.height },
{ cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height }
{
cur->rect.x, cur->rect.y + cur->rect.height
},
{
cur->rect.x + cur->rect.width, cur->rect.y + cur->rect.height
}
};
if (direction != META_DISPLAY_RIGHT &&
@ -284,7 +302,8 @@ relative_motion_filter (ClutterInputDevice *device,
if (meta_is_stage_views_scaled ())
return;
logical_monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager,
logical_monitor = meta_monitor_manager_get_logical_monitor_at (
monitor_manager,
x, y);
if (!logical_monitor)
return;
@ -292,9 +311,11 @@ relative_motion_filter (ClutterInputDevice *device,
new_dx = (*dx) * logical_monitor->scale;
new_dy = (*dy) * logical_monitor->scale;
dest_logical_monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager,
dest_logical_monitor = meta_monitor_manager_get_logical_monitor_at (
monitor_manager,
x + new_dx,
y + new_dy);
y +
new_dy);
if (dest_logical_monitor &&
dest_logical_monitor != logical_monitor)
{
@ -324,10 +345,12 @@ meta_backend_native_post_init (MetaBackend *backend)
META_BACKEND_CLASS (meta_backend_native_parent_class)->post_init (backend);
clutter_evdev_set_pointer_constrain_callback (manager, pointer_constrain_callback,
clutter_evdev_set_pointer_constrain_callback (manager,
pointer_constrain_callback,
NULL, NULL);
clutter_evdev_set_relative_motion_filter (manager, relative_motion_filter,
meta_backend_get_monitor_manager (backend));
meta_backend_get_monitor_manager (
backend));
}
static MetaMonitorManager *
@ -374,7 +397,8 @@ meta_backend_native_warp_pointer (MetaBackend *backend,
int y)
{
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
ClutterInputDevice *device = clutter_device_manager_get_core_device (manager,
CLUTTER_POINTER_DEVICE);
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
/* XXX */
@ -417,7 +441,8 @@ meta_backend_native_set_keymap (MetaBackend *backend,
names.options = options;
context = xkb_context_new (XKB_CONTEXT_NO_FLAGS);
keymap = xkb_keymap_new_from_names (context, &names, XKB_KEYMAP_COMPILE_NO_FLAGS);
keymap = xkb_keymap_new_from_names (context, &names,
XKB_KEYMAP_COMPILE_NO_FLAGS);
xkb_context_unref (context);
clutter_evdev_set_keyboard_map (manager, keymap);
@ -523,24 +548,31 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass)
object_class->finalize = meta_backend_native_finalize;
backend_class->create_clutter_backend = meta_backend_native_create_clutter_backend;
backend_class->create_clutter_backend =
meta_backend_native_create_clutter_backend;
backend_class->post_init = meta_backend_native_post_init;
backend_class->create_monitor_manager = meta_backend_native_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_native_create_cursor_renderer;
backend_class->create_monitor_manager =
meta_backend_native_create_monitor_manager;
backend_class->create_cursor_renderer =
meta_backend_native_create_cursor_renderer;
backend_class->create_renderer = meta_backend_native_create_renderer;
backend_class->create_input_settings = meta_backend_native_create_input_settings;
backend_class->create_input_settings =
meta_backend_native_create_input_settings;
backend_class->warp_pointer = meta_backend_native_warp_pointer;
backend_class->get_current_logical_monitor = meta_backend_native_get_current_logical_monitor;
backend_class->get_current_logical_monitor =
meta_backend_native_get_current_logical_monitor;
backend_class->set_keymap = meta_backend_native_set_keymap;
backend_class->get_keymap = meta_backend_native_get_keymap;
backend_class->get_keymap_layout_group = meta_backend_native_get_keymap_layout_group;
backend_class->get_keymap_layout_group =
meta_backend_native_get_keymap_layout_group;
backend_class->lock_layout_group = meta_backend_native_lock_layout_group;
backend_class->get_relative_motion_deltas = meta_backend_native_get_relative_motion_deltas;
backend_class->get_relative_motion_deltas =
meta_backend_native_get_relative_motion_deltas;
backend_class->update_screen_size = meta_backend_native_update_screen_size;
backend_class->set_numlock = meta_backend_native_set_numlock;
}
@ -548,7 +580,8 @@ meta_backend_native_class_init (MetaBackendNativeClass *klass)
static void
meta_backend_native_init (MetaBackendNative *native)
{
MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native);
MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (
native);
GError *error = NULL;
priv->launcher = meta_launcher_new (&error);
@ -607,7 +640,8 @@ meta_activate_session (void)
return TRUE;
MetaBackendNative *native = META_BACKEND_NATIVE (backend);
MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (native);
MetaBackendNativePrivate *priv = meta_backend_native_get_instance_private (
native);
if (!meta_launcher_activate_session (priv->launcher, &error))
{

View File

@ -46,7 +46,8 @@ struct _MetaBarrierManagerNative
GHashTable *barriers;
};
typedef enum {
typedef enum
{
/* The barrier is active and responsive to pointer motion. */
META_BARRIER_STATE_ACTIVE,
@ -213,12 +214,15 @@ maybe_release_barriers (MetaBarrierManagerNative *manager,
float x,
float y)
{
MetaLine2 motion = {
.a = {
MetaLine2 motion =
{
.a =
{
.x = prev_x,
.y = prev_y,
},
.b = {
.b =
{
.x = x,
.y = y,
},
@ -303,13 +307,17 @@ get_closest_barrier (MetaBarrierManagerNative *manager,
MetaClosestBarrierData closest_barrier_data;
closest_barrier_data = (MetaClosestBarrierData) {
.in = {
.motion = {
.a = {
.in =
{
.motion =
{
.a =
{
.x = prev_x,
.y = prev_y,
},
.b = {
.b =
{
.x = x,
.y = y,
},
@ -411,7 +419,8 @@ maybe_emit_barrier_event (gpointer key, gpointer value, gpointer user_data)
meta_barrier_impl_native_get_instance_private (self);
MetaBarrierEventData *data = user_data;
switch (priv->state) {
switch (priv->state)
{
case META_BARRIER_STATE_ACTIVE:
break;
case META_BARRIER_STATE_HIT:

View File

@ -90,7 +90,8 @@ meta_clutter_backend_native_bell_notify (ClutterBackend *backend)
}
static void
meta_clutter_backend_native_init (MetaClutterBackendNative *clutter_backend_nativen)
meta_clutter_backend_native_init (
MetaClutterBackendNative *clutter_backend_nativen)
{
}
@ -99,7 +100,9 @@ meta_clutter_backend_native_class_init (MetaClutterBackendNativeClass *klass)
{
ClutterBackendClass *clutter_backend_class = CLUTTER_BACKEND_CLASS (klass);
clutter_backend_class->get_renderer = meta_clutter_backend_native_get_renderer;
clutter_backend_class->create_stage = meta_clutter_backend_native_create_stage;
clutter_backend_class->get_renderer =
meta_clutter_backend_native_get_renderer;
clutter_backend_class->create_stage =
meta_clutter_backend_native_create_stage;
clutter_backend_class->bell_notify = meta_clutter_backend_native_bell_notify;
}

View File

@ -132,7 +132,6 @@ meta_crtc_kms_set_underscan (MetaCrtc *crtc,
DRM_MODE_OBJECT_CRTC,
crtc_kms->underscan_vborder_prop_id, value);
}
}
else
{

View File

@ -116,7 +116,9 @@ typedef struct _MetaCursorNativePrivate
static GQuark quark_cursor_renderer_native_gpu_data = 0;
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererNative, meta_cursor_renderer_native, META_TYPE_CURSOR_RENDERER);
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererNative,
meta_cursor_renderer_native,
META_TYPE_CURSOR_RENDERER);
static void
realize_cursor_sprite (MetaCursorRenderer *renderer,
@ -172,7 +174,8 @@ meta_cursor_renderer_native_finalize (GObject *object)
}
static guint
get_pending_cursor_sprite_gbm_bo_index (MetaCursorNativeGpuState *cursor_gpu_state)
get_pending_cursor_sprite_gbm_bo_index (
MetaCursorNativeGpuState *cursor_gpu_state)
{
return (cursor_gpu_state->active_bo + 1) % HW_CURSOR_BUFFER_COUNT;
}
@ -333,11 +336,13 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
}
scaled_crtc_rect = (ClutterRect) {
.origin = {
.origin =
{
.x = crtc_x / scale,
.y = crtc_y / scale
},
.size = {
.size =
{
.width = crtc_width / scale,
.height = crtc_height / scale
},
@ -395,7 +400,9 @@ update_hw_cursor (MetaCursorRendererNative *native,
if (cursor_sprite)
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
else
rect = (ClutterRect) { 0 };
rect = (ClutterRect) {
0
};
logical_monitors =
meta_monitor_manager_get_logical_monitors (monitor_manager);
@ -410,7 +417,8 @@ update_hw_cursor (MetaCursorRendererNative *native,
.in_cursor_renderer_native = native,
.in_logical_monitor = logical_monitor,
.in_local_cursor_rect = (ClutterRect) {
.origin = {
.origin =
{
.x = rect.origin.x - logical_monitor->rect.x,
.y = rect.origin.y - logical_monitor->rect.y
},
@ -512,7 +520,8 @@ cursor_over_transformed_logical_monitor (MetaCursorRenderer *renderer,
transform = meta_logical_monitor_get_transform (logical_monitor);
/* Get transform corrected for LCD panel-orientation. */
transform = meta_monitor_logical_to_crtc_transform (monitor, transform);
transform =
meta_monitor_logical_to_crtc_transform (monitor, transform);
if (transform != META_MONITOR_TRANSFORM_NORMAL)
return TRUE;
}
@ -1015,7 +1024,8 @@ realize_cursor_sprite_from_wl_buffer_for_gpu (MetaCursorRenderer *renderer,
if (width != cursor_width || height != cursor_height)
{
meta_warning ("Invalid cursor size (must be 64x64), falling back to software (GL) cursors\n");
meta_warning (
"Invalid cursor size (must be 64x64), falling back to software (GL) cursors\n");
return;
}

View File

@ -96,7 +96,8 @@ kms_event_dispatch (GSource *source,
return G_SOURCE_CONTINUE;
}
static GSourceFuncs kms_event_funcs = {
static GSourceFuncs kms_event_funcs =
{
NULL,
kms_event_check,
kms_event_dispatch
@ -169,7 +170,8 @@ static void
invoke_flip_closure (GClosure *flip_closure,
MetaGpuKms *gpu_kms)
{
GValue params[] = {
GValue params[] =
{
G_VALUE_INIT,
G_VALUE_INIT
};
@ -232,7 +234,8 @@ meta_gpu_kms_wrap_flip_closure (MetaGpuKms *gpu_kms,
}
void
meta_gpu_kms_flip_closure_container_free (MetaGpuKmsFlipClosureContainer *closure_container)
meta_gpu_kms_flip_closure_container_free (
MetaGpuKmsFlipClosureContainer *closure_container)
{
g_free (closure_container);
}
@ -601,7 +604,8 @@ init_modes (MetaGpuKms *gpu_kms,
/*
* Gather all modes on all connected connectors.
*/
modes_table = g_hash_table_new (drm_mode_hash, (GEqualFunc) meta_drm_mode_equal);
modes_table = g_hash_table_new (drm_mode_hash,
(GEqualFunc) meta_drm_mode_equal);
for (i = 0; i < gpu_kms->n_connectors; i++)
{
drmModeConnector *drm_connector;
@ -788,7 +792,8 @@ meta_gpu_kms_read_current (MetaGpu *gpu,
{
if (!gpu_kms->resources_init_failed_before)
{
g_warning ("meta_kms_resources_init failed: %s, assuming we have no outputs",
g_warning (
"meta_kms_resources_init failed: %s, assuming we have no outputs",
local_error->message);
gpu_kms->resources_init_failed_before = TRUE;
}
@ -801,9 +806,9 @@ meta_gpu_kms_read_current (MetaGpu *gpu,
monitor_manager->power_save_mode = META_POWER_SAVE_ON;
/* Note: we must not free the public structures (output, crtc, monitor
mode and monitor info) here, they must be kept alive until the API
users are done with them after we emit monitors-changed, and thus
are freed by the platform-independent layer. */
* mode and monitor info) here, they must be kept alive until the API
* users are done with them after we emit monitors-changed, and thus
* are freed by the platform-independent layer. */
free_resources (gpu_kms);
init_connectors (gpu_kms, resources.resources);

View File

@ -31,7 +31,8 @@
#include "backends/native/meta-input-settings-native.h"
#include "clutter/evdev/clutter-evdev.h"
G_DEFINE_TYPE (MetaInputSettingsNative, meta_input_settings_native, META_TYPE_INPUT_SETTINGS)
G_DEFINE_TYPE (MetaInputSettingsNative, meta_input_settings_native,
META_TYPE_INPUT_SETTINGS)
static void
meta_input_settings_native_set_send_events (MetaInputSettings *settings,
@ -122,7 +123,8 @@ meta_input_settings_native_set_tap_enabled (MetaInputSettings *settings,
}
static void
meta_input_settings_native_set_tap_and_drag_enabled (MetaInputSettings *settings,
meta_input_settings_native_set_tap_and_drag_enabled (
MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
@ -140,7 +142,8 @@ meta_input_settings_native_set_tap_and_drag_enabled (MetaInputSettings *setting
}
static void
meta_input_settings_native_set_disable_while_typing (MetaInputSettings *settings,
meta_input_settings_native_set_disable_while_typing (
MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
@ -202,7 +205,9 @@ meta_input_settings_native_set_edge_scroll (MetaInputSettings *settin
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
method = edge_scrolling_enabled ? LIBINPUT_CONFIG_SCROLL_EDGE : LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
method =
edge_scrolling_enabled ? LIBINPUT_CONFIG_SCROLL_EDGE :
LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
current = libinput_device_config_scroll_get_method (libinput_device);
current &= ~LIBINPUT_CONFIG_SCROLL_EDGE;
@ -219,7 +224,9 @@ meta_input_settings_native_set_two_finger_scroll (MetaInputSettings *
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
method = two_finger_scroll_enabled ? LIBINPUT_CONFIG_SCROLL_2FG : LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
method =
two_finger_scroll_enabled ? LIBINPUT_CONFIG_SCROLL_2FG :
LIBINPUT_CONFIG_SCROLL_NO_SCROLL;
current = libinput_device_config_scroll_get_method (libinput_device);
current &= ~LIBINPUT_CONFIG_SCROLL_2FG;
@ -236,7 +243,8 @@ meta_input_settings_native_has_two_finger_scroll (MetaInputSettings *settings,
if (!libinput_device)
return FALSE;
return libinput_device_config_scroll_get_methods (libinput_device) & LIBINPUT_CONFIG_SCROLL_2FG;
return libinput_device_config_scroll_get_methods (libinput_device) &
LIBINPUT_CONFIG_SCROLL_2FG;
}
static void
@ -275,7 +283,8 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
}
static void
meta_input_settings_native_set_click_method (MetaInputSettings *settings,
meta_input_settings_native_set_click_method (
MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadClickMethod mode)
{
@ -289,7 +298,8 @@ meta_input_settings_native_set_click_method (MetaInputSettings *settin
switch (mode)
{
case G_DESKTOP_TOUCHPAD_CLICK_METHOD_DEFAULT:
click_method = libinput_device_config_click_get_default_method (libinput_device);
click_method = libinput_device_config_click_get_default_method (
libinput_device);
break;
case G_DESKTOP_TOUCHPAD_CLICK_METHOD_NONE:
click_method = LIBINPUT_CONFIG_CLICK_METHOD_NONE;
@ -405,7 +415,8 @@ meta_input_settings_native_is_trackball_device (MetaInputSettings *settings,
}
static void
meta_input_settings_native_set_mouse_accel_profile (MetaInputSettings *settings,
meta_input_settings_native_set_mouse_accel_profile (
MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile)
{
@ -416,7 +427,8 @@ meta_input_settings_native_set_mouse_accel_profile (MetaInputSettings *
}
static void
meta_input_settings_native_set_trackball_accel_profile (MetaInputSettings *settings,
meta_input_settings_native_set_trackball_accel_profile (
MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile)
{
@ -497,8 +509,11 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings *settings,
offset_x = -padding_left * scale_x;
offset_y = -padding_top * scale_y;
gfloat matrix[6] = { scale_x, 0., offset_x,
0., scale_y, offset_y };
gfloat matrix[6] =
{
scale_x, 0., offset_x,
0., scale_y, offset_y
};
libinput_device = clutter_evdev_input_device_get_libinput_device (device);
if (!libinput_device ||
@ -509,7 +524,8 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings *settings,
}
static void
meta_input_settings_native_set_stylus_pressure (MetaInputSettings *settings,
meta_input_settings_native_set_stylus_pressure (
MetaInputSettings *settings,
ClutterInputDevice *device,
ClutterInputDeviceTool *tool,
const gint curve[4])
@ -544,7 +560,8 @@ action_to_evcode (GDesktopStylusButtonAction action)
}
static void
meta_input_settings_native_set_stylus_button_map (MetaInputSettings *settings,
meta_input_settings_native_set_stylus_button_map (
MetaInputSettings *settings,
ClutterInputDevice *device,
ClutterInputDeviceTool *tool,
GDesktopStylusButtonAction primary,
@ -553,7 +570,8 @@ meta_input_settings_native_set_stylus_button_map (MetaInputSettings *se
{
clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_MIDDLE,
action_to_evcode (primary));
clutter_evdev_input_device_tool_set_button_code (tool, CLUTTER_BUTTON_SECONDARY,
clutter_evdev_input_device_tool_set_button_code (tool,
CLUTTER_BUTTON_SECONDARY,
action_to_evcode (secondary));
clutter_evdev_input_device_tool_set_button_code (tool, 8, /* Back */
action_to_evcode (tertiary));
@ -562,34 +580,55 @@ meta_input_settings_native_set_stylus_button_map (MetaInputSettings *se
static void
meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass)
{
MetaInputSettingsClass *input_settings_class = META_INPUT_SETTINGS_CLASS (klass);
MetaInputSettingsClass *input_settings_class = META_INPUT_SETTINGS_CLASS (
klass);
input_settings_class->set_send_events = meta_input_settings_native_set_send_events;
input_settings_class->set_send_events =
meta_input_settings_native_set_send_events;
input_settings_class->set_matrix = meta_input_settings_native_set_matrix;
input_settings_class->set_speed = meta_input_settings_native_set_speed;
input_settings_class->set_left_handed = meta_input_settings_native_set_left_handed;
input_settings_class->set_tap_enabled = meta_input_settings_native_set_tap_enabled;
input_settings_class->set_tap_and_drag_enabled = meta_input_settings_native_set_tap_and_drag_enabled;
input_settings_class->set_invert_scroll = meta_input_settings_native_set_invert_scroll;
input_settings_class->set_edge_scroll = meta_input_settings_native_set_edge_scroll;
input_settings_class->set_two_finger_scroll = meta_input_settings_native_set_two_finger_scroll;
input_settings_class->set_scroll_button = meta_input_settings_native_set_scroll_button;
input_settings_class->set_click_method = meta_input_settings_native_set_click_method;
input_settings_class->set_keyboard_repeat = meta_input_settings_native_set_keyboard_repeat;
input_settings_class->set_disable_while_typing = meta_input_settings_native_set_disable_while_typing;
input_settings_class->set_left_handed =
meta_input_settings_native_set_left_handed;
input_settings_class->set_tap_enabled =
meta_input_settings_native_set_tap_enabled;
input_settings_class->set_tap_and_drag_enabled =
meta_input_settings_native_set_tap_and_drag_enabled;
input_settings_class->set_invert_scroll =
meta_input_settings_native_set_invert_scroll;
input_settings_class->set_edge_scroll =
meta_input_settings_native_set_edge_scroll;
input_settings_class->set_two_finger_scroll =
meta_input_settings_native_set_two_finger_scroll;
input_settings_class->set_scroll_button =
meta_input_settings_native_set_scroll_button;
input_settings_class->set_click_method =
meta_input_settings_native_set_click_method;
input_settings_class->set_keyboard_repeat =
meta_input_settings_native_set_keyboard_repeat;
input_settings_class->set_disable_while_typing =
meta_input_settings_native_set_disable_while_typing;
input_settings_class->set_tablet_mapping = meta_input_settings_native_set_tablet_mapping;
input_settings_class->set_tablet_keep_aspect = meta_input_settings_native_set_tablet_keep_aspect;
input_settings_class->set_tablet_area = meta_input_settings_native_set_tablet_area;
input_settings_class->set_tablet_mapping =
meta_input_settings_native_set_tablet_mapping;
input_settings_class->set_tablet_keep_aspect =
meta_input_settings_native_set_tablet_keep_aspect;
input_settings_class->set_tablet_area =
meta_input_settings_native_set_tablet_area;
input_settings_class->set_mouse_accel_profile = meta_input_settings_native_set_mouse_accel_profile;
input_settings_class->set_trackball_accel_profile = meta_input_settings_native_set_trackball_accel_profile;
input_settings_class->set_mouse_accel_profile =
meta_input_settings_native_set_mouse_accel_profile;
input_settings_class->set_trackball_accel_profile =
meta_input_settings_native_set_trackball_accel_profile;
input_settings_class->set_stylus_pressure = meta_input_settings_native_set_stylus_pressure;
input_settings_class->set_stylus_button_map = meta_input_settings_native_set_stylus_button_map;
input_settings_class->set_stylus_pressure =
meta_input_settings_native_set_stylus_pressure;
input_settings_class->set_stylus_button_map =
meta_input_settings_native_set_stylus_button_map;
input_settings_class->has_two_finger_scroll = meta_input_settings_native_has_two_finger_scroll;
input_settings_class->is_trackball_device = meta_input_settings_native_is_trackball_device;
input_settings_class->has_two_finger_scroll =
meta_input_settings_native_has_two_finger_scroll;
input_settings_class->is_trackball_device =
meta_input_settings_native_is_trackball_device;
}
static void

View File

@ -63,7 +63,10 @@ static gboolean
find_systemd_session (gchar **session_id,
GError **error)
{
const gchar * const graphical_session_types[] = { "wayland", "x11", "mir", NULL };
const gchar * const graphical_session_types[] =
{
"wayland", "x11", "mir", NULL
};
const gchar * const active_states[] = { "active", "online", NULL };
g_autofree gchar *class = NULL;
g_autofree gchar *local_session_id = NULL;
@ -231,11 +234,13 @@ get_session_proxy (GCancellable *cancellable,
if (!find_systemd_session (&session_id, &local_error))
{
g_propagate_prefixed_error (error, local_error, "Could not get session ID: ");
g_propagate_prefixed_error (error, local_error,
"Could not get session ID: ");
return NULL;
}
proxy_path = get_escaped_dbus_path ("/org/freedesktop/login1/session", session_id);
proxy_path = get_escaped_dbus_path ("/org/freedesktop/login1/session",
session_id);
session_proxy = login1_session_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
@ -433,7 +438,8 @@ sync_active (MetaLauncher *self)
{
MetaBackend *backend = meta_get_backend ();
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
gboolean active = login1_session_get_active (LOGIN1_SESSION (self->session_proxy));
gboolean active =
login1_session_get_active (LOGIN1_SESSION (self->session_proxy));
if (active == self->session_active)
return;
@ -465,7 +471,8 @@ get_seat_id (GError **error)
if (!find_systemd_session (&session_id, &local_error))
{
g_propagate_prefixed_error (error, local_error, "Could not get session ID: ");
g_propagate_prefixed_error (error, local_error,
"Could not get session ID: ");
return NULL;
}
@ -495,7 +502,8 @@ meta_launcher_new (GError **error)
if (!session_proxy)
goto fail;
if (!login1_session_call_take_control_sync (session_proxy, FALSE, NULL, error))
if (!login1_session_call_take_control_sync (session_proxy, FALSE, NULL,
error))
{
g_prefix_error (error, "Could not take control: ");
goto fail;
@ -524,7 +532,8 @@ meta_launcher_new (GError **error)
on_evdev_device_close,
self);
g_signal_connect (self->session_proxy, "notify::active", G_CALLBACK (on_active_changed), self);
g_signal_connect (self->session_proxy, "notify::active",
G_CALLBACK (on_active_changed), self);
return self;
@ -560,5 +569,6 @@ meta_launcher_activate_vt (MetaLauncher *launcher,
signed char vt,
GError **error)
{
return login1_seat_call_switch_to_sync (launcher->seat_proxy, vt, NULL, error);
return login1_seat_call_switch_to_sync (launcher->seat_proxy, vt, NULL,
error);
}

View File

@ -95,7 +95,8 @@ meta_monitor_manager_kms_set_power_save_mode (MetaMonitorManager *manager,
uint64_t state;
GList *l;
switch (mode) {
switch (mode)
{
case META_POWER_SAVE_ON:
state = DRM_MODE_DPMS_ON;
break;
@ -193,7 +194,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
meta_crtc_kms_apply_transform (crtc);
}
/* Disable CRTCs not mentioned in the list (they have is_dirty == FALSE,
because they weren't seen in the first loop) */
* because they weren't seen in the first loop) */
for (l = manager->gpus; l; l = l->next)
{
MetaGpu *gpu = l->data;
@ -283,7 +284,8 @@ update_screen_size (MetaMonitorManager *manager,
}
static gboolean
meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager,
meta_monitor_manager_kms_apply_monitors_config (
MetaMonitorManager *manager,
MetaMonitorsConfig *config,
MetaMonitorsConfigMethod method,
GError **error)
@ -387,7 +389,8 @@ on_uevent (GUdevClient *client,
}
static void
meta_monitor_manager_kms_connect_uevent_handler (MetaMonitorManagerKms *manager_kms)
meta_monitor_manager_kms_connect_uevent_handler (
MetaMonitorManagerKms *manager_kms)
{
manager_kms->uevent_handler_id = g_signal_connect (manager_kms->udev,
"uevent",
@ -396,7 +399,8 @@ meta_monitor_manager_kms_connect_uevent_handler (MetaMonitorManagerKms *manager_
}
static void
meta_monitor_manager_kms_disconnect_uevent_handler (MetaMonitorManagerKms *manager_kms)
meta_monitor_manager_kms_disconnect_uevent_handler (
MetaMonitorManagerKms *manager_kms)
{
g_signal_handler_disconnect (manager_kms->udev,
manager_kms->uevent_handler_id);
@ -427,7 +431,8 @@ meta_monitor_manager_kms_is_transform_handled (MetaMonitorManager *manager,
}
static float
meta_monitor_manager_kms_calculate_monitor_mode_scale (MetaMonitorManager *manager,
meta_monitor_manager_kms_calculate_monitor_mode_scale (
MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
@ -435,7 +440,8 @@ meta_monitor_manager_kms_calculate_monitor_mode_scale (MetaMonitorManager *manag
}
static float *
meta_monitor_manager_kms_calculate_supported_scales (MetaMonitorManager *manager,
meta_monitor_manager_kms_calculate_supported_scales (
MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
@ -742,15 +748,23 @@ meta_monitor_manager_kms_class_init (MetaMonitorManagerKmsClass *klass)
object_class->dispose = meta_monitor_manager_kms_dispose;
manager_class->read_edid = meta_monitor_manager_kms_read_edid;
manager_class->ensure_initial_config = meta_monitor_manager_kms_ensure_initial_config;
manager_class->apply_monitors_config = meta_monitor_manager_kms_apply_monitors_config;
manager_class->set_power_save_mode = meta_monitor_manager_kms_set_power_save_mode;
manager_class->ensure_initial_config =
meta_monitor_manager_kms_ensure_initial_config;
manager_class->apply_monitors_config =
meta_monitor_manager_kms_apply_monitors_config;
manager_class->set_power_save_mode =
meta_monitor_manager_kms_set_power_save_mode;
manager_class->get_crtc_gamma = meta_monitor_manager_kms_get_crtc_gamma;
manager_class->set_crtc_gamma = meta_monitor_manager_kms_set_crtc_gamma;
manager_class->is_transform_handled = meta_monitor_manager_kms_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_kms_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_kms_calculate_supported_scales;
manager_class->is_transform_handled =
meta_monitor_manager_kms_is_transform_handled;
manager_class->calculate_monitor_mode_scale =
meta_monitor_manager_kms_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales =
meta_monitor_manager_kms_calculate_supported_scales;
manager_class->get_capabilities = meta_monitor_manager_kms_get_capabilities;
manager_class->get_max_screen_size = meta_monitor_manager_kms_get_max_screen_size;
manager_class->get_default_layout_mode = meta_monitor_manager_kms_get_default_layout_mode;
manager_class->get_max_screen_size =
meta_monitor_manager_kms_get_max_screen_size;
manager_class->get_default_layout_mode =
meta_monitor_manager_kms_get_default_layout_mode;
}

View File

@ -311,7 +311,8 @@ find_connector_properties (MetaGpuKms *gpu_kms,
static char *
make_output_name (drmModeConnector *connector)
{
static const char * const connector_type_names[] = {
static const char * const connector_type_names[] =
{
"None",
"VGA",
"DVI-I",
@ -570,9 +571,9 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
continue;
/* We only list CRTCs as supported if they are supported by all encoders
for this connectors.
This is what xf86-video-modesetting does (see drmmode_output_init())
* for this connectors.
*
* This is what xf86-video-modesetting does (see drmmode_output_init())
*/
crtc_mask &= output_kms->encoders[i]->possible_crtcs;
@ -654,13 +655,15 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
output_get_tile_info (gpu_kms, output);
/* FIXME: backlight is a very driver specific thing unfortunately,
every DDX does its own thing, and the dumb KMS API does not include it.
For example, xf86-video-intel has a list of paths to probe in /sys/class/backlight
(one for each major HW maker, and then some).
We can't do the same because we're not root.
It might be best to leave backlight out of the story and rely on the setuid
helper in gnome-settings-daemon.
* every DDX does its own thing, and the dumb KMS API does not include it.
*
* For example, xf86-video-intel has a list of paths to probe in
* /sys/class/backlight
* (one for each major HW maker, and then some).
* We can't do the same because we're not root.
* It might be best to leave backlight out of the story and rely on the
* setuid
* helper in gnome-settings-daemon.
*/
output->backlight_min = 0;
output->backlight_max = 0;

View File

@ -169,7 +169,8 @@ paint_egl_image (MetaGles3 *gles3,
GLBAS (gles3, glTexParameteri, (GL_TEXTURE_2D, GL_TEXTURE_WRAP_R_OES,
GL_CLAMP_TO_EDGE));
GLBAS (gles3, glFramebufferTexture2D, (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GLBAS (gles3, glFramebufferTexture2D,
(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D, texture, 0));
GLBAS (gles3, glBindFramebuffer, (GL_READ_FRAMEBUFFER, framebuffer));

View File

@ -90,12 +90,14 @@ typedef struct _MetaRendererNativeGpuData
{
MetaRendererNative *renderer_native;
struct {
struct
{
struct gbm_device *device;
} gbm;
#ifdef HAVE_EGL_DEVICE
struct {
struct
{
EGLDeviceEXT device;
gboolean no_egl_output_drm_flip_event;
@ -109,7 +111,8 @@ typedef struct _MetaRendererNativeGpuData
/*
* Fields used for blitting iGPU framebuffer content onto dGPU framebuffers.
*/
struct {
struct
{
MetaSharedFramebufferCopyMode copy_mode;
/* For GPU blit mode */
@ -136,7 +139,8 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState
EGLSurface egl_surface;
struct {
struct
{
struct gbm_surface *surface;
uint32_t current_fb_id;
uint32_t next_fb_id;
@ -144,7 +148,8 @@ typedef struct _MetaOnscreenNativeSecondaryGpuState
struct gbm_bo *next_bo;
} gbm;
struct {
struct
{
MetaDumbBuffer *dumb_fb;
MetaDumbBuffer dumb_fbs[2];
} cpu;
@ -160,7 +165,8 @@ typedef struct _MetaOnscreenNative
GHashTable *secondary_gpu_states;
struct {
struct
{
struct gbm_surface *surface;
uint32_t current_fb_id;
uint32_t next_fb_id;
@ -169,7 +175,8 @@ typedef struct _MetaOnscreenNative
} gbm;
#ifdef HAVE_EGL_DEVICE
struct {
struct
{
EGLStreamKHR stream;
MetaDumbBuffer dumb_fb;
@ -465,7 +472,8 @@ get_supported_egl_modifiers (CoglOnscreen *onscreen,
num_modifiers);
ret = meta_egl_query_dma_buf_modifiers (egl, renderer_gpu_data->egl_display,
format, num_modifiers,
(EGLuint64KHR *) modifiers->data, NULL,
(EGLuint64KHR *) modifiers->data,
NULL,
&num_modifiers, &error);
if (!ret)
@ -556,7 +564,8 @@ get_supported_modifiers (CoglOnscreen *onscreen,
}
static gboolean
init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative *renderer_native,
init_secondary_gpu_state_gpu_copy_mode (
MetaRendererNative *renderer_native,
CoglOnscreen *onscreen,
MetaRendererNativeGpuData *renderer_gpu_data,
MetaGpuKms *gpu_kms,
@ -614,7 +623,8 @@ init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative *renderer_nat
}
static void
secondary_gpu_state_free (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
secondary_gpu_state_free (
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state)
{
MetaBackend *backend = meta_get_backend ();
MetaEgl *egl = meta_backend_get_egl (backend);
@ -648,7 +658,8 @@ secondary_gpu_state_free (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_sta
}
static gboolean
init_secondary_gpu_state_cpu_copy_mode (MetaRendererNative *renderer_native,
init_secondary_gpu_state_cpu_copy_mode (
MetaRendererNative *renderer_native,
CoglOnscreen *onscreen,
MetaRendererNativeGpuData *renderer_gpu_data,
MetaGpuKms *gpu_kms,
@ -746,7 +757,8 @@ flush_pending_swap_notify (CoglFramebuffer *framebuffer)
CoglFrameInfo *info;
while ((info = g_queue_peek_head (&onscreen->pending_frame_infos)) &&
info->global_frame_counter <= onscreen_native->pending_swap_notify_frame_count)
info->global_frame_counter <=
onscreen_native->pending_swap_notify_frame_count)
{
_cogl_onscreen_notify_frame_sync (onscreen, info);
_cogl_onscreen_notify_complete (onscreen, info);
@ -913,7 +925,8 @@ fail:
}
static int
meta_renderer_native_add_egl_config_attributes (CoglDisplay *cogl_display,
meta_renderer_native_add_egl_config_attributes (
CoglDisplay *cogl_display,
CoglFramebufferConfig *config,
EGLint *attributes)
{
@ -1051,7 +1064,8 @@ create_dummy_pbuffer_surface (EGLDisplay egl_display,
MetaBackend *backend = meta_get_backend ();
MetaEgl *egl = meta_backend_get_egl (backend);
EGLConfig pbuffer_config;
static const EGLint pbuffer_config_attribs[] = {
static const EGLint pbuffer_config_attribs[] =
{
EGL_SURFACE_TYPE, EGL_PBUFFER_BIT,
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
@ -1060,7 +1074,8 @@ create_dummy_pbuffer_surface (EGLDisplay egl_display,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE
};
static const EGLint pbuffer_attribs[] = {
static const EGLint pbuffer_attribs[] =
{
EGL_WIDTH, 16,
EGL_HEIGHT, 16,
EGL_NONE
@ -1467,7 +1482,8 @@ meta_onscreen_native_set_crtc_modes (CoglOnscreen *onscreen)
logical_monitor = meta_renderer_view_get_logical_monitor (view);
if (logical_monitor)
{
SetCrtcFbData data = {
SetCrtcFbData data =
{
.render_gpu = render_gpu,
.onscreen = onscreen,
.fb_id = fb_id
@ -1550,7 +1566,8 @@ meta_onscreen_native_flip_crtcs (CoglOnscreen *onscreen)
logical_monitor = meta_renderer_view_get_logical_monitor (view);
if (logical_monitor)
{
FlipCrtcData data = {
FlipCrtcData data =
{
.onscreen = onscreen,
.flip_closure = flip_closure,
};
@ -1749,8 +1766,10 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
if (!meta_renderer_native_gles3_blit_shared_bo (egl,
renderer_native->gles3,
renderer_gpu_data->egl_display,
renderer_gpu_data->secondary.egl_context,
secondary_gpu_state->egl_surface,
renderer_gpu_data->secondary.
egl_context,
secondary_gpu_state->
egl_surface,
onscreen_native->gbm.next_bo,
&error))
{
@ -1946,7 +1965,8 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
onscreen_native->pending_set_crtc = FALSE;
}
onscreen_native->pending_queue_swap_notify_frame_count = renderer_native->frame_counter;
onscreen_native->pending_queue_swap_notify_frame_count =
renderer_native->frame_counter;
meta_onscreen_native_flip_crtcs (onscreen);
/*
@ -2013,7 +2033,8 @@ should_surface_be_sharable (CoglOnscreen *onscreen)
MetaMonitor *monitor = l->data;
MetaGpuKms *gpu_kms = META_GPU_KMS (meta_monitor_get_gpu (monitor));
if (renderer_gpu_data != meta_renderer_native_get_gpu_data (renderer_native,
if (renderer_gpu_data !=
meta_renderer_native_get_gpu_data (renderer_native,
gpu_kms))
return TRUE;
}
@ -2135,12 +2156,14 @@ meta_renderer_native_create_surface_egl_device (CoglOnscreen *onscreen,
EGLint num_layers;
EGLOutputLayerEXT output_layer;
EGLAttrib output_attribs[3];
EGLint stream_attribs[] = {
EGLint stream_attribs[] =
{
EGL_STREAM_FIFO_LENGTH_KHR, 1,
EGL_CONSUMER_AUTO_ACQUIRE_EXT, EGL_FALSE,
EGL_NONE
};
EGLint stream_producer_attribs[] = {
EGLint stream_producer_attribs[] =
{
EGL_WIDTH, width,
EGL_HEIGHT, height,
EGL_NONE
@ -2529,7 +2552,8 @@ meta_renderer_native_release_onscreen (CoglOnscreen *onscreen)
}
static const CoglWinsysEGLVtable
_cogl_winsys_egl_vtable = {
_cogl_winsys_egl_vtable =
{
.add_config_attributes = meta_renderer_native_add_egl_config_attributes,
.choose_config = meta_renderer_native_choose_egl_config,
.display_setup = meta_renderer_native_setup_egl_display,
@ -2696,7 +2720,7 @@ get_native_cogl_winsys_vtable (CoglRenderer *cogl_renderer)
if (!vtable_inited)
{
/* The this winsys is a subclass of the EGL winsys so we
start by copying its vtable */
* start by copying its vtable */
parent_vtable = _cogl_winsys_egl_get_vtable ();
vtable = *parent_vtable;
@ -2963,7 +2987,8 @@ create_secondary_egl_config (MetaEgl *egl,
EGLConfig *egl_config,
GError **error)
{
EGLint attributes[] = {
EGLint attributes[] =
{
EGL_RED_SIZE, 1,
EGL_GREEN_SIZE, 1,
EGL_BLUE_SIZE, 1,
@ -3002,7 +3027,8 @@ create_secondary_egl_context (MetaEgl *egl,
EGLConfig egl_config,
GError **error)
{
EGLint attributes[] = {
EGLint attributes[] =
{
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE
};
@ -3041,7 +3067,8 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
&egl_config, error))
return FALSE;
egl_context = create_secondary_egl_context (egl, egl_display, egl_config, error);
egl_context = create_secondary_egl_context (egl, egl_display, egl_config,
error);
if (egl_context == EGL_NO_CONTEXT)
return FALSE;
@ -3075,7 +3102,8 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
renderer_gpu_data->secondary.egl_context = egl_context;
renderer_gpu_data->secondary.egl_config = egl_config;
renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_GPU;
renderer_gpu_data->secondary.copy_mode =
META_SHARED_FRAMEBUFFER_COPY_MODE_GPU;
return TRUE;
}
@ -3083,7 +3111,8 @@ init_secondary_gpu_data_gpu (MetaRendererNativeGpuData *renderer_gpu_data,
static void
init_secondary_gpu_data_cpu (MetaRendererNativeGpuData *renderer_gpu_data)
{
renderer_gpu_data->secondary.copy_mode = META_SHARED_FRAMEBUFFER_COPY_MODE_CPU;
renderer_gpu_data->secondary.copy_mode =
META_SHARED_FRAMEBUFFER_COPY_MODE_CPU;
}
static void
@ -3094,7 +3123,8 @@ init_secondary_gpu_data (MetaRendererNativeGpuData *renderer_gpu_data)
if (init_secondary_gpu_data_gpu (renderer_gpu_data, &error))
return;
g_warning ("Failed to initialize accelerated iGPU/dGPU framebuffer sharing: %s",
g_warning (
"Failed to initialize accelerated iGPU/dGPU framebuffer sharing: %s",
error->message);
g_error_free (error);
@ -3269,7 +3299,8 @@ get_egl_device_display (MetaRendererNative *renderer_native,
{
MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
int kms_fd = meta_gpu_kms_get_fd (gpu_kms);
EGLint platform_attribs[] = {
EGLint platform_attribs[] =
{
EGL_DRM_MASTER_FD_EXT, kms_fd,
EGL_NONE
};
@ -3358,7 +3389,8 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native,
#endif /* HAVE_EGL_DEVICE */
static MetaRendererNativeGpuData *
meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_native,
meta_renderer_native_create_renderer_gpu_data (
MetaRendererNative *renderer_native,
MetaGpuKms *gpu_kms,
GError **error)
{
@ -3500,7 +3532,8 @@ meta_renderer_native_class_init (MetaRendererNativeClass *klass)
object_class->finalize = meta_renderer_native_finalize;
object_class->constructed = meta_renderer_native_constructed;
renderer_class->create_cogl_renderer = meta_renderer_native_create_cogl_renderer;
renderer_class->create_cogl_renderer =
meta_renderer_native_create_cogl_renderer;
renderer_class->create_view = meta_renderer_native_create_view;
obj_props[PROP_MONITOR_MANAGER] =

View File

@ -53,7 +53,10 @@ take_touch_grab (MetaBackend *backend)
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
Display *xdisplay = meta_backend_x11_get_xdisplay (x11);
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask mask = { META_VIRTUAL_CORE_POINTER_ID, sizeof (mask_bits), mask_bits };
XIEventMask mask =
{
META_VIRTUAL_CORE_POINTER_ID, sizeof (mask_bits), mask_bits
};
XIGrabModifiers mods = { XIAnyModifier, 0 };
XISetMask (mask.mask, XI_TouchBegin);
@ -182,7 +185,7 @@ get_xkbrf_var_defs (Display *xdisplay,
var_defs->options = strdup (options);
/* Sometimes, the property is a file path, and sometimes it's
not. Normalize it so it's always a file path. */
* not. Normalize it so it's always a file path. */
if (rules[0] == '/')
*rules_p = g_strdup (rules);
else
@ -270,7 +273,8 @@ apply_keymap (MetaBackendX11 *x11)
XkbComponentNamesRec xkb_comp_names = { 0 };
XkbRF_GetComponents (xkb_rules, &xkb_var_defs, &xkb_comp_names);
upload_xkb_description (xdisplay, rules_file_path, &xkb_var_defs, &xkb_comp_names);
upload_xkb_description (xdisplay, rules_file_path, &xkb_var_defs,
&xkb_comp_names);
free_xkb_component_names (&xkb_comp_names);
XkbRF_Free (xkb_rules, True);
@ -399,16 +403,21 @@ meta_backend_x11_cm_class_init (MetaBackendX11CmClass *klass)
backend_class->post_init = meta_backend_x11_cm_post_init;
backend_class->create_renderer = meta_backend_x11_cm_create_renderer;
backend_class->create_monitor_manager = meta_backend_x11_cm_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_x11_cm_create_cursor_renderer;
backend_class->create_input_settings = meta_backend_x11_cm_create_input_settings;
backend_class->create_monitor_manager =
meta_backend_x11_cm_create_monitor_manager;
backend_class->create_cursor_renderer =
meta_backend_x11_cm_create_cursor_renderer;
backend_class->create_input_settings =
meta_backend_x11_cm_create_input_settings;
backend_class->update_screen_size = meta_backend_x11_cm_update_screen_size;
backend_class->select_stage_events = meta_backend_x11_cm_select_stage_events;
backend_class->lock_layout_group = meta_backend_x11_cm_lock_layout_group;
backend_class->set_keymap = meta_backend_x11_cm_set_keymap;
backend_x11_class->handle_host_xevent = meta_backend_x11_cm_handle_host_xevent;
backend_x11_class->translate_device_event = meta_backend_x11_cm_translate_device_event;
backend_x11_class->translate_crossing_event = meta_backend_x11_cm_translate_crossing_event;
backend_x11_class->handle_host_xevent =
meta_backend_x11_cm_handle_host_xevent;
backend_x11_class->translate_device_event =
meta_backend_x11_cm_translate_device_event;
backend_x11_class->translate_crossing_event =
meta_backend_x11_cm_translate_crossing_event;
}

View File

@ -329,7 +329,8 @@ handle_host_xevent (MetaBackend *backend,
if (meta_plugin_manager_xevent_filter (compositor->plugin_mgr, event))
bypass_clutter = TRUE;
if (meta_dnd_handle_xdnd_event (backend, compositor, priv->xdisplay, event))
if (meta_dnd_handle_xdnd_event (backend, compositor, priv->xdisplay,
event))
bypass_clutter = TRUE;
}
}
@ -383,7 +384,8 @@ handle_host_xevent (MetaBackend *backend,
XFreeEventData (priv->xdisplay, &event->xcookie);
}
typedef struct {
typedef struct
{
GSource base;
GPollFD event_poll_fd;
MetaBackend *backend;
@ -436,7 +438,8 @@ x_event_source_dispatch (GSource *source,
return TRUE;
}
static GSourceFuncs x_event_funcs = {
static GSourceFuncs x_event_funcs =
{
x_event_source_prepare,
x_event_source_check,
x_event_source_dispatch,
@ -482,7 +485,8 @@ meta_backend_x11_post_init (MetaBackend *backend)
priv->source = x_event_source_new (backend);
if (!XSyncQueryExtension (priv->xdisplay, &priv->xsync_event_base, &priv->xsync_error_base) ||
if (!XSyncQueryExtension (priv->xdisplay, &priv->xsync_event_base,
&priv->xsync_error_base) ||
!XSyncInitialize (priv->xdisplay, &major, &minor))
meta_fatal ("Could not initialize XSync");
@ -498,7 +502,8 @@ meta_backend_x11_post_init (MetaBackend *backend)
&priv->xinput_error_base,
&priv->xinput_event_base))
{
major = 2; minor = 3;
major = 2;
minor = 3;
if (XIQueryVersion (priv->xdisplay, &major, &minor) == Success)
{
int version = (major * 10) + minor;
@ -508,7 +513,8 @@ meta_backend_x11_post_init (MetaBackend *backend)
}
if (!has_xi)
meta_fatal ("X server doesn't have the XInput extension, version 2.2 or newer\n");
meta_fatal (
"X server doesn't have the XInput extension, version 2.2 or newer\n");
if (!xkb_x11_setup_xkb_extension (priv->xcb,
XKB_X11_MIN_MAJOR_XKB_VERSION,
@ -517,7 +523,8 @@ meta_backend_x11_post_init (MetaBackend *backend)
NULL, NULL,
&priv->xkb_event_base,
&priv->xkb_error_base))
meta_fatal ("X server doesn't have the XKB extension, version %d.%d or newer\n",
meta_fatal (
"X server doesn't have the XKB extension, version %d.%d or newer\n",
XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION);
META_BACKEND_CLASS (meta_backend_x11_parent_class)->post_init (backend);
@ -634,10 +641,12 @@ meta_backend_x11_get_keymap (MetaBackend *backend)
struct xkb_context *context = xkb_context_new (XKB_CONTEXT_NO_FLAGS);
priv->keymap = xkb_x11_keymap_new_from_device (context,
priv->xcb,
xkb_x11_get_core_keyboard_device_id (priv->xcb),
xkb_x11_get_core_keyboard_device_id (
priv->xcb),
XKB_KEYMAP_COMPILE_NO_FLAGS);
if (priv->keymap == NULL)
priv->keymap = xkb_keymap_new_from_names (context, NULL, XKB_KEYMAP_COMPILE_NO_FLAGS);
priv->keymap = xkb_keymap_new_from_names (context, NULL,
XKB_KEYMAP_COMPILE_NO_FLAGS);
xkb_context_unref (context);
}
@ -762,14 +771,17 @@ meta_backend_x11_class_init (MetaBackendX11Class *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_backend_x11_finalize;
backend_class->create_clutter_backend = meta_backend_x11_create_clutter_backend;
backend_class->create_clutter_backend =
meta_backend_x11_create_clutter_backend;
backend_class->post_init = meta_backend_x11_post_init;
backend_class->grab_device = meta_backend_x11_grab_device;
backend_class->ungrab_device = meta_backend_x11_ungrab_device;
backend_class->warp_pointer = meta_backend_x11_warp_pointer;
backend_class->get_current_logical_monitor = meta_backend_x11_get_current_logical_monitor;
backend_class->get_current_logical_monitor =
meta_backend_x11_get_current_logical_monitor;
backend_class->get_keymap = meta_backend_x11_get_keymap;
backend_class->get_keymap_layout_group = meta_backend_x11_get_keymap_layout_group;
backend_class->get_keymap_layout_group =
meta_backend_x11_get_keymap_layout_group;
backend_class->set_numlock = meta_backend_x11_set_numlock;
}

View File

@ -103,7 +103,8 @@ meta_crtc_xrandr_set_config (MetaCrtc *crtc,
static MetaMonitorTransform
meta_monitor_transform_from_xrandr (Rotation rotation)
{
static const MetaMonitorTransform y_reflected_map[4] = {
static const MetaMonitorTransform y_reflected_map[4] =
{
META_MONITOR_TRANSFORM_FLIPPED_180,
META_MONITOR_TRANSFORM_FLIPPED_90,
META_MONITOR_TRANSFORM_FLIPPED,
@ -136,7 +137,8 @@ meta_monitor_transform_from_xrandr (Rotation rotation)
return ret;
}
#define ALL_ROTATIONS (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | RR_Rotate_270)
#define ALL_ROTATIONS (RR_Rotate_0 | RR_Rotate_90 | RR_Rotate_180 | \
RR_Rotate_270)
static MetaMonitorTransform
meta_monitor_transform_from_xrandr_all (Rotation rotation)

View File

@ -38,14 +38,16 @@ struct _MetaCursorRendererX11Private
};
typedef struct _MetaCursorRendererX11Private MetaCursorRendererX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererX11, meta_cursor_renderer_x11, META_TYPE_CURSOR_RENDERER);
G_DEFINE_TYPE_WITH_PRIVATE (MetaCursorRendererX11, meta_cursor_renderer_x11,
META_TYPE_CURSOR_RENDERER);
static gboolean
meta_cursor_renderer_x11_update_cursor (MetaCursorRenderer *renderer,
MetaCursorSprite *cursor_sprite)
{
MetaCursorRendererX11 *x11 = META_CURSOR_RENDERER_X11 (renderer);
MetaCursorRendererX11Private *priv = meta_cursor_renderer_x11_get_instance_private (x11);
MetaCursorRendererX11Private *priv =
meta_cursor_renderer_x11_get_instance_private (x11);
MetaBackendX11 *backend = META_BACKEND_X11 (meta_get_backend ());
Window xwindow = meta_backend_x11_get_xwindow (backend);
@ -107,7 +109,8 @@ meta_cursor_renderer_x11_class_init (MetaCursorRendererX11Class *klass)
static void
meta_cursor_renderer_x11_init (MetaCursorRendererX11 *x11)
{
MetaCursorRendererX11Private *priv = meta_cursor_renderer_x11_get_instance_private (x11);
MetaCursorRendererX11Private *priv =
meta_cursor_renderer_x11_get_instance_private (x11);
/* XFixes has no way to retrieve the current cursor visibility. */
priv->server_cursor_visible = TRUE;

View File

@ -50,7 +50,8 @@ typedef struct _MetaInputSettingsX11Private
G_DEFINE_TYPE_WITH_PRIVATE (MetaInputSettingsX11, meta_input_settings_x11,
META_TYPE_INPUT_SETTINGS)
enum {
enum
{
SCROLL_METHOD_FIELD_2FG,
SCROLL_METHOD_FIELD_EDGE,
SCROLL_METHOD_FIELD_BUTTON,
@ -62,7 +63,8 @@ device_free_xdevice (gpointer user_data)
{
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XDevice *xdev = user_data;
meta_x11_error_trap_push (display->x11_display);
@ -75,7 +77,8 @@ device_ensure_xdevice (ClutterInputDevice *device)
{
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
int device_id = clutter_input_device_get_device_id (device);
XDevice *xdev = NULL;
@ -105,7 +108,8 @@ get_property (ClutterInputDevice *device,
gulong nitems)
{
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gulong nitems_ret, bytes_after_ret;
int rc, device_id, format_ret;
Atom property_atom, type_ret;
@ -120,11 +124,14 @@ get_property (ClutterInputDevice *device,
rc = XIGetProperty (xdisplay, device_id, property_atom,
0, 10, False, type, &type_ret, &format_ret,
&nitems_ret, &bytes_after_ret, &data_ret);
if (rc == Success && type_ret == type && format_ret == format && nitems_ret >= nitems)
if (rc == Success && type_ret == type && format_ret == format &&
nitems_ret >= nitems)
{
if (nitems_ret > nitems)
g_warning ("Property '%s' for device '%s' returned %lu items, expected %lu",
property, clutter_input_device_get_device_name (device), nitems_ret, nitems);
g_warning (
"Property '%s' for device '%s' returned %lu items, expected %lu",
property, clutter_input_device_get_device_name (
device), nitems_ret, nitems);
return data_ret;
}
@ -141,7 +148,8 @@ change_property (ClutterInputDevice *device,
gulong nitems)
{
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
int device_id;
Atom property_atom;
guchar *data_ret;
@ -202,10 +210,14 @@ meta_input_settings_x11_set_matrix (MetaInputSettings *settings,
gfloat matrix[6])
{
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat full_matrix[9] = { matrix[0], matrix[1], matrix[2],
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat full_matrix[9] =
{
matrix[0], matrix[1], matrix[2],
matrix[3], matrix[4], matrix[5],
0, 0, 1 };
0, 0, 1
};
change_property (device, "Coordinate Transformation Matrix",
XInternAtom (xdisplay, "FLOAT", False),
@ -218,7 +230,8 @@ meta_input_settings_x11_set_speed (MetaInputSettings *settings,
gdouble speed)
{
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gfloat value = speed;
change_property (device, "libinput Accel Speed",
@ -301,7 +314,8 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean edge_scroll_enabled)
{
guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The last value is unused */
guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The
* last value is unused */
guchar *current = NULL;
guchar *available = NULL;
@ -330,7 +344,8 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set
ClutterInputDevice *device,
gboolean two_finger_scroll_enabled)
{
guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The last value is unused */
guchar values[SCROLL_METHOD_NUM_FIELDS] = { 0 }; /* 2fg, edge, button. The
* last value is unused */
guchar *current = NULL;
guchar *available = NULL;
@ -432,7 +447,8 @@ meta_input_settings_x11_set_keyboard_repeat (MetaInputSettings *settings,
guint interval)
{
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
if (enabled)
{
@ -553,7 +569,8 @@ err_available:
}
static void
meta_input_settings_x11_set_mouse_accel_profile (MetaInputSettings *settings,
meta_input_settings_x11_set_mouse_accel_profile (
MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile)
{
@ -564,7 +581,8 @@ meta_input_settings_x11_set_mouse_accel_profile (MetaInputSettings *set
}
static void
meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings *settings,
meta_input_settings_x11_set_trackball_accel_profile (
MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopPointerAccelProfile profile)
{
@ -581,7 +599,8 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
{
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XDevice *xdev;
if (!display)
@ -621,7 +640,8 @@ device_query_area (ClutterInputDevice *device,
gint *height)
{
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
gint device_id, n_devices, i;
XIDeviceInfo *info;
Atom abs_x, abs_y;
@ -768,7 +788,8 @@ action_to_button (GDesktopStylusButtonAction action,
}
static void
meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *settings,
meta_input_settings_x11_set_stylus_button_map (
MetaInputSettings *settings,
ClutterInputDevice *device,
ClutterInputDeviceTool *tool,
GDesktopStylusButtonAction primary,
@ -777,7 +798,8 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
{
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XDevice *xdev;
if (!display)
@ -788,7 +810,8 @@ meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *setti
xdev = device_ensure_xdevice (device);
if (xdev)
{
guchar map[8] = {
guchar map[8] =
{
CLUTTER_BUTTON_PRIMARY,
action_to_button (primary, CLUTTER_BUTTON_MIDDLE),
action_to_button (secondary, CLUTTER_BUTTON_SECONDARY),
@ -825,36 +848,57 @@ static void
meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MetaInputSettingsClass *input_settings_class = META_INPUT_SETTINGS_CLASS (klass);
MetaInputSettingsClass *input_settings_class = META_INPUT_SETTINGS_CLASS (
klass);
object_class->dispose = meta_input_settings_x11_dispose;
input_settings_class->set_send_events = meta_input_settings_x11_set_send_events;
input_settings_class->set_send_events =
meta_input_settings_x11_set_send_events;
input_settings_class->set_matrix = meta_input_settings_x11_set_matrix;
input_settings_class->set_speed = meta_input_settings_x11_set_speed;
input_settings_class->set_left_handed = meta_input_settings_x11_set_left_handed;
input_settings_class->set_tap_enabled = meta_input_settings_x11_set_tap_enabled;
input_settings_class->set_tap_and_drag_enabled = meta_input_settings_x11_set_tap_and_drag_enabled;
input_settings_class->set_disable_while_typing = meta_input_settings_x11_set_disable_while_typing;
input_settings_class->set_invert_scroll = meta_input_settings_x11_set_invert_scroll;
input_settings_class->set_edge_scroll = meta_input_settings_x11_set_edge_scroll;
input_settings_class->set_two_finger_scroll = meta_input_settings_x11_set_two_finger_scroll;
input_settings_class->set_scroll_button = meta_input_settings_x11_set_scroll_button;
input_settings_class->set_click_method = meta_input_settings_x11_set_click_method;
input_settings_class->set_keyboard_repeat = meta_input_settings_x11_set_keyboard_repeat;
input_settings_class->set_left_handed =
meta_input_settings_x11_set_left_handed;
input_settings_class->set_tap_enabled =
meta_input_settings_x11_set_tap_enabled;
input_settings_class->set_tap_and_drag_enabled =
meta_input_settings_x11_set_tap_and_drag_enabled;
input_settings_class->set_disable_while_typing =
meta_input_settings_x11_set_disable_while_typing;
input_settings_class->set_invert_scroll =
meta_input_settings_x11_set_invert_scroll;
input_settings_class->set_edge_scroll =
meta_input_settings_x11_set_edge_scroll;
input_settings_class->set_two_finger_scroll =
meta_input_settings_x11_set_two_finger_scroll;
input_settings_class->set_scroll_button =
meta_input_settings_x11_set_scroll_button;
input_settings_class->set_click_method =
meta_input_settings_x11_set_click_method;
input_settings_class->set_keyboard_repeat =
meta_input_settings_x11_set_keyboard_repeat;
input_settings_class->set_tablet_mapping = meta_input_settings_x11_set_tablet_mapping;
input_settings_class->set_tablet_keep_aspect = meta_input_settings_x11_set_tablet_keep_aspect;
input_settings_class->set_tablet_area = meta_input_settings_x11_set_tablet_area;
input_settings_class->set_tablet_mapping =
meta_input_settings_x11_set_tablet_mapping;
input_settings_class->set_tablet_keep_aspect =
meta_input_settings_x11_set_tablet_keep_aspect;
input_settings_class->set_tablet_area =
meta_input_settings_x11_set_tablet_area;
input_settings_class->set_mouse_accel_profile = meta_input_settings_x11_set_mouse_accel_profile;
input_settings_class->set_trackball_accel_profile = meta_input_settings_x11_set_trackball_accel_profile;
input_settings_class->set_mouse_accel_profile =
meta_input_settings_x11_set_mouse_accel_profile;
input_settings_class->set_trackball_accel_profile =
meta_input_settings_x11_set_trackball_accel_profile;
input_settings_class->set_stylus_pressure = meta_input_settings_x11_set_stylus_pressure;
input_settings_class->set_stylus_button_map = meta_input_settings_x11_set_stylus_button_map;
input_settings_class->set_stylus_pressure =
meta_input_settings_x11_set_stylus_pressure;
input_settings_class->set_stylus_button_map =
meta_input_settings_x11_set_stylus_button_map;
input_settings_class->has_two_finger_scroll = meta_input_settings_x11_has_two_finger_scroll;
input_settings_class->is_trackball_device = meta_input_settings_x11_is_trackball_device;
input_settings_class->has_two_finger_scroll =
meta_input_settings_x11_has_two_finger_scroll;
input_settings_class->is_trackball_device =
meta_input_settings_x11_is_trackball_device;
}
static void

View File

@ -81,7 +81,8 @@ struct _MetaMonitorManagerXrandrClass
MetaMonitorManagerClass parent_class;
};
G_DEFINE_TYPE (MetaMonitorManagerXrandr, meta_monitor_manager_xrandr, META_TYPE_MONITOR_MANAGER);
G_DEFINE_TYPE (MetaMonitorManagerXrandr, meta_monitor_manager_xrandr,
META_TYPE_MONITOR_MANAGER);
typedef struct _MetaMonitorXrandrData
{
@ -91,13 +92,15 @@ typedef struct _MetaMonitorXrandrData
GQuark quark_meta_monitor_xrandr_data;
Display *
meta_monitor_manager_xrandr_get_xdisplay (MetaMonitorManagerXrandr *manager_xrandr)
meta_monitor_manager_xrandr_get_xdisplay (
MetaMonitorManagerXrandr *manager_xrandr)
{
return manager_xrandr->xdisplay;
}
gboolean
meta_monitor_manager_xrandr_has_randr15 (MetaMonitorManagerXrandr *manager_xrandr)
meta_monitor_manager_xrandr_has_randr15 (
MetaMonitorManagerXrandr *manager_xrandr)
{
return manager_xrandr->has_randr15;
}
@ -113,10 +116,12 @@ static void
meta_monitor_manager_xrandr_set_power_save_mode (MetaMonitorManager *manager,
MetaPowerSave mode)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (
manager);
CARD16 state;
switch (mode) {
switch (mode)
{
case META_POWER_SAVE_ON:
state = DPMSModeOn;
break;
@ -329,7 +334,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
MetaOutputInfo **outputs,
unsigned int n_outputs)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (
manager);
unsigned i;
GList *l;
int width, height, width_mm, height_mm;
@ -337,7 +343,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
XGrabServer (manager_xrandr->xdisplay);
/* First compute the new size of the screen (framebuffer) */
width = 0; height = 0;
width = 0;
height = 0;
for (i = 0; i < n_crtcs; i++)
{
MetaCrtcInfo *crtc_info = crtcs[i];
@ -360,9 +367,9 @@ apply_crtc_assignments (MetaMonitorManager *manager,
}
/* Second disable all newly disabled CRTCs, or CRTCs that in the previous
configuration would be outside the new framebuffer (otherwise X complains
loudly when resizing)
CRTC will be enabled again after resizing the FB
* configuration would be outside the new framebuffer (otherwise X complains
* loudly when resizing)
* CRTC will be enabled again after resizing the FB
*/
for (i = 0; i < n_crtcs; i++)
{
@ -428,7 +435,8 @@ apply_crtc_assignments (MetaMonitorManager *manager,
*/
width_mm = (width / DPI_FALLBACK) * 25.4 + 0.5;
height_mm = (height / DPI_FALLBACK) * 25.4 + 0.5;
XRRSetScreenSize (manager_xrandr->xdisplay, DefaultRootWindow (manager_xrandr->xdisplay),
XRRSetScreenSize (manager_xrandr->xdisplay,
DefaultRootWindow (manager_xrandr->xdisplay),
width, height, width_mm, height_mm);
for (i = 0; i < n_crtcs; i++)
@ -471,8 +479,10 @@ apply_crtc_assignments (MetaMonitorManager *manager,
rotation,
output_ids, n_output_ids))
{
meta_warning ("Configuring CRTC %d with mode %d (%d x %d @ %f) at position %d, %d and transform %u failed\n",
(unsigned)(crtc->crtc_id), (unsigned)(mode->mode_id),
meta_warning (
"Configuring CRTC %d with mode %d (%d x %d @ %f) at position %d, %d and transform %u failed\n",
(unsigned) (crtc->crtc_id),
(unsigned) (mode->mode_id),
mode->width, mode->height, (float) mode->refresh_rate,
crtc_info->x, crtc_info->y, crtc_info->transform);
continue;
@ -561,7 +571,8 @@ meta_monitor_manager_xrandr_rebuild_derived (MetaMonitorManager *manager,
}
static gboolean
meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *manager,
meta_monitor_manager_xrandr_apply_monitors_config (
MetaMonitorManager *manager,
MetaMonitorsConfig *config,
MetaMonitorsConfigMethod method,
GError **error)
@ -631,7 +642,8 @@ meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager,
unsigned short **green,
unsigned short **blue)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (
manager);
XRRCrtcGamma *gamma;
gamma = XRRGetCrtcGamma (manager_xrandr->xdisplay, (XID) crtc->crtc_id);
@ -652,7 +664,8 @@ meta_monitor_manager_xrandr_set_crtc_gamma (MetaMonitorManager *manager,
unsigned short *green,
unsigned short *blue)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (
manager);
XRRCrtcGamma *gamma;
gamma = XRRAllocGamma (size);
@ -685,7 +698,8 @@ meta_monitor_xrandr_data_from_monitor (MetaMonitor *monitor)
}
static void
meta_monitor_manager_xrandr_increase_monitor_count (MetaMonitorManagerXrandr *manager_xrandr,
meta_monitor_manager_xrandr_increase_monitor_count (
MetaMonitorManagerXrandr *manager_xrandr,
Atom name_atom)
{
int count;
@ -701,7 +715,8 @@ meta_monitor_manager_xrandr_increase_monitor_count (MetaMonitorManagerXrandr *ma
}
static int
meta_monitor_manager_xrandr_decrease_monitor_count (MetaMonitorManagerXrandr *manager_xrandr,
meta_monitor_manager_xrandr_decrease_monitor_count (
MetaMonitorManagerXrandr *manager_xrandr,
Atom name_atom)
{
int count;
@ -723,7 +738,8 @@ static void
meta_monitor_manager_xrandr_tiled_monitor_added (MetaMonitorManager *manager,
MetaMonitor *monitor)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (
manager);
MetaMonitorTiled *monitor_tiled = META_MONITOR_TILED (monitor);
const char *product;
char *name;
@ -778,7 +794,8 @@ static void
meta_monitor_manager_xrandr_tiled_monitor_removed (MetaMonitorManager *manager,
MetaMonitor *monitor)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (
manager);
MetaMonitorXrandrData *monitor_xrandr_data;
Atom monitor_name;
@ -800,7 +817,8 @@ meta_monitor_manager_xrandr_tiled_monitor_removed (MetaMonitorManager *manager,
}
static void
meta_monitor_manager_xrandr_init_monitors (MetaMonitorManagerXrandr *manager_xrandr)
meta_monitor_manager_xrandr_init_monitors (
MetaMonitorManagerXrandr *manager_xrandr)
{
XRRMonitorInfo *m;
int n, i;
@ -809,7 +827,7 @@ meta_monitor_manager_xrandr_init_monitors (MetaMonitorManagerXrandr *manager_xra
return;
/* delete any tiled monitors setup, as mutter will want to recreate
things in its image */
* things in its image */
m = XRRGetMonitors (manager_xrandr->xdisplay,
DefaultRootWindow (manager_xrandr->xdisplay),
FALSE, &n);
@ -837,7 +855,8 @@ meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager,
}
static float
meta_monitor_manager_xrandr_calculate_monitor_mode_scale (MetaMonitorManager *manager,
meta_monitor_manager_xrandr_calculate_monitor_mode_scale (
MetaMonitorManager *manager,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode)
{
@ -916,7 +935,8 @@ ensure_supported_monitor_scales (MetaMonitorManager *manager)
}
static float *
meta_monitor_manager_xrandr_calculate_supported_scales (MetaMonitorManager *manager,
meta_monitor_manager_xrandr_calculate_supported_scales (
MetaMonitorManager *manager,
MetaLogicalMonitorLayoutMode layout_mode,
MetaMonitor *monitor,
MetaMonitorMode *monitor_mode,
@ -983,7 +1003,7 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
{
int major_version, minor_version;
/* We only use ScreenChangeNotify, but GDK uses the others,
and we don't want to step on its toes */
* and we don't want to step on its toes */
XRRSelectInput (manager_xrandr->xdisplay,
DefaultRootWindow (manager_xrandr->xdisplay),
RRScreenChangeNotifyMask
@ -1009,7 +1029,8 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
static void
meta_monitor_manager_xrandr_finalize (GObject *object)
{
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (object);
MetaMonitorManagerXrandr *manager_xrandr =
META_MONITOR_MANAGER_XRANDR (object);
g_clear_object (&manager_xrandr->gpu);
g_hash_table_destroy (manager_xrandr->tiled_monitor_atoms);
@ -1033,27 +1054,40 @@ meta_monitor_manager_xrandr_class_init (MetaMonitorManagerXrandrClass *klass)
object_class->constructed = meta_monitor_manager_xrandr_constructed;
manager_class->read_edid = meta_monitor_manager_xrandr_read_edid;
manager_class->ensure_initial_config = meta_monitor_manager_xrandr_ensure_initial_config;
manager_class->apply_monitors_config = meta_monitor_manager_xrandr_apply_monitors_config;
manager_class->set_power_save_mode = meta_monitor_manager_xrandr_set_power_save_mode;
manager_class->change_backlight = meta_monitor_manager_xrandr_change_backlight;
manager_class->ensure_initial_config =
meta_monitor_manager_xrandr_ensure_initial_config;
manager_class->apply_monitors_config =
meta_monitor_manager_xrandr_apply_monitors_config;
manager_class->set_power_save_mode =
meta_monitor_manager_xrandr_set_power_save_mode;
manager_class->change_backlight =
meta_monitor_manager_xrandr_change_backlight;
manager_class->get_crtc_gamma = meta_monitor_manager_xrandr_get_crtc_gamma;
manager_class->set_crtc_gamma = meta_monitor_manager_xrandr_set_crtc_gamma;
manager_class->tiled_monitor_added = meta_monitor_manager_xrandr_tiled_monitor_added;
manager_class->tiled_monitor_removed = meta_monitor_manager_xrandr_tiled_monitor_removed;
manager_class->is_transform_handled = meta_monitor_manager_xrandr_is_transform_handled;
manager_class->calculate_monitor_mode_scale = meta_monitor_manager_xrandr_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales = meta_monitor_manager_xrandr_calculate_supported_scales;
manager_class->get_capabilities = meta_monitor_manager_xrandr_get_capabilities;
manager_class->get_max_screen_size = meta_monitor_manager_xrandr_get_max_screen_size;
manager_class->get_default_layout_mode = meta_monitor_manager_xrandr_get_default_layout_mode;
manager_class->tiled_monitor_added =
meta_monitor_manager_xrandr_tiled_monitor_added;
manager_class->tiled_monitor_removed =
meta_monitor_manager_xrandr_tiled_monitor_removed;
manager_class->is_transform_handled =
meta_monitor_manager_xrandr_is_transform_handled;
manager_class->calculate_monitor_mode_scale =
meta_monitor_manager_xrandr_calculate_monitor_mode_scale;
manager_class->calculate_supported_scales =
meta_monitor_manager_xrandr_calculate_supported_scales;
manager_class->get_capabilities =
meta_monitor_manager_xrandr_get_capabilities;
manager_class->get_max_screen_size =
meta_monitor_manager_xrandr_get_max_screen_size;
manager_class->get_default_layout_mode =
meta_monitor_manager_xrandr_get_default_layout_mode;
quark_meta_monitor_xrandr_data =
g_quark_from_static_string ("-meta-monitor-xrandr-data");
}
gboolean
meta_monitor_manager_xrandr_handle_xevent (MetaMonitorManagerXrandr *manager_xrandr,
meta_monitor_manager_xrandr_handle_xevent (
MetaMonitorManagerXrandr *manager_xrandr,
XEvent *event)
{
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);

View File

@ -166,7 +166,8 @@ meta_output_xrandr_change_backlight (MetaOutput *output,
XCB_PROP_MODE_REPLACE,
1, &hw_value);
/* We're not selecting for property notifies, so update the value immediately */
/* We're not selecting for property notifies, so update the value immediately
* */
output->backlight = normalize_backlight (output, hw_value);
}

View File

@ -274,7 +274,8 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window)
logical_monitor = meta_renderer_view_get_logical_monitor (renderer_view);
if (logical_monitor)
{
draw_logical_monitor (stage_nested, logical_monitor, texture, view, &view_layout);
draw_logical_monitor (stage_nested, logical_monitor, texture, view,
&view_layout);
}
else
{
@ -289,7 +290,8 @@ meta_stage_x11_nested_finish_frame (ClutterStageWindow *stage_window)
{
logical_monitor = k->data;
draw_logical_monitor (stage_nested, logical_monitor, texture, view, &view_layout);
draw_logical_monitor (stage_nested, logical_monitor, texture,
view, &view_layout);
}
}
}

View File

@ -99,7 +99,8 @@ meta_backend_x11_nested_select_stage_events (MetaBackend *backend)
* When we're a nested application, we want to behave like any other
* application, so select these events like normal apps do.
*/
XISetMask (mask.mask, XI_TouchBegin); XISetMask (mask.mask, XI_TouchEnd);
XISetMask (mask.mask, XI_TouchBegin);
XISetMask (mask.mask, XI_TouchEnd);
XISetMask (mask.mask, XI_TouchUpdate);
XISelectEvents (xdisplay, xwin, &mask, 1);
@ -185,14 +186,21 @@ meta_backend_x11_nested_class_init (MetaBackendX11NestedClass *klass)
MetaBackendX11Class *backend_x11_class = META_BACKEND_X11_CLASS (klass);
backend_class->create_renderer = meta_backend_x11_nested_create_renderer;
backend_class->create_monitor_manager = meta_backend_x11_nested_create_monitor_manager;
backend_class->create_cursor_renderer = meta_backend_x11_nested_create_cursor_renderer;
backend_class->create_input_settings = meta_backend_x11_nested_create_input_settings;
backend_class->update_screen_size = meta_backend_x11_nested_update_screen_size;
backend_class->select_stage_events = meta_backend_x11_nested_select_stage_events;
backend_class->create_monitor_manager =
meta_backend_x11_nested_create_monitor_manager;
backend_class->create_cursor_renderer =
meta_backend_x11_nested_create_cursor_renderer;
backend_class->create_input_settings =
meta_backend_x11_nested_create_input_settings;
backend_class->update_screen_size =
meta_backend_x11_nested_update_screen_size;
backend_class->select_stage_events =
meta_backend_x11_nested_select_stage_events;
backend_class->lock_layout_group = meta_backend_x11_nested_lock_layout_group;
backend_class->set_keymap = meta_backend_x11_nested_set_keymap;
backend_x11_class->handle_host_xevent = meta_backend_x11_nested_handle_host_xevent;
backend_x11_class->translate_device_event = meta_backend_x11_nested_translate_device_event;
backend_x11_class->handle_host_xevent =
meta_backend_x11_nested_handle_host_xevent;
backend_x11_class->translate_device_event =
meta_backend_x11_nested_translate_device_event;
}

View File

@ -83,7 +83,8 @@ meta_cursor_renderer_x11_nested_init (MetaCursorRendererX11Nested *x11_nested)
}
static void
meta_cursor_renderer_x11_nested_class_init (MetaCursorRendererX11NestedClass *klass)
meta_cursor_renderer_x11_nested_class_init (
MetaCursorRendererX11NestedClass *klass)
{
MetaCursorRendererClass *renderer_class = META_CURSOR_RENDERER_CLASS (klass);

View File

@ -103,14 +103,16 @@ create_offscreen (CoglContext *cogl_context,
}
static void
meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11_nested,
meta_renderer_x11_nested_resize_legacy_view (
MetaRendererX11Nested *renderer_x11_nested,
int width,
int height)
{
MetaRenderer *renderer = META_RENDERER (renderer_x11_nested);
MetaBackend *backend = meta_get_backend ();
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_backend);
MetaRendererView *legacy_view;
cairo_rectangle_int_t view_layout;
CoglOffscreen *fake_onscreen;
@ -137,14 +139,16 @@ meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11
}
void
meta_renderer_x11_nested_ensure_legacy_view (MetaRendererX11Nested *renderer_x11_nested,
meta_renderer_x11_nested_ensure_legacy_view (
MetaRendererX11Nested *renderer_x11_nested,
int width,
int height)
{
MetaRenderer *renderer = META_RENDERER (renderer_x11_nested);
MetaBackend *backend = meta_get_backend ();
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_backend);
cairo_rectangle_int_t view_layout;
CoglOffscreen *fake_onscreen;
MetaRendererView *legacy_view;
@ -178,7 +182,8 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
CoglContext *cogl_context =
clutter_backend_get_cogl_context (clutter_backend);
MetaMonitorTransform view_transform;
float view_scale;
int width, height;
@ -234,4 +239,3 @@ meta_renderer_x11_nested_class_init (MetaRendererX11NestedClass *klass)
renderer_class->create_view = meta_renderer_x11_nested_create_view;
}

View File

@ -57,8 +57,11 @@ round_to_fixed (float x)
/* Help macros to scale from OpenGL <-1,1> coordinates system to
* window coordinates ranging [0,window-size]. Borrowed from clutter-utils.c
*/
#define MTX_GL_SCALE_X(x,w,v1,v2) ((((((x) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
#define MTX_GL_SCALE_Y(y,w,v1,v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
#define MTX_GL_SCALE_X(x, w, v1, \
v2) ((((((x) / (w)) + 1.0f) / 2.0f) * (v1)) + (v2))
#define MTX_GL_SCALE_Y(y, w, v1, \
v2) ((v1) - (((((y) / (w)) + 1.0f) / 2.0f) * (v1)) + \
(v2))
/* This helper function checks if (according to our fixed point precision)
* the vertices @verts form a box of width @widthf and height @heightf
@ -76,12 +79,17 @@ meta_actor_vertices_are_untransformed (ClutterVertex *verts,
int v0x, v0y, v1x, v1y, v2x, v2y, v3x, v3y;
int x, y;
width = round_to_fixed (widthf); height = round_to_fixed (heightf);
width = round_to_fixed (widthf);
height = round_to_fixed (heightf);
v0x = round_to_fixed (verts[0].x); v0y = round_to_fixed (verts[0].y);
v1x = round_to_fixed (verts[1].x); v1y = round_to_fixed (verts[1].y);
v2x = round_to_fixed (verts[2].x); v2y = round_to_fixed (verts[2].y);
v3x = round_to_fixed (verts[3].x); v3y = round_to_fixed (verts[3].y);
v0x = round_to_fixed (verts[0].x);
v0y = round_to_fixed (verts[0].y);
v1x = round_to_fixed (verts[1].x);
v1y = round_to_fixed (verts[1].y);
v2x = round_to_fixed (verts[2].x);
v2y = round_to_fixed (verts[2].y);
v3x = round_to_fixed (verts[3].x);
v3y = round_to_fixed (verts[3].y);
/* Using shifting for converting fixed => int, gets things right for
* negative values. / 256. wouldn't do the same
@ -124,7 +132,8 @@ meta_actor_is_untransformed (ClutterActor *actor,
clutter_actor_get_size (actor, &widthf, &heightf);
clutter_actor_get_abs_allocation_vertices (actor, verts);
return meta_actor_vertices_are_untransformed (verts, widthf, heightf, x_origin, y_origin);
return meta_actor_vertices_are_untransformed (verts, widthf, heightf,
x_origin, y_origin);
}
/**
@ -181,13 +190,15 @@ meta_actor_painting_untransformed (int paint_width,
for (i = 0; i < 4; i++)
{
float w = 1;
cogl_matrix_transform_point (&modelview_projection, &vertices[i].x, &vertices[i].y, &vertices[i].z, &w);
cogl_matrix_transform_point (&modelview_projection, &vertices[i].x,
&vertices[i].y, &vertices[i].z, &w);
vertices[i].x = MTX_GL_SCALE_X (vertices[i].x, w,
viewport[2], viewport[0]);
vertices[i].y = MTX_GL_SCALE_Y (vertices[i].y, w,
viewport[3], viewport[1]);
}
return meta_actor_vertices_are_untransformed (vertices, paint_width, paint_height, x_origin, y_origin);
return meta_actor_vertices_are_untransformed (vertices, paint_width,
paint_height, x_origin,
y_origin);
}

View File

@ -43,11 +43,11 @@ meta_create_texture_pipeline (CoglTexture *src_texture)
CoglPipeline *pipeline;
/* The only state used in the pipeline that would affect the shader
generation is the texture type on the layer. Therefore we create
a template pipeline which sets this state and all texture
pipelines are created as a copy of this. That way Cogl can find
the shader state for the pipeline more quickly by looking at the
pipeline ancestry instead of resorting to the shader cache. */
* generation is the texture type on the layer. Therefore we create
* a template pipeline which sets this state and all texture
* pipelines are created as a copy of this. That way Cogl can find
* the shader state for the pipeline more quickly by looking at the
* pipeline ancestry instead of resorting to the shader cache. */
if (G_UNLIKELY (texture_pipeline_template == NULL))
{
CoglContext *ctx =
@ -119,14 +119,16 @@ meta_create_texture (int width,
}
if (should_use_rectangle)
texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, width, height));
texture =
COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, width, height));
else
texture = COGL_TEXTURE (cogl_texture_2d_new_with_size (ctx, width, height));
cogl_texture_set_components (texture, components);
if ((flags & META_TEXTURE_ALLOW_SLICING) != 0)
{
/* To find out if we need to slice the texture, we have to go ahead and force storage
/* To find out if we need to slice the texture, we have to go ahead and
* force storage
* to be allocated
*/
CoglError *catch_error = NULL;
@ -134,7 +136,10 @@ meta_create_texture (int width,
{
cogl_error_free (catch_error);
cogl_object_unref (texture);
texture = COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx, width, height, COGL_TEXTURE_MAX_WASTE));
texture =
COGL_TEXTURE (cogl_texture_2d_sliced_new_with_size (ctx, width,
height,
COGL_TEXTURE_MAX_WASTE));
cogl_texture_set_components (texture, components);
}
}

View File

@ -39,7 +39,8 @@
*
* # Containers #
*
* There's two containers in the stage that are used to place window actors, here
* There's two containers in the stage that are used to place window actors,
*here
* are listed in the order in which they are painted:
*
* - window group, accessible with meta_get_window_group_for_display()
@ -141,7 +142,8 @@ process_damage (MetaCompositor *compositor,
XDamageNotifyEvent *event,
MetaWindow *window)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
window));
meta_window_actor_process_x11_damage (window_actor, event);
compositor->frame_has_updated_xsurfaces = TRUE;
@ -210,7 +212,8 @@ meta_get_feedback_group_for_display (MetaDisplay *display)
* meta_get_window_actors:
* @display: a #MetaDisplay
*
* Returns: (transfer none) (element-type Clutter.Actor): The set of #MetaWindowActor on @display
* Returns: (transfer none) (element-type Clutter.Actor): The set of
*#MetaWindowActor on @display
*/
GList *
meta_get_window_actors (MetaDisplay *display)
@ -232,23 +235,29 @@ meta_set_stage_input_region (MetaDisplay *display,
{
MetaCompositor *compositor = display->compositor;
Display *xdpy = meta_x11_display_get_xdisplay (display->x11_display);
Window xstage = clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
Window xstage =
clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage));
XFixesSetWindowShapeRegion (xdpy, xstage, ShapeInput, 0, 0, region);
/* It's generally a good heuristic that when a crossing event is generated because
* we reshape the overlay, we don't want it to affect focus-follows-mouse focus -
* it's not the user doing something, it's the environment changing under the user.
/* It's generally a good heuristic that when a crossing event is generated
* because
* we reshape the overlay, we don't want it to affect focus-follows-mouse
*focus -
* it's not the user doing something, it's the environment changing under
*the user.
*/
meta_display_add_ignored_crossing_serial (display, XNextRequest (xdpy));
XFixesSetWindowShapeRegion (xdpy, compositor->output, ShapeInput, 0, 0, region);
XFixesSetWindowShapeRegion (xdpy, compositor->output, ShapeInput, 0, 0,
region);
}
}
void
meta_empty_stage_input_region (MetaDisplay *display)
{
/* Using a static region here is a bit hacky, but Metacity never opens more than
/* Using a static region here is a bit hacky, but Metacity never opens more
* than
* one XDisplay, so it works fine. */
static XserverRegion region = None;
@ -313,7 +322,8 @@ grab_devices (MetaModalOptions options,
if ((options & META_MODAL_POINTER_ALREADY_GRABBED) == 0)
{
if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID,
timestamp))
goto fail;
pointer_grabbed = TRUE;
@ -321,7 +331,8 @@ grab_devices (MetaModalOptions options,
if ((options & META_MODAL_KEYBOARD_ALREADY_GRABBED) == 0)
{
if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp))
if (!meta_backend_grab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID,
timestamp))
goto fail;
keyboard_grabbed = TRUE;
@ -331,9 +342,11 @@ grab_devices (MetaModalOptions options,
fail:
if (pointer_grabbed)
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID,
timestamp);
if (keyboard_grabbed)
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID,
timestamp);
return FALSE;
}
@ -344,8 +357,10 @@ meta_begin_modal_for_plugin (MetaCompositor *compositor,
MetaModalOptions options,
guint32 timestamp)
{
/* To some extent this duplicates code in meta_display_begin_grab_op(), but there
* are significant differences in how we handle grabs that make it difficult to
/* To some extent this duplicates code in meta_display_begin_grab_op(), but
* there
* are significant differences in how we handle grabs that make it difficult
*to
* merge the two.
*/
MetaDisplay *display = compositor->display;
@ -417,7 +432,8 @@ meta_end_modal_for_plugin (MetaCompositor *compositor,
display->grab_have_keyboard = FALSE;
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID, timestamp);
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_KEYBOARD_ID,
timestamp);
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
@ -440,7 +456,8 @@ after_stage_paint (ClutterStage *stage,
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
meta_wayland_compositor_paint_finished (meta_wayland_compositor_get_default ());
meta_wayland_compositor_paint_finished (
meta_wayland_compositor_get_default ());
#endif
}
@ -460,7 +477,8 @@ redirect_windows (MetaX11Display *x11_display)
n_retries = 0;
/* Some compositors (like old versions of Mutter) might not properly unredirect
/* Some compositors (like old versions of Mutter) might not properly
* unredirect
* subwindows before destroying the WM selection window; so we wait a while
* for such a compositor to exit before giving up.
*/
@ -475,9 +493,11 @@ redirect_windows (MetaX11Display *x11_display)
if (n_retries == max_retries)
{
/* This probably means that a non-WM compositor like xcompmgr is running;
/* This probably means that a non-WM compositor like xcompmgr is
* running;
* we have no way to get it to exit */
meta_fatal (_("Another compositing manager is already running on screen %i on display “%s”."),
meta_fatal (_(
"Another compositing manager is already running on screen %i on display “%s”."),
screen_number, x11_display->name);
}
@ -516,7 +536,8 @@ meta_compositor_manage (MetaCompositor *compositor)
g_signal_connect_after (CLUTTER_STAGE (compositor->stage), "after-paint",
G_CALLBACK (after_stage_paint), compositor);
clutter_stage_set_sync_delay (CLUTTER_STAGE (compositor->stage), META_SYNC_DELAY);
clutter_stage_set_sync_delay (CLUTTER_STAGE (
compositor->stage), META_SYNC_DELAY);
compositor->window_group = meta_window_group_new (display);
compositor->top_window_group = meta_window_group_new (display);
@ -553,9 +574,11 @@ meta_compositor_manage (MetaCompositor *compositor)
* because the X server will destroy the overlay window
* when the last client using it exits.
*/
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, None);
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding,
0, 0, None);
/* Map overlay window before redirecting windows offscreen so we catch their
/* Map overlay window before redirecting windows offscreen so we catch
* their
* contents until we show the stage.
*/
XMapWindow (xdisplay, compositor->output);
@ -604,7 +627,8 @@ meta_shape_cow_for_window (MetaCompositor *compositor,
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
if (window == NULL)
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, None);
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0,
0, None);
else
{
XserverRegion output_region;
@ -628,7 +652,8 @@ meta_shape_cow_for_window (MetaCompositor *compositor,
output_region = XFixesCreateRegion (xdisplay, &window_bounds, 1);
XFixesInvertRegion (xdisplay, output_region, &screen_rect, output_region);
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding, 0, 0, output_region);
XFixesSetWindowShapeRegion (xdisplay, compositor->output, ShapeBounding,
0, 0, output_region);
XFixesDestroyRegion (xdisplay, output_region);
}
}
@ -642,7 +667,9 @@ set_unredirected_window (MetaCompositor *compositor,
if (compositor->unredirected_window != NULL)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
compositor->
unredirected_window));
meta_window_actor_set_unredirected (window_actor, FALSE);
}
@ -651,7 +678,9 @@ set_unredirected_window (MetaCompositor *compositor,
if (compositor->unredirected_window != NULL)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (compositor->unredirected_window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
compositor->
unredirected_window));
meta_window_actor_set_unredirected (window_actor, TRUE);
}
}
@ -674,7 +703,8 @@ void
meta_compositor_remove_window (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
window));
if (compositor->unredirected_window == window)
set_unredirected_window (compositor, NULL);
@ -686,7 +716,8 @@ void
meta_compositor_sync_updates_frozen (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
window));
meta_window_actor_sync_updates_frozen (window_actor);
}
@ -695,7 +726,8 @@ meta_compositor_queue_frame_drawn (MetaCompositor *compositor,
MetaWindow *window,
gboolean no_delay_frame)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
window));
meta_window_actor_queue_frame_drawn (window_actor, no_delay_frame);
}
@ -704,7 +736,8 @@ meta_compositor_window_shape_changed (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor;
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
window_actor =
META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
@ -716,7 +749,8 @@ meta_compositor_window_opacity_changed (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor;
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
window_actor =
META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
@ -728,7 +762,8 @@ meta_compositor_window_surface_changed (MetaCompositor *compositor,
MetaWindow *window)
{
MetaWindowActor *window_actor;
window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
window_actor =
META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
if (!window_actor)
return;
@ -750,9 +785,11 @@ meta_compositor_process_event (MetaCompositor *compositor,
MetaX11Display *x11_display = compositor->display->x11_display;
if (!meta_is_wayland_compositor () &&
event->type == meta_x11_display_get_damage_event_base (x11_display) + XDamageNotify)
event->type ==
meta_x11_display_get_damage_event_base (x11_display) + XDamageNotify)
{
/* Core code doesn't handle damage events, so we need to extract the MetaWindow
/* Core code doesn't handle damage events, so we need to extract the
* MetaWindow
* ourselves
*/
if (window == NULL)
@ -769,13 +806,14 @@ meta_compositor_process_event (MetaCompositor *compositor,
meta_sync_ring_handle_event (event);
/* Clutter needs to know about MapNotify events otherwise it will
think the stage is invisible */
* think the stage is invisible */
if (!meta_is_wayland_compositor () && event->type == MapNotify)
clutter_x11_handle_event (event);
/* The above handling is basically just "observing" the events, so we return
* FALSE to indicate that the event should not be filtered out; if we have
* GTK+ windows in the same process, GTK+ needs the ConfigureNotify event, for example.
* GTK+ windows in the same process, GTK+ needs the ConfigureNotify event, for
*example.
*/
return FALSE;
}
@ -784,7 +822,8 @@ gboolean
meta_compositor_filter_keybinding (MetaCompositor *compositor,
MetaKeyBinding *binding)
{
return meta_plugin_manager_filter_keybinding (compositor->plugin_mgr, binding);
return meta_plugin_manager_filter_keybinding (compositor->plugin_mgr,
binding);
}
void
@ -792,7 +831,8 @@ meta_compositor_show_window (MetaCompositor *compositor,
MetaWindow *window,
MetaCompEffect effect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
window));
meta_window_actor_show (window_actor, effect);
}
@ -801,7 +841,8 @@ meta_compositor_hide_window (MetaCompositor *compositor,
MetaWindow *window,
MetaCompEffect effect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
window));
meta_window_actor_hide (window_actor, effect);
meta_stack_tracker_queue_sync_stack (compositor->display->stack_tracker);
}
@ -813,8 +854,10 @@ meta_compositor_size_change_window (MetaCompositor *compositor,
MetaRectangle *old_frame_rect,
MetaRectangle *old_buffer_rect)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
meta_window_actor_size_change (window_actor, which_change, old_frame_rect, old_buffer_rect);
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
window));
meta_window_actor_size_change (window_actor, which_change, old_frame_rect,
old_buffer_rect);
}
void
@ -892,7 +935,8 @@ sync_actor_stacking (MetaCompositor *compositor)
{
has_windows = TRUE;
if (expected_window_node != NULL && actor == expected_window_node->data)
if (expected_window_node != NULL &&
actor == expected_window_node->data)
expected_window_node = expected_window_node->next;
else
reordered = TRUE;
@ -989,7 +1033,8 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
/* Sources: first window is the highest */
stack = g_list_copy (stack); /* The new stack of MetaWindow */
old_stack = g_list_reverse (compositor->windows); /* The old stack of MetaWindowActor */
old_stack = g_list_reverse (compositor->windows); /* The old stack of
* MetaWindowActor */
compositor->windows = NULL;
while (TRUE)
@ -1018,11 +1063,13 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
while (stack)
{
stack_window = stack->data;
stack_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (stack_window));
stack_actor =
META_WINDOW_ACTOR (meta_window_get_compositor_private (stack_window));
if (!stack_actor)
{
meta_verbose ("Failed to find corresponding MetaWindowActor "
"for window %s\n", meta_window_get_description (stack_window));
"for window %s\n",
meta_window_get_description (stack_window));
stack = g_list_delete_link (stack, stack);
}
else
@ -1080,7 +1127,8 @@ meta_compositor_sync_window_geometry (MetaCompositor *compositor,
MetaWindow *window,
gboolean did_placement)
{
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
window));
meta_window_actor_sync_actor_geometry (window_actor, did_placement);
meta_plugin_manager_event_size_changed (compositor->plugin_mgr, window_actor);
}
@ -1104,7 +1152,8 @@ on_presented (ClutterStage *stage,
* guaranteed to be in nanoseconds but with no specified base. The
* normal case with the open source GPU drivers on Linux 3.8 and
* newer is that the base of cogl_get_clock_time() is that of
* clock_gettime(CLOCK_MONOTONIC), so the same as g_get_monotonic_time),
* clock_gettime(CLOCK_MONOTONIC), so the same as
*g_get_monotonic_time),
* but there's no exposure of that through the API. clock_gettime()
* is fairly fast, so calling it twice and subtracting to get a
* nearly-zero number is acceptable, if a litle ugly.
@ -1113,7 +1162,8 @@ on_presented (ClutterStage *stage,
gint64 current_monotonic_time = g_get_monotonic_time ();
presentation_time =
current_monotonic_time + (presentation_time_cogl - current_cogl_time) / 1000;
current_monotonic_time +
(presentation_time_cogl - current_cogl_time) / 1000;
}
else
{
@ -1121,7 +1171,8 @@ on_presented (ClutterStage *stage,
}
for (l = compositor->windows; l; l = l->next)
meta_window_actor_frame_complete (l->data, frame_info, presentation_time);
meta_window_actor_frame_complete (l->data, frame_info,
presentation_time);
}
}
@ -1213,11 +1264,11 @@ meta_post_paint_func (gpointer data)
default:
/* The ARB_robustness spec says that, on error, the application
should destroy the old context and create a new one. Since we
don't have the necessary plumbing to do this we'll simply
restart the process. Obviously we can't do this when we are
a wayland compositor but in that case we shouldn't get here
since we don't enable robustness in that case. */
* should destroy the old context and create a new one. Since we
* don't have the necessary plumbing to do this we'll simply
* restart the process. Obviously we can't do this when we are
* a wayland compositor but in that case we shouldn't get here
* since we don't enable robustness in that case. */
g_assert (!meta_is_wayland_compositor ());
meta_restart (NULL);
break;
@ -1309,7 +1360,8 @@ meta_enable_unredirect_for_display (MetaDisplay *display)
{
MetaCompositor *compositor = get_compositor_for_display (display);
if (compositor->disable_unredirect_count == 0)
g_warning ("Called enable_unredirect_for_display while unredirection is enabled.");
g_warning (
"Called enable_unredirect_for_display while unredirection is enabled.");
if (compositor->disable_unredirect_count > 0)
compositor->disable_unredirect_count--;
}
@ -1422,7 +1474,10 @@ meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
if (compositor->server_time_query_time == 0 ||
(!compositor->server_time_is_monotonic_time &&
monotonic_time > compositor->server_time_query_time + 10*1000*1000)) /* 10 seconds */
monotonic_time > compositor->server_time_query_time + 10 * 1000 * 1000)) /*
* 10
* seconds
* */
{
guint32 server_time = meta_display_get_current_time_roundtrip (display);
gint64 server_time_usec = (gint64) server_time * 1000;
@ -1439,7 +1494,8 @@ meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
server_time_usec < current_monotonic_time + 1000 * 1000)
compositor->server_time_is_monotonic_time = TRUE;
compositor->server_time_offset = server_time_usec - current_monotonic_time;
compositor->server_time_offset = server_time_usec -
current_monotonic_time;
}
if (compositor->server_time_is_monotonic_time)
@ -1455,7 +1511,8 @@ meta_compositor_show_tile_preview (MetaCompositor *compositor,
int tile_monitor_number)
{
meta_plugin_manager_show_tile_preview (compositor->plugin_mgr,
window, tile_rect, tile_monitor_number);
window, tile_rect,
tile_monitor_number);
}
void
@ -1471,7 +1528,8 @@ meta_compositor_show_window_menu (MetaCompositor *compositor,
int x,
int y)
{
meta_plugin_manager_show_window_menu (compositor->plugin_mgr, window, menu, x, y);
meta_plugin_manager_show_window_menu (compositor->plugin_mgr, window, menu, x,
y);
}
void
@ -1480,7 +1538,8 @@ meta_compositor_show_window_menu_for_rect (MetaCompositor *compositor,
MetaWindowMenuType menu,
MetaRectangle *rect)
{
meta_plugin_manager_show_window_menu_for_rect (compositor->plugin_mgr, window, menu, rect);
meta_plugin_manager_show_window_menu_for_rect (compositor->plugin_mgr, window,
menu, rect);
}
MetaCloseDialog *
@ -1495,6 +1554,7 @@ MetaInhibitShortcutsDialog *
meta_compositor_create_inhibit_shortcuts_dialog (MetaCompositor *compositor,
MetaWindow *window)
{
return meta_plugin_manager_create_inhibit_shortcuts_dialog (compositor->plugin_mgr,
return meta_plugin_manager_create_inhibit_shortcuts_dialog (
compositor->plugin_mgr,
window);
}

View File

@ -97,7 +97,8 @@ enum
PROP_VIGNETTE_BRIGHTNESS
};
typedef enum {
typedef enum
{
CHANGED_BACKGROUND = 1 << 0,
CHANGED_EFFECTS = 1 << 2,
CHANGED_VIGNETTE_PARAMETERS = 1 << 3,
@ -143,7 +144,8 @@ typedef enum {
typedef struct _MetaBackgroundLayer MetaBackgroundLayer;
typedef enum {
typedef enum
{
PIPELINE_VIGNETTE = (1 << 0),
PIPELINE_BLEND = (1 << 1),
PIPELINE_GRADIENT = (1 << 2),
@ -175,9 +177,11 @@ struct _MetaBackgroundActorPrivate
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor, CLUTTER_TYPE_ACTOR,
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundActor, meta_background_actor,
CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaBackgroundActor)
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
cullable_iface_init));
static void
set_clip_region (MetaBackgroundActor *self,
@ -280,14 +284,16 @@ make_pipeline (PipelineFlags pipeline_flags)
static CoglSnippet *vignette_fragment_snippet;
if (!vignette_vertex_snippet)
vignette_vertex_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
vignette_vertex_snippet = cogl_snippet_new (
COGL_SNIPPET_HOOK_VERTEX,
VIGNETTE_VERTEX_SHADER_DECLARATIONS,
VIGNETTE_VERTEX_SHADER_CODE);
cogl_pipeline_add_snippet (*templatep, vignette_vertex_snippet);
if (!vignette_fragment_snippet)
vignette_fragment_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
vignette_fragment_snippet = cogl_snippet_new (
COGL_SNIPPET_HOOK_FRAGMENT,
VIGNETTE_FRAGMENT_SHADER_DECLARATIONS,
VIGNETTE_FRAGMENT_SHADER_CODE);
@ -300,14 +306,16 @@ make_pipeline (PipelineFlags pipeline_flags)
static CoglSnippet *gradient_fragment_snippet;
if (!gradient_vertex_snippet)
gradient_vertex_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_VERTEX,
gradient_vertex_snippet = cogl_snippet_new (
COGL_SNIPPET_HOOK_VERTEX,
GRADIENT_VERTEX_SHADER_DECLARATIONS,
GRADIENT_VERTEX_SHADER_CODE);
cogl_pipeline_add_snippet (*templatep, gradient_vertex_snippet);
if (!gradient_fragment_snippet)
gradient_fragment_snippet = cogl_snippet_new (COGL_SNIPPET_HOOK_FRAGMENT,
gradient_fragment_snippet = cogl_snippet_new (
COGL_SNIPPET_HOOK_FRAGMENT,
GRADIENT_FRAGMENT_SHADER_DECLARATIONS,
GRADIENT_FRAGMENT_SHADER_CODE);
@ -334,9 +342,11 @@ setup_pipeline (MetaBackgroundActor *self,
opacity = clutter_actor_get_paint_opacity (CLUTTER_ACTOR (self));
if (opacity < 255)
pipeline_flags |= PIPELINE_BLEND;
if (priv->vignette && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
if (priv->vignette &&
clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
pipeline_flags |= PIPELINE_VIGNETTE;
if (priv->gradient && clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
if (priv->gradient &&
clutter_feature_available (CLUTTER_FEATURE_SHADERS_GLSL))
pipeline_flags |= PIPELINE_GRADIENT;
if (priv->pipeline &&
@ -361,8 +371,10 @@ setup_pipeline (MetaBackgroundActor *self,
&priv->texture_area,
&wrap_mode);
priv->force_bilinear = texture &&
(priv->texture_area.width != (int)cogl_texture_get_width (texture) ||
priv->texture_area.height != (int)cogl_texture_get_height (texture));
(priv->texture_area.width !=
(int) cogl_texture_get_width (texture) ||
priv->texture_area.height !=
(int) cogl_texture_get_height (texture));
cogl_pipeline_set_layer_texture (priv->pipeline, 0, texture);
cogl_pipeline_set_layer_wrap_mode (priv->pipeline, 0, wrap_mode);
@ -373,7 +385,8 @@ setup_pipeline (MetaBackgroundActor *self,
if ((priv->changed & CHANGED_VIGNETTE_PARAMETERS) != 0)
{
cogl_pipeline_set_uniform_1f (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->
pipeline,
"vignette_sharpness"),
priv->vignette_sharpness);
@ -387,13 +400,17 @@ setup_pipeline (MetaBackgroundActor *self,
meta_display_get_monitor_geometry (priv->display,
priv->monitor, &monitor_geometry);
gradient_height_perc = MAX (0.0001, priv->gradient_height / (float)monitor_geometry.height);
gradient_height_perc = MAX (0.0001,
priv->gradient_height /
(float) monitor_geometry.height);
cogl_pipeline_set_uniform_1f (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->
pipeline,
"gradient_height_perc"),
gradient_height_perc);
cogl_pipeline_set_uniform_1f (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->
pipeline,
"gradient_max_darkness"),
priv->gradient_max_darkness);
@ -423,7 +440,8 @@ setup_pipeline (MetaBackgroundActor *self,
opacity / 255.);
if (!priv->force_bilinear &&
meta_actor_painting_untransformed (actor_pixel_rect->width, actor_pixel_rect->height, NULL, NULL))
meta_actor_painting_untransformed (actor_pixel_rect->width,
actor_pixel_rect->height, NULL, NULL))
filter = COGL_PIPELINE_FILTER_NEAREST;
else
filter = COGL_PIPELINE_FILTER_LINEAR;
@ -448,12 +466,14 @@ set_glsl_parameters (MetaBackgroundActor *self,
offset[1] = priv->texture_area.y / (float) actor_pixel_rect->height - 0.5;
cogl_pipeline_set_uniform_float (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->
pipeline,
"scale"),
2, 1, scale);
cogl_pipeline_set_uniform_float (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->pipeline,
cogl_pipeline_get_uniform_location (priv->
pipeline,
"offset"),
2, 1, offset);
}
@ -532,14 +552,16 @@ meta_background_actor_paint (ClutterActor *actor)
if (!gdk_rectangle_intersect (&actor_pixel_rect, &rect, &rect))
continue;
paint_clipped_rectangle (fb, priv->pipeline, &rect, &priv->texture_area);
paint_clipped_rectangle (fb, priv->pipeline, &rect,
&priv->texture_area);
}
return;
}
}
paint_clipped_rectangle (fb, priv->pipeline, &actor_pixel_rect, &priv->texture_area);
paint_clipped_rectangle (fb, priv->pipeline, &actor_pixel_rect,
&priv->texture_area);
}
static void
@ -659,7 +681,8 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
object_class->get_property = meta_background_actor_get_property;
actor_class->get_preferred_width = meta_background_actor_get_preferred_width;
actor_class->get_preferred_height = meta_background_actor_get_preferred_height;
actor_class->get_preferred_height =
meta_background_actor_get_preferred_height;
actor_class->get_paint_volume = meta_background_actor_get_paint_volume;
actor_class->paint = meta_background_actor_paint;
@ -907,7 +930,8 @@ meta_background_actor_set_gradient (MetaBackgroundActor *self,
changed = TRUE;
}
if (height != priv->gradient_height || max_darkness != priv->gradient_max_darkness)
if (height != priv->gradient_height ||
max_darkness != priv->gradient_max_darkness)
{
priv->gradient_height = height;
priv->gradient_max_darkness = max_darkness;
@ -931,7 +955,8 @@ meta_background_actor_set_monitor (MetaBackgroundActor *self,
if(priv->monitor == monitor)
return;
meta_display_get_monitor_geometry (display, priv->monitor, &old_monitor_geometry);
meta_display_get_monitor_geometry (display, priv->monitor,
&old_monitor_geometry);
meta_display_get_monitor_geometry (display, monitor, &new_monitor_geometry);
if(old_monitor_geometry.height != new_monitor_geometry.height)
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
@ -963,7 +988,8 @@ meta_background_actor_set_vignette (MetaBackgroundActor *self,
changed = TRUE;
}
if (brightness != priv->vignette_brightness || sharpness != priv->vignette_sharpness)
if (brightness != priv->vignette_brightness ||
sharpness != priv->vignette_sharpness)
{
priv->vignette_brightness = brightness;
priv->vignette_sharpness = sharpness;

View File

@ -21,8 +21,10 @@
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR,
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group,
CLUTTER_TYPE_ACTOR,
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
cullable_iface_init));
static void
meta_background_group_class_init (MetaBackgroundGroupClass *klass)

View File

@ -19,7 +19,8 @@
/**
* SECTION:meta-background-image
* @title: MetaBackgroundImage
* @short_description: objects holding images loaded from files, used for backgrounds
* @short_description: objects holding images loaded from files, used for
*backgrounds
*/
#include "config.h"
@ -67,7 +68,8 @@ struct _MetaBackgroundImageClass
GObjectClass parent_class;
};
G_DEFINE_TYPE (MetaBackgroundImageCache, meta_background_image_cache, G_TYPE_OBJECT);
G_DEFINE_TYPE (MetaBackgroundImageCache, meta_background_image_cache,
G_TYPE_OBJECT);
static void
meta_background_image_cache_init (MetaBackgroundImageCache *cache)
@ -193,7 +195,8 @@ file_loaded (GObject *source_object,
META_TEXTURE_ALLOW_SLICING);
if (!cogl_texture_set_data (texture,
has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 : COGL_PIXEL_FORMAT_RGB_888,
has_alpha ? COGL_PIXEL_FORMAT_RGBA_8888 :
COGL_PIXEL_FORMAT_RGB_888,
row_stride,
pixels, 0,
&catch_error))
@ -226,7 +229,8 @@ out:
* signal will be emitted exactly once. The 'loaded' state means that the
* loading process finished, whether it succeeded or failed.
*
* Return value: (transfer full): a #MetaBackgroundImage to dereference to get the loaded texture
* Return value: (transfer full): a #MetaBackgroundImage to dereference to get
*the loaded texture
*/
MetaBackgroundImage *
meta_background_image_cache_load (MetaBackgroundImageCache *cache,

View File

@ -211,8 +211,12 @@ static gboolean
need_prerender (MetaBackground *self)
{
MetaBackgroundPrivate *priv = self->priv;
CoglTexture *texture1 = priv->background_image1 ? meta_background_image_get_texture (priv->background_image1) : NULL;
CoglTexture *texture2 = priv->background_image2 ? meta_background_image_get_texture (priv->background_image2) : NULL;
CoglTexture *texture1 =
priv->background_image1 ? meta_background_image_get_texture (
priv->background_image1) : NULL;
CoglTexture *texture2 =
priv->background_image2 ? meta_background_image_get_texture (
priv->background_image2) : NULL;
if (texture1 == NULL && texture2 == NULL)
return FALSE;
@ -279,7 +283,8 @@ set_file (MetaBackground *self,
if (file)
{
MetaBackgroundImageCache *cache = meta_background_image_cache_get_default ();
MetaBackgroundImageCache *cache =
meta_background_image_cache_get_default ();
*filep = g_object_ref (file);
*imagep = meta_background_image_cache_load (cache, file);
@ -324,7 +329,8 @@ meta_background_constructed (GObject *object)
G_OBJECT_CLASS (meta_background_parent_class)->constructed (object);
g_signal_connect_object (priv->display, "gl-video-memory-purged",
G_CALLBACK (mark_changed), object, G_CONNECT_SWAPPED);
G_CALLBACK (mark_changed), object,
G_CONNECT_SWAPPED);
g_signal_connect_object (monitor_manager, "monitors-changed",
G_CALLBACK (on_monitors_changed), self,
@ -360,7 +366,6 @@ meta_background_class_init (MetaBackgroundClass *klass)
g_object_class_install_property (object_class,
PROP_META_DISPLAY,
param_spec);
}
static void
@ -520,8 +525,11 @@ draw_texture (MetaBackground *self,
monitor_area->height,
-texture_area.x / (float) texture_area.width,
-texture_area.y / (float) texture_area.height,
(monitor_area->width - texture_area.x) / (float)texture_area.width,
(monitor_area->height - texture_area.y) / (float)texture_area.height);
(monitor_area->width -
texture_area.x) / (float) texture_area.width,
(monitor_area->height -
texture_area.y) /
(float) texture_area.height);
bare_region_visible = texture_has_alpha (texture);
@ -535,7 +543,8 @@ draw_texture (MetaBackground *self,
texture_area.x + texture_area.width,
texture_area.y + texture_area.height,
0, 0, 1.0, 1.0);
bare_region_visible = texture_has_alpha (texture) || memcmp (&texture_area, monitor_area, sizeof (cairo_rectangle_int_t)) != 0;
bare_region_visible = texture_has_alpha (texture) || memcmp (
&texture_area, monitor_area, sizeof (cairo_rectangle_int_t)) != 0;
break;
case G_DESKTOP_BACKGROUND_STYLE_NONE:
bare_region_visible = TRUE;
@ -593,21 +602,25 @@ ensure_color_texture (MetaBackground *self)
pixels[5] = priv->second_color.blue;
}
priv->color_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
priv->color_texture =
COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
COGL_PIXEL_FORMAT_RGB_888,
width * 3,
width *
3,
pixels,
&error));
if (error != NULL)
{
meta_warning ("Failed to allocate color texture: %s\n", error->message);
meta_warning ("Failed to allocate color texture: %s\n",
error->message);
cogl_error_free (error);
}
}
}
typedef enum {
typedef enum
{
PIPELINE_REPLACE,
PIPELINE_ADD,
PIPELINE_OVER_REVERSE,
@ -616,10 +629,12 @@ typedef enum {
static CoglPipeline *
create_pipeline (PipelineType type)
{
const char * const blend_strings[3] = {
const char * const blend_strings[3] =
{
[PIPELINE_REPLACE] = "RGBA = ADD (SRC_COLOR, 0)",
[PIPELINE_ADD] = "RGBA = ADD (SRC_COLOR, DST_COLOR)",
[PIPELINE_OVER_REVERSE] = "RGBA = ADD (SRC_COLOR * (1 - DST_COLOR[A]), DST_COLOR)",
[PIPELINE_OVER_REVERSE] =
"RGBA = ADD (SRC_COLOR * (1 - DST_COLOR[A]), DST_COLOR)",
};
static CoglPipeline *templates[3];
@ -675,7 +690,8 @@ ensure_wallpaper_texture (MetaBackground *self,
if (!cogl_framebuffer_allocate (fbo, &catch_error))
{
/* This probably means that the size of the wallpapered texture is larger
/* This probably means that the size of the wallpapered texture is
* larger
* than the maximum texture size; we treat it as permanent until the
* background is changed again.
*/
@ -694,7 +710,8 @@ ensure_wallpaper_texture (MetaBackground *self,
pipeline = create_pipeline (PIPELINE_REPLACE);
cogl_pipeline_set_layer_texture (pipeline, 0, texture);
cogl_framebuffer_draw_textured_rectangle (fbo, pipeline, 0, 0, width, height,
cogl_framebuffer_draw_textured_rectangle (fbo, pipeline, 0, 0, width,
height,
0., 0., 1., 1.);
cogl_object_unref (pipeline);
@ -746,7 +763,8 @@ meta_background_get_texture (MetaBackground *self,
g_return_val_if_fail (META_IS_BACKGROUND (self), NULL);
priv = self->priv;
g_return_val_if_fail (monitor_index >= 0 && monitor_index < priv->n_monitors, NULL);
g_return_val_if_fail (monitor_index >= 0 && monitor_index < priv->n_monitors,
NULL);
monitor = &priv->monitors[monitor_index];
@ -756,8 +774,10 @@ meta_background_get_texture (MetaBackground *self,
monitor_area.width = geometry.width;
monitor_area.height = geometry.height;
texture1 = priv->background_image1 ? meta_background_image_get_texture (priv->background_image1) : NULL;
texture2 = priv->background_image2 ? meta_background_image_get_texture (priv->background_image2) : NULL;
texture1 = priv->background_image1 ? meta_background_image_get_texture (
priv->background_image1) : NULL;
texture2 = priv->background_image2 ? meta_background_image_get_texture (
priv->background_image2) : NULL;
if (texture1 == NULL && texture2 == NULL)
{
@ -790,7 +810,8 @@ meta_background_get_texture (MetaBackground *self,
{
CoglOffscreen *offscreen;
monitor->texture = meta_create_texture (monitor_area.width, monitor_area.height,
monitor->texture = meta_create_texture (monitor_area.width,
monitor_area.height,
COGL_TEXTURE_COMPONENTS_RGBA,
META_TEXTURE_FLAGS_NONE);
offscreen = cogl_offscreen_new_with_texture (monitor->texture);
@ -799,7 +820,8 @@ meta_background_get_texture (MetaBackground *self,
if (!cogl_framebuffer_allocate (monitor->fbo, &catch_error))
{
/* Texture or framebuffer allocation failed; it's unclear why this happened;
/* Texture or framebuffer allocation failed; it's unclear why this
* happened;
* we'll try again the next time this is called. (MetaBackgroundActor
* caches the result, so user might be left without a background.)
*/
@ -813,15 +835,18 @@ meta_background_get_texture (MetaBackground *self,
}
cogl_framebuffer_orthographic (monitor->fbo, 0, 0,
monitor_area.width, monitor_area.height, -1., 1.);
monitor_area.width, monitor_area.height,
-1., 1.);
if (texture2 != NULL && priv->blend_factor != 0.0)
{
CoglPipeline *pipeline = create_pipeline (PIPELINE_REPLACE);
cogl_pipeline_set_color4f (pipeline,
priv->blend_factor, priv->blend_factor, priv->blend_factor, priv->blend_factor);
priv->blend_factor, priv->blend_factor,
priv->blend_factor, priv->blend_factor);
cogl_pipeline_set_layer_texture (pipeline, 0, texture2);
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (priv->style));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
get_wrap_mode (priv->style));
bare_region_visible = draw_texture (self,
monitor->fbo, pipeline,
@ -843,13 +868,15 @@ meta_background_get_texture (MetaBackground *self,
(1 - priv->blend_factor),
(1 - priv->blend_factor),
(1 - priv->blend_factor),
(1 - priv->blend_factor));;
(1 - priv->blend_factor));
cogl_pipeline_set_layer_texture (pipeline, 0, texture1);
cogl_pipeline_set_layer_wrap_mode (pipeline, 0, get_wrap_mode (priv->style));
cogl_pipeline_set_layer_wrap_mode (pipeline, 0,
get_wrap_mode (priv->style));
bare_region_visible = bare_region_visible || draw_texture (self,
monitor->fbo, pipeline,
texture1, &monitor_area);
texture1,
&monitor_area);
cogl_object_unref (pipeline);
}
@ -863,7 +890,8 @@ meta_background_get_texture (MetaBackground *self,
cogl_framebuffer_draw_rectangle (monitor->fbo,
pipeline,
0, 0,
monitor_area.width, monitor_area.height);
monitor_area.width,
monitor_area.height);
cogl_object_unref (pipeline);
}

View File

@ -111,7 +111,8 @@ meta_cullable_cull_out_children (MetaCullable *cullable,
cairo_region_translate (unobscured_region, -x, -y);
cairo_region_translate (clip_region, -x, -y);
meta_cullable_cull_out (META_CULLABLE (child), unobscured_region, clip_region);
meta_cullable_cull_out (META_CULLABLE (
child), unobscured_region, clip_region);
cairo_region_translate (unobscured_region, x, y);
cairo_region_translate (clip_region, x, y);
@ -183,7 +184,8 @@ meta_cullable_cull_out (MetaCullable *cullable,
cairo_region_t *unobscured_region,
cairo_region_t *clip_region)
{
META_CULLABLE_GET_IFACE (cullable)->cull_out (cullable, unobscured_region, clip_region);
META_CULLABLE_GET_IFACE (cullable)->cull_out (cullable, unobscured_region,
clip_region);
}
/**

View File

@ -33,7 +33,8 @@
#define DRAG_FAILED_DURATION 500
enum {
enum
{
PROP_DRAG_ORIGIN = 1,
PROP_DRAG_START_X,
PROP_DRAG_START_Y
@ -48,7 +49,8 @@ struct _MetaDnDActorPrivate
int drag_start_y;
};
G_DEFINE_TYPE_WITH_PRIVATE (MetaDnDActor, meta_dnd_actor, META_TYPE_FEEDBACK_ACTOR)
G_DEFINE_TYPE_WITH_PRIVATE (MetaDnDActor, meta_dnd_actor,
META_TYPE_FEEDBACK_ACTOR)
static void
meta_dnd_actor_set_property (GObject *object,

View File

@ -49,7 +49,8 @@ struct _MetaDndPrivate
MetaCompositor *compositor;
MetaWaylandCompositor *wl_compositor;
#else
/* to avoid warnings (g_type_class_add_private: assertion `private_size > 0' failed) */
/* to avoid warnings (g_type_class_add_private: assertion `private_size > 0'
* failed) */
gchar dummy;
#endif
};
@ -150,7 +151,8 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
return FALSE;
if (xev->xany.window != output_window &&
xev->xany.window != clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage)))
xev->xany.window !=
clutter_x11_get_stage_window (CLUTTER_STAGE (compositor->stage)))
return FALSE;
if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndPosition", TRUE))
@ -165,7 +167,8 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
xevent.xclient.message_type = XInternAtom (xdisplay, "XdndStatus", TRUE);
xevent.xclient.format = 32;
xevent.xclient.data.l[0] = output_window;
/* flags: bit 0: will we accept the drop? bit 1: do we want more position messages */
/* flags: bit 0: will we accept the drop? bit 1: do we want more position
* messages */
xevent.xclient.data.l[1] = 2;
xevent.xclient.data.l[4] = None;
@ -173,17 +176,20 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
meta_dnd_notify_dnd_position_change (dnd,
(int) (xev->xclient.data.l[2] >> 16),
(int)(xev->xclient.data.l[2] & 0xFFFF));
(int) (xev->xclient.data.l[2] &
0xFFFF));
return TRUE;
}
else if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndLeave", TRUE))
else if (xev->xclient.message_type ==
XInternAtom (xdisplay, "XdndLeave", TRUE))
{
meta_dnd_notify_dnd_leave (dnd);
return TRUE;
}
else if (xev->xclient.message_type == XInternAtom (xdisplay, "XdndEnter", TRUE))
else if (xev->xclient.message_type ==
XInternAtom (xdisplay, "XdndEnter", TRUE))
{
meta_dnd_notify_dnd_enter (dnd);
@ -208,7 +214,8 @@ meta_dnd_wayland_on_motion_event (ClutterActor *actor,
clutter_event_get_coords (event, &event_x, &event_y);
meta_dnd_notify_dnd_position_change (dnd, (int) event_x, (int) event_y);
current_grab = meta_wayland_data_device_get_current_grab (&priv->wl_compositor->seat->data_device);
current_grab = meta_wayland_data_device_get_current_grab (
&priv->wl_compositor->seat->data_device);
if (current_grab)
meta_wayland_drag_grab_update_feedback_actor (current_grab, event);
}
@ -253,24 +260,28 @@ meta_dnd_wayland_handle_begin_modal (MetaCompositor *compositor)
MetaDndPrivate *priv = meta_dnd_get_instance_private (dnd);
if (priv->handler_id[0] == 0 &&
meta_wayland_data_device_get_current_grab (&wl_compositor->seat->data_device) != NULL)
meta_wayland_data_device_get_current_grab (&wl_compositor->seat->
data_device) != NULL)
{
priv->compositor = compositor;
priv->wl_compositor = wl_compositor;
priv->handler_id[0] = g_signal_connect (compositor->stage,
"motion-event",
G_CALLBACK (meta_dnd_wayland_on_motion_event),
G_CALLBACK (
meta_dnd_wayland_on_motion_event),
dnd);
priv->handler_id[1] = g_signal_connect (compositor->stage,
"button-release-event",
G_CALLBACK (meta_dnd_wayland_on_button_released),
G_CALLBACK (
meta_dnd_wayland_on_button_released),
dnd);
priv->handler_id[2] = g_signal_connect (compositor->stage,
"key-press-event",
G_CALLBACK (meta_dnd_wayland_on_key_pressed),
G_CALLBACK (
meta_dnd_wayland_on_key_pressed),
dnd);
meta_dnd_notify_dnd_enter (dnd);
@ -289,7 +300,8 @@ meta_dnd_wayland_handle_end_modal (MetaCompositor *compositor)
for (i = 0; i < G_N_ELEMENTS (priv->handler_id); i++)
{
g_signal_handler_disconnect (priv->compositor->stage, priv->handler_id[i]);
g_signal_handler_disconnect (priv->compositor->stage,
priv->handler_id[i]);
priv->handler_id[i] = 0;
}

View File

@ -30,7 +30,8 @@
#include "compositor/meta-feedback-actor-private.h"
#include "core/display-private.h"
enum {
enum
{
PROP_ANCHOR_X = 1,
PROP_ANCHOR_Y
};
@ -45,7 +46,8 @@ struct _MetaFeedbackActorPrivate
int pos_y;
};
G_DEFINE_TYPE_WITH_PRIVATE (MetaFeedbackActor, meta_feedback_actor, CLUTTER_TYPE_ACTOR)
G_DEFINE_TYPE_WITH_PRIVATE (MetaFeedbackActor, meta_feedback_actor,
CLUTTER_TYPE_ACTOR)
static void
meta_feedback_actor_constructed (GObject *object)
@ -60,7 +62,8 @@ meta_feedback_actor_constructed (GObject *object)
static void
meta_feedback_actor_update_position (MetaFeedbackActor *self)
{
MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (self);
MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (
self);
clutter_actor_set_position (CLUTTER_ACTOR (self),
priv->pos_x - priv->anchor_x,
@ -74,7 +77,8 @@ meta_feedback_actor_set_property (GObject *object,
GParamSpec *pspec)
{
MetaFeedbackActor *self = META_FEEDBACK_ACTOR (object);
MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (self);
MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (
self);
switch (prop_id)
{
@ -99,7 +103,8 @@ meta_feedback_actor_get_property (GObject *object,
GParamSpec *pspec)
{
MetaFeedbackActor *self = META_FEEDBACK_ACTOR (object);
MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (self);
MetaFeedbackActorPrivate *priv = meta_feedback_actor_get_instance_private (
self);
switch (prop_id)
{

View File

@ -202,4 +202,3 @@ meta_module_get_plugin_type (MetaModule *module)
return priv->plugin_type;
}

View File

@ -234,7 +234,8 @@ meta_plugin_manager_event_size_change (MetaPluginManager *plugin_mgr,
return FALSE;
meta_plugin_manager_kill_window_effects (plugin_mgr, actor);
klass->size_change (plugin, actor, which_change, old_frame_rect, old_buffer_rect);
klass->size_change (plugin, actor, which_change, old_frame_rect,
old_buffer_rect);
return TRUE;
}
@ -394,7 +395,8 @@ meta_plugin_manager_create_close_dialog (MetaPluginManager *plugin_mgr,
}
MetaInhibitShortcutsDialog *
meta_plugin_manager_create_inhibit_shortcuts_dialog (MetaPluginManager *plugin_mgr,
meta_plugin_manager_create_inhibit_shortcuts_dialog (
MetaPluginManager *plugin_mgr,
MetaWindow *window)
{
MetaPlugin *plugin = plugin_mgr->plugin;

View File

@ -150,7 +150,8 @@ meta_plugin_destroy_completed (MetaPlugin *plugin,
* passive X grabs in Meta can trigger but not be handled by the normal
* keybinding handling code.) However, the plugin can establish the keyboard
* and/or mouse grabs ahead of time and pass in the
* %META_MODAL_POINTER_ALREADY_GRABBED and/or %META_MODAL_KEYBOARD_ALREADY_GRABBED
* %META_MODAL_POINTER_ALREADY_GRABBED and/or
*%META_MODAL_KEYBOARD_ALREADY_GRABBED
* options. This facility is provided for two reasons: first to allow using
* this function to establish modality after a passive grab, and second to
* allow using obscure features of XGrabPointer() and XGrabKeyboard() without

View File

@ -19,7 +19,8 @@
/**
* SECTION:meta-shadow-factory
* @title: MetaShadowFactory
* @short_description: Create and cache shadow textures for abritrary window shapes
* @short_description: Create and cache shadow textures for abritrary window
*shapes
*/
#include "config.h"
@ -122,7 +123,8 @@ static guint signals[LAST_SIGNAL] = { 0 };
/* The first element in this array also defines the default parameters
* for newly created classes */
MetaShadowClassInfo default_shadow_classes[] = {
MetaShadowClassInfo default_shadow_classes[] =
{
{ "normal", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
{ "dialog", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
{ "modal_dialog", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
@ -143,7 +145,8 @@ meta_shadow_cache_key_hash (gconstpointer val)
{
const MetaShadowCacheKey *key = val;
return 59 * key->radius + 67 * key->top_fade + 73 * meta_window_shape_hash (key->shape);
return 59 * key->radius + 67 * key->top_fade + 73 * meta_window_shape_hash (
key->shape);
}
static gboolean
@ -153,7 +156,8 @@ meta_shadow_cache_key_equal (gconstpointer a,
const MetaShadowCacheKey *key_a = a;
const MetaShadowCacheKey *key_b = b;
return (key_a->radius == key_b->radius && key_a->top_fade == key_b->top_fade &&
return (key_a->radius == key_b->radius &&
key_a->top_fade == key_b->top_fade &&
meta_window_shape_equal (key_a->shape, key_b->shape));
}
@ -231,8 +235,12 @@ meta_shadow_paint (MetaShadow *shadow,
n_x = 3;
src_x[0] = 0.0;
src_x[1] = (shadow->inner_border_left + shadow->outer_border_left) / texture_width;
src_x[2] = (texture_width - (shadow->inner_border_right + shadow->outer_border_right)) / texture_width;
src_x[1] = (shadow->inner_border_left + shadow->outer_border_left) /
texture_width;
src_x[2] =
(texture_width -
(shadow->inner_border_right + shadow->outer_border_right)) /
texture_width;
src_x[3] = 1.0;
dest_x[0] = window_x - shadow->outer_border_left;
@ -256,8 +264,12 @@ meta_shadow_paint (MetaShadow *shadow,
n_y = 3;
src_y[0] = 0.0;
src_y[1] = (shadow->inner_border_top + shadow->outer_border_top) / texture_height;
src_y[2] = (texture_height - (shadow->inner_border_bottom + shadow->outer_border_bottom)) / texture_height;
src_y[1] = (shadow->inner_border_top + shadow->outer_border_top) /
texture_height;
src_y[2] =
(texture_height -
(shadow->inner_border_bottom + shadow->outer_border_bottom)) /
texture_height;
src_y[3] = 1.0;
dest_y[0] = window_y - shadow->outer_border_top;
@ -330,22 +342,35 @@ meta_shadow_paint (MetaShadow *shadow,
cairo_region_get_rectangle (intersection, k, &rect);
/* Separately linear interpolate X and Y coordinates in the source
/* Separately linear interpolate X and Y coordinates in the
* source
* based on the destination X and Y coordinates */
src_x1 = (src_x[i] * (dest_rect.x + dest_rect.width - rect.x) +
src_x[i + 1] * (rect.x - dest_rect.x)) / dest_rect.width;
src_x2 = (src_x[i] * (dest_rect.x + dest_rect.width - (rect.x + rect.width)) +
src_x[i + 1] * (rect.x + rect.width - dest_rect.x)) / dest_rect.width;
src_x1 =
(src_x[i] * (dest_rect.x + dest_rect.width - rect.x) +
src_x[i + 1] * (rect.x - dest_rect.x)) /
dest_rect.width;
src_x2 =
(src_x[i] *
(dest_rect.x + dest_rect.width - (rect.x + rect.width)) +
src_x[i + 1] *
(rect.x + rect.width - dest_rect.x)) / dest_rect.width;
src_y1 = (src_y[j] * (dest_rect.y + dest_rect.height - rect.y) +
src_y[j + 1] * (rect.y - dest_rect.y)) / dest_rect.height;
src_y2 = (src_y[j] * (dest_rect.y + dest_rect.height - (rect.y + rect.height)) +
src_y[j + 1] * (rect.y + rect.height - dest_rect.y)) / dest_rect.height;
src_y1 =
(src_y[j] * (dest_rect.y + dest_rect.height - rect.y) +
src_y[j + 1] * (rect.y - dest_rect.y)) /
dest_rect.height;
src_y2 =
(src_y[j] *
(dest_rect.y + dest_rect.height - (rect.y + rect.height)) +
src_y[j + 1] *
(rect.y + rect.height - dest_rect.y)) / dest_rect.height;
cogl_rectangle_with_texture_coords (rect.x, rect.y,
rect.x + rect.width, rect.y + rect.height,
src_x1, src_y1, src_x2, src_y2);
rect.x + rect.width,
rect.y + rect.height,
src_x1, src_y1, src_x2,
src_y2);
}
cairo_region_destroy (intersection);
@ -375,8 +400,10 @@ meta_shadow_get_bounds (MetaShadow *shadow,
{
bounds->x = window_x - shadow->outer_border_left;
bounds->y = window_y - shadow->outer_border_top;
bounds->width = window_width + shadow->outer_border_left + shadow->outer_border_right;
bounds->height = window_height + shadow->outer_border_top + shadow->outer_border_bottom;
bounds->width = window_width + shadow->outer_border_left +
shadow->outer_border_right;
bounds->height = window_height + shadow->outer_border_top +
shadow->outer_border_bottom;
}
static void
@ -790,22 +817,45 @@ make_shadow (MetaShadow *shadow,
/* Step 6: fade out the top, if applicable */
if (shadow->key.top_fade >= 0)
{
for (j = y_offset; j < y_offset + MIN (shadow->key.top_fade, extents.height + shadow->outer_border_bottom); j++)
fade_bytes(buffer + j * buffer_width, buffer_width, j - y_offset, shadow->key.top_fade);
for (j = y_offset;
j <
y_offset +
MIN (shadow->key.top_fade,
extents.height + shadow->outer_border_bottom);
j++)
fade_bytes (buffer + j * buffer_width, buffer_width, j - y_offset,
shadow->key.top_fade);
}
/* We offset the passed in pixels to crop off the extra area we allocated at the top
* in the case of top_fade >= 0. We also account for padding at the left for symmetry
/* We offset the passed in pixels to crop off the extra area we allocated at
* the top
* in the case of top_fade >= 0. We also account for padding at the left for
*symmetry
* though that doesn't currently occur.
*/
shadow->texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx,
shadow->outer_border_left + extents.width + shadow->outer_border_right,
shadow->outer_border_top + extents.height + shadow->outer_border_bottom,
shadow->
outer_border_left
+ extents.width
+ shadow->
outer_border_right,
shadow->
outer_border_top
+ extents.
height +
shadow->
outer_border_bottom,
COGL_PIXEL_FORMAT_A_8,
buffer_width,
(buffer +
(y_offset - shadow->outer_border_top) * buffer_width +
(x_offset - shadow->outer_border_left)),
(y_offset -
shadow->
outer_border_top)
* buffer_width
+
(x_offset -
shadow->
outer_border_left)),
&error));
if (error)
@ -827,7 +877,8 @@ get_shadow_params (MetaShadowFactory *factory,
gboolean focused,
gboolean create)
{
MetaShadowClassInfo *class_info = g_hash_table_lookup (factory->shadow_classes,
MetaShadowClassInfo *class_info = g_hash_table_lookup (
factory->shadow_classes,
class_name);
if (class_info == NULL)
{
@ -883,9 +934,12 @@ meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
MetaShadow *shadow;
cairo_region_t *region;
int spread;
int shape_border_top, shape_border_right, shape_border_bottom, shape_border_left;
int inner_border_top, inner_border_right, inner_border_bottom, inner_border_left;
int outer_border_top, outer_border_right, outer_border_bottom, outer_border_left;
int shape_border_top, shape_border_right, shape_border_bottom,
shape_border_left;
int inner_border_top, inner_border_right, inner_border_bottom,
inner_border_left;
int outer_border_top, outer_border_right, outer_border_bottom,
outer_border_left;
gboolean scale_width, scale_height;
gboolean cacheable;
int center_width, center_height;
@ -969,13 +1023,15 @@ meta_shadow_factory_get_shadow (MetaShadowFactory *factory,
shadow->scale_width = scale_width;
if (scale_width)
center_width = inner_border_left + inner_border_right - (shape_border_left + shape_border_right);
center_width = inner_border_left + inner_border_right -
(shape_border_left + shape_border_right);
else
center_width = width - (shape_border_left + shape_border_right);
shadow->scale_height = scale_height;
if (scale_height)
center_height = inner_border_top + inner_border_bottom - (shape_border_top + shape_border_bottom);
center_height = inner_border_top + inner_border_bottom -
(shape_border_top + shape_border_bottom);
else
center_height = height - (shape_border_top + shape_border_bottom);
@ -1034,7 +1090,8 @@ meta_shadow_factory_set_params (MetaShadowFactory *factory,
* @factory: a #MetaShadowFactory
* @class_name: name of the class of shadow to get the params for
* @focused: whether the shadow is for a focused window
* @params: (out caller-allocates): location to store the current parameter values
* @params: (out caller-allocates): location to store the current parameter
*values
*
* Gets the shadow parameters for a particular class of shadows
* for either the focused or unfocused state. If the class name

View File

@ -66,7 +66,8 @@ static void meta_shaped_texture_get_preferred_height (ClutterActor *self,
gfloat *min_height_p,
gfloat *natural_height_p);
static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self, ClutterPaintVolume *volume);
static gboolean meta_shaped_texture_get_paint_volume (ClutterActor *self,
ClutterPaintVolume *volume);
static void cullable_iface_init (MetaCullableInterface *iface);
@ -74,7 +75,8 @@ static void cullable_iface_init (MetaCullableInterface *iface);
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_SHAPED_TEXTURE, \
MetaShapedTexturePrivate))
enum {
enum
{
SIZE_CHANGED,
LAST_SIGNAL,
@ -114,9 +116,11 @@ struct _MetaShapedTexturePrivate
guint create_mipmaps : 1;
};
G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture, CLUTTER_TYPE_ACTOR,
G_DEFINE_TYPE_WITH_CODE (MetaShapedTexture, meta_shaped_texture,
CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaShapedTexture)
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
cullable_iface_init));
static void
meta_shaped_texture_class_init (MetaShapedTextureClass *klass)
@ -488,7 +492,9 @@ meta_shaped_texture_paint (ClutterActor *actor)
if (tex_width == 0 || tex_height == 0) /* no contents yet */
return;
tex_rect = (cairo_rectangle_int_t) { 0, 0, tex_width, tex_height };
tex_rect = (cairo_rectangle_int_t) {
0, 0, tex_width, tex_height
};
/* Use nearest-pixel interpolation if the texture is unscaled. This
* improves performance, especially with software rendering.
@ -621,7 +627,8 @@ meta_shaped_texture_paint (ClutterActor *actor)
else
{
blended_pipeline = get_masked_pipeline (stex, ctx);
cogl_pipeline_set_layer_texture (blended_pipeline, 1, priv->mask_texture);
cogl_pipeline_set_layer_texture (blended_pipeline, 1,
priv->mask_texture);
cogl_pipeline_set_layer_filters (blended_pipeline, 1, filter, filter);
}
@ -843,7 +850,8 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex,
{
cairo_rectangle_int_t damage_rect;
cairo_region_get_extents (intersection, &damage_rect);
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stex), &damage_rect);
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (
stex), &damage_rect);
cairo_region_destroy (intersection);
return TRUE;
}
@ -1032,8 +1040,10 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex,
clip->height);
mask_surface = cairo_image_surface_create (CAIRO_FORMAT_A8,
cogl_texture_get_width (mask_texture),
cogl_texture_get_height (mask_texture));
cogl_texture_get_width (
mask_texture),
cogl_texture_get_height (
mask_texture));
cogl_texture_get_data (mask_texture, COGL_PIXEL_FORMAT_A_8,
cairo_image_surface_get_stride (mask_surface),

View File

@ -93,7 +93,8 @@ void
meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
struct wl_list *frame_callbacks)
{
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
MetaSurfaceActorWaylandPrivate *priv =
meta_surface_actor_wayland_get_instance_private (self);
wl_list_insert_list (&priv->frame_callback_list, frame_callbacks);
}
@ -169,7 +170,8 @@ meta_surface_actor_wayland_paint (ClutterActor *actor)
{
MetaWaylandCompositor *compositor = priv->surface->compositor;
wl_list_insert_list (&compositor->frame_callbacks, &priv->frame_callback_list);
wl_list_insert_list (&compositor->frame_callbacks,
&priv->frame_callback_list);
wl_list_init (&priv->frame_callback_list);
}
@ -207,17 +209,23 @@ meta_surface_actor_wayland_class_init (MetaSurfaceActorWaylandClass *klass)
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
actor_class->get_preferred_width = meta_surface_actor_wayland_get_preferred_width;
actor_class->get_preferred_height = meta_surface_actor_wayland_get_preferred_height;
actor_class->get_preferred_width =
meta_surface_actor_wayland_get_preferred_width;
actor_class->get_preferred_height =
meta_surface_actor_wayland_get_preferred_height;
actor_class->paint = meta_surface_actor_wayland_paint;
surface_actor_class->process_damage = meta_surface_actor_wayland_process_damage;
surface_actor_class->process_damage =
meta_surface_actor_wayland_process_damage;
surface_actor_class->pre_paint = meta_surface_actor_wayland_pre_paint;
surface_actor_class->is_visible = meta_surface_actor_wayland_is_visible;
surface_actor_class->should_unredirect = meta_surface_actor_wayland_should_unredirect;
surface_actor_class->set_unredirected = meta_surface_actor_wayland_set_unredirected;
surface_actor_class->is_unredirected = meta_surface_actor_wayland_is_unredirected;
surface_actor_class->should_unredirect =
meta_surface_actor_wayland_should_unredirect;
surface_actor_class->set_unredirected =
meta_surface_actor_wayland_set_unredirected;
surface_actor_class->is_unredirected =
meta_surface_actor_wayland_is_unredirected;
surface_actor_class->get_window = meta_surface_actor_wayland_get_window;
@ -232,8 +240,10 @@ meta_surface_actor_wayland_init (MetaSurfaceActorWayland *self)
MetaSurfaceActor *
meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
{
MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND, NULL);
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
MetaSurfaceActorWayland *self = g_object_new (META_TYPE_SURFACE_ACTOR_WAYLAND,
NULL);
MetaSurfaceActorWaylandPrivate *priv =
meta_surface_actor_wayland_get_instance_private (self);
g_assert (meta_is_wayland_compositor ());
@ -248,6 +258,7 @@ meta_surface_actor_wayland_new (MetaWaylandSurface *surface)
MetaWaylandSurface *
meta_surface_actor_wayland_get_surface (MetaSurfaceActorWayland *self)
{
MetaSurfaceActorWaylandPrivate *priv = meta_surface_actor_wayland_get_instance_private (self);
MetaSurfaceActorWaylandPrivate *priv =
meta_surface_actor_wayland_get_instance_private (self);
return priv->surface;
}

View File

@ -62,12 +62,14 @@ struct _MetaSurfaceActorX11Private
};
typedef struct _MetaSurfaceActorX11Private MetaSurfaceActorX11Private;
G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorX11, meta_surface_actor_x11, META_TYPE_SURFACE_ACTOR)
G_DEFINE_TYPE_WITH_PRIVATE (MetaSurfaceActorX11, meta_surface_actor_x11,
META_TYPE_SURFACE_ACTOR)
static void
free_damage (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
@ -83,16 +85,20 @@ free_damage (MetaSurfaceActorX11 *self)
static void
detach_pixmap (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
MetaShapedTexture *stex =
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (priv->pixmap == None)
return;
/* Get rid of all references to the pixmap before freeing it; it's unclear whether
* you are supposed to be able to free a GLXPixmap after freeing the underlying
/* Get rid of all references to the pixmap before freeing it; it's unclear
* whether
* you are supposed to be able to free a GLXPixmap after freeing the
*underlying
* pixmap, but it certainly doesn't work with current DRI/Mesa
*/
meta_shaped_texture_set_texture (stex, NULL);
@ -110,24 +116,30 @@ static void
set_pixmap (MetaSurfaceActorX11 *self,
Pixmap pixmap)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
CoglContext *ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
CoglContext *ctx = clutter_backend_get_cogl_context (
clutter_get_default_backend ());
MetaShapedTexture *stex =
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
CoglError *error = NULL;
CoglTexture *texture;
g_assert (priv->pixmap == None);
priv->pixmap = pixmap;
texture = COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, priv->pixmap, FALSE, &error));
texture =
COGL_TEXTURE (cogl_texture_pixmap_x11_new (ctx, priv->pixmap, FALSE,
&error));
if (error != NULL)
{
g_warning ("Failed to allocate stex texture: %s", error->message);
cogl_error_free (error);
}
else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (COGL_TEXTURE_PIXMAP_X11 (texture))))
else if (G_UNLIKELY (!cogl_texture_pixmap_x11_is_using_tfp_extension (
COGL_TEXTURE_PIXMAP_X11 (texture))))
g_warning ("NOTE: Not using GLX TFP!\n");
priv->texture = texture;
@ -137,7 +149,8 @@ set_pixmap (MetaSurfaceActorX11 *self,
static void
update_pixmap (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
@ -181,7 +194,8 @@ update_pixmap (MetaSurfaceActorX11 *self)
static gboolean
is_visible (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
return (priv->pixmap != None) && !priv->unredirected;
}
@ -190,11 +204,13 @@ meta_surface_actor_x11_process_damage (MetaSurfaceActor *actor,
int x, int y, int width, int height)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
priv->received_damage = TRUE;
if (meta_window_is_fullscreen (priv->window) && !priv->unredirected && !priv->does_full_damage)
if (meta_window_is_fullscreen (priv->window) && !priv->unredirected &&
!priv->does_full_damage)
{
MetaRectangle window_rect;
meta_window_get_frame_rect (priv->window, &window_rect);
@ -222,7 +238,8 @@ static void
meta_surface_actor_x11_pre_paint (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
@ -249,7 +266,8 @@ static gboolean
meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
/* If we're not ARGB32, then we're opaque. */
if (!meta_surface_actor_is_argb32 (actor))
@ -266,7 +284,8 @@ meta_surface_actor_x11_is_opaque (MetaSurfaceActor *actor)
meta_window_get_client_area_rect (window, &client_area);
/* Otherwise, check if our opaque region covers our entire surface. */
if (cairo_region_contains_rectangle (opaque_region, &client_area) == CAIRO_REGION_OVERLAP_IN)
if (cairo_region_contains_rectangle (opaque_region,
&client_area) == CAIRO_REGION_OVERLAP_IN)
return TRUE;
return FALSE;
@ -276,7 +295,8 @@ static gboolean
meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaWindow *window = priv->window;
@ -310,7 +330,8 @@ meta_surface_actor_x11_should_unredirect (MetaSurfaceActor *actor)
static void
sync_unredirected (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = priv->display;
Display *xdisplay = meta_x11_display_get_xdisplay (display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
@ -335,7 +356,8 @@ meta_surface_actor_x11_set_unredirected (MetaSurfaceActor *actor,
gboolean unredirected)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
if (priv->unredirected == unredirected)
return;
@ -348,7 +370,8 @@ static gboolean
meta_surface_actor_x11_is_unredirected (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11 *self = META_SURFACE_ACTOR_X11 (actor);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
return priv->unredirected;
}
@ -367,7 +390,8 @@ meta_surface_actor_x11_dispose (GObject *object)
static MetaWindow *
meta_surface_actor_x11_get_window (MetaSurfaceActor *actor)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (META_SURFACE_ACTOR_X11 (actor));
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (META_SURFACE_ACTOR_X11 (actor));
return priv->window;
}
@ -384,8 +408,10 @@ meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
surface_actor_class->pre_paint = meta_surface_actor_x11_pre_paint;
surface_actor_class->is_visible = meta_surface_actor_x11_is_visible;
surface_actor_class->should_unredirect = meta_surface_actor_x11_should_unredirect;
surface_actor_class->set_unredirected = meta_surface_actor_x11_set_unredirected;
surface_actor_class->should_unredirect =
meta_surface_actor_x11_should_unredirect;
surface_actor_class->set_unredirected =
meta_surface_actor_x11_set_unredirected;
surface_actor_class->is_unredirected = meta_surface_actor_x11_is_unredirected;
surface_actor_class->get_window = meta_surface_actor_x11_get_window;
@ -394,7 +420,8 @@ meta_surface_actor_x11_class_init (MetaSurfaceActorX11Class *klass)
static void
meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
priv->last_width = -1;
priv->last_height = -1;
@ -403,8 +430,10 @@ meta_surface_actor_x11_init (MetaSurfaceActorX11 *self)
static void
create_damage (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
Display *xdisplay = meta_x11_display_get_xdisplay (priv->display->x11_display);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
Display *xdisplay =
meta_x11_display_get_xdisplay (priv->display->x11_display);
Window xwindow = meta_window_x11_get_toplevel_xwindow (priv->window);
priv->damage = XDamageCreate (xdisplay, xwindow, XDamageReportBoundingBox);
@ -425,8 +454,10 @@ window_decorated_notify (MetaWindow *window,
static void
reset_texture (MetaSurfaceActorX11 *self)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaShapedTexture *stex =
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (!priv->texture)
return;
@ -442,7 +473,8 @@ MetaSurfaceActor *
meta_surface_actor_x11_new (MetaWindow *window)
{
MetaSurfaceActorX11 *self = g_object_new (META_TYPE_SURFACE_ACTOR_X11, NULL);
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaDisplay *display = meta_window_get_display (window);
g_assert (!meta_is_wayland_compositor ());
@ -468,8 +500,10 @@ void
meta_surface_actor_x11_set_size (MetaSurfaceActorX11 *self,
int width, int height)
{
MetaSurfaceActorX11Private *priv = meta_surface_actor_x11_get_instance_private (self);
MetaShapedTexture *stex = meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
MetaSurfaceActorX11Private *priv =
meta_surface_actor_x11_get_instance_private (self);
MetaShapedTexture *stex =
meta_surface_actor_get_texture (META_SURFACE_ACTOR (self));
if (priv->last_width == width &&
priv->last_height == height)

View File

@ -31,11 +31,14 @@ struct _MetaSurfaceActorPrivate
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor, CLUTTER_TYPE_ACTOR,
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MetaSurfaceActor, meta_surface_actor,
CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaSurfaceActor)
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
cullable_iface_init));
enum {
enum
{
REPAINT_SCHEDULED,
SIZE_CHANGED,
@ -88,7 +91,8 @@ meta_surface_actor_pick (ClutterActor *actor,
ctx = clutter_backend_get_cogl_context (clutter_get_default_backend ());
fb = cogl_get_draw_framebuffer ();
cogl_color_init_from_4ub (&cogl_color, color->red, color->green, color->blue, color->alpha);
cogl_color_init_from_4ub (&cogl_color, color->red, color->green,
color->blue, color->alpha);
pipeline = cogl_pipeline_new (ctx);
cogl_pipeline_set_color (pipeline, &cogl_color);
@ -277,7 +281,10 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self,
* any drawing done to the window is always immediately reflected in the
* texture regardless of damage event handling.
*/
cairo_rectangle_int_t rect = { .x = x, .y = y, .width = width, .height = height };
cairo_rectangle_int_t rect =
{
.x = x, .y = y, .width = width, .height = height
};
if (!priv->pending_damage)
priv->pending_damage = cairo_region_create_rectangle (&rect);
@ -286,7 +293,8 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self,
return;
}
META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width, height);
META_SURFACE_ACTOR_GET_CLASS (self)->process_damage (self, x, y, width,
height);
if (meta_surface_actor_is_visible (self))
meta_surface_actor_update_area (self, x, y, width, height);
@ -348,7 +356,8 @@ meta_surface_actor_set_frozen (MetaSurfaceActor *self,
int i, n_rects = cairo_region_num_rectangles (priv->pending_damage);
cairo_rectangle_int_t rect;
/* Since we ignore damage events while a window is frozen for certain effects
/* Since we ignore damage events while a window is frozen for certain
* effects
* we need to apply the tracked damage now. */
for (i = 0; i < n_rects; i++)

View File

@ -138,7 +138,8 @@ load_gl_symbol (const char *name,
*func = cogl_get_proc_address (name);
if (!*func)
{
meta_verbose ("MetaSyncRing: failed to resolve required GL symbol \"%s\"\n", name);
meta_verbose (
"MetaSyncRing: failed to resolve required GL symbol \"%s\"\n", name);
return FALSE;
}
return TRUE;
@ -321,7 +322,8 @@ meta_sync_new (Display *xdisplay)
self->xdisplay = xdisplay;
self->xfence = XSyncCreateFence (xdisplay, DefaultRootWindow (xdisplay), FALSE);
self->xfence =
XSyncCreateFence (xdisplay, DefaultRootWindow (xdisplay), FALSE);
self->gl_x11_sync = 0;
self->gpu_fence = 0;
@ -351,7 +353,8 @@ static void
meta_sync_import (MetaSync *self)
{
g_return_if_fail (self->gl_x11_sync == 0);
self->gl_x11_sync = meta_gl_import_sync (GL_SYNC_X11_FENCE_EXT, self->xfence, 0);
self->gl_x11_sync = meta_gl_import_sync (GL_SYNC_X11_FENCE_EXT, self->xfence,
0);
}
static Bool
@ -366,7 +369,8 @@ alarm_event_predicate (Display *dpy,
if (event->type == ring->xsync_event_base + XSyncAlarmNotify)
{
if (((MetaSync *) data)->xalarm == ((XSyncAlarmNotifyEvent *) event)->alarm)
if (((MetaSync *) data)->xalarm ==
((XSyncAlarmNotifyEvent *) event)->alarm)
return True;
}
return False;
@ -427,7 +431,8 @@ meta_sync_ring_init (Display *xdisplay)
if (!load_required_symbols ())
return FALSE;
if (!XSyncQueryExtension (xdisplay, &ring->xsync_event_base, &ring->xsync_error_base) ||
if (!XSyncQueryExtension (xdisplay, &ring->xsync_event_base,
&ring->xsync_error_base) ||
!XSyncInitialize (xdisplay, &major, &minor))
return FALSE;
@ -516,14 +521,17 @@ meta_sync_ring_after_frame (void)
if (ring->warmup_syncs >= NUM_SYNCS / 2)
{
guint reset_sync_idx = (ring->current_sync_idx + NUM_SYNCS - (NUM_SYNCS / 2)) % NUM_SYNCS;
guint reset_sync_idx =
(ring->current_sync_idx + NUM_SYNCS - (NUM_SYNCS / 2)) % NUM_SYNCS;
MetaSync *sync_to_reset = ring->syncs_array[reset_sync_idx];
GLenum status = meta_sync_check_update_finished (sync_to_reset, 0);
if (status == GL_TIMEOUT_EXPIRED)
{
meta_warning ("MetaSyncRing: We should never wait for a sync -- add more syncs?\n");
status = meta_sync_check_update_finished (sync_to_reset, MAX_SYNC_WAIT_TIME);
meta_warning (
"MetaSyncRing: We should never wait for a sync -- add more syncs?\n");
status = meta_sync_check_update_finished (sync_to_reset,
MAX_SYNC_WAIT_TIME);
}
if (status != GL_ALREADY_SIGNALED && status != GL_CONDITION_SATISFIED)
@ -559,7 +567,8 @@ meta_sync_ring_insert_wait (void)
if (ring->current_sync->state != META_SYNC_STATE_READY)
{
meta_warning ("MetaSyncRing: Sync object is not ready -- were events handled properly?\n");
meta_warning (
"MetaSyncRing: Sync object is not ready -- were events handled properly?\n");
if (!meta_sync_ring_reboot (ring->xdisplay))
return FALSE;
}

View File

@ -154,7 +154,9 @@ meta_texture_tower_set_base_texture (MetaTextureTower *tower,
width = cogl_texture_get_width (tower->textures[0]);
height = cogl_texture_get_height (tower->textures[0]);
tower->n_levels = 1 + MAX ((int)(M_LOG2E * log (width)), (int)(M_LOG2E * log (height)));
tower->n_levels = 1 +
MAX ((int) (M_LOG2E * log (width)),
(int) (M_LOG2E * log (height)));
tower->n_levels = MIN (tower->n_levels, MAX_TEXTURE_LEVELS);
meta_texture_tower_update_area (tower, 0, 0, width, height);
@ -290,34 +292,35 @@ get_paint_level (int width, int height)
/* We'll simplify the equations below for a bit of micro-optimization.
* The commented out code is the unsimplified version.
// Partial derivates of window coordinates:
//
// x_w = 0.5 * viewport_width * x_c / w_c + viewport_center_x
// y_w = 0.5 * viewport_height * y_c / w_c + viewport_center_y
//
// with respect to u, v, using
// d(a/b)/dx = da/dx * (1/b) - a * db/dx / (b^2)
dxdu = 0.5 * viewport_width * (pm.xx - pm.wx * (xc/wc)) / wc;
dxdv = 0.5 * viewport_width * (pm.xy - pm.wy * (xc/wc)) / wc;
dydu = 0.5 * viewport_height * (pm.yx - pm.wx * (yc/wc)) / wc;
dydv = 0.5 * viewport_height * (pm.yy - pm.wy * (yc/wc)) / wc;
// Compute the inverse partials as the matrix inverse
det = dxdu * dydv - dxdv * dydu;
dudx = dydv / det;
dudy = - dxdv / det;
dvdx = - dydu / det;
dvdy = dvdu / det;
// Scale factor; maximum of the distance in texels for a change of 1 pixel
// in the X direction or 1 pixel in the Y direction
rho = MAX (sqrt (dudx * dudx + dvdx * dvdx), sqrt(dudy * dudy + dvdy * dvdy));
// Level of detail
lambda = log2 (rho) + LOD_BIAS;
*
* // Partial derivates of window coordinates:
* //
* // x_w = 0.5 * viewport_width * x_c / w_c + viewport_center_x
* // y_w = 0.5 * viewport_height * y_c / w_c + viewport_center_y
* //
* // with respect to u, v, using
* // d(a/b)/dx = da/dx * (1/b) - a * db/dx / (b^2)
*
* dxdu = 0.5 * viewport_width * (pm.xx - pm.wx * (xc/wc)) / wc;
* dxdv = 0.5 * viewport_width * (pm.xy - pm.wy * (xc/wc)) / wc;
* dydu = 0.5 * viewport_height * (pm.yx - pm.wx * (yc/wc)) / wc;
* dydv = 0.5 * viewport_height * (pm.yy - pm.wy * (yc/wc)) / wc;
*
* // Compute the inverse partials as the matrix inverse
* det = dxdu * dydv - dxdv * dydu;
*
* dudx = dydv / det;
* dudy = - dxdv / det;
* dvdx = - dydu / det;
* dvdy = dvdu / det;
*
* // Scale factor; maximum of the distance in texels for a change of 1 pixel
* // in the X direction or 1 pixel in the Y direction
* rho = MAX (sqrt (dudx * dudx + dvdx * dvdx), sqrt(dudy * dudy + dvdy *
*dvdy));
*
* // Level of detail
* lambda = log2 (rho) + LOD_BIAS;
*/
/* dxdu * wc, etc */
@ -337,7 +340,8 @@ get_paint_level (int width, int height)
lambda = 0.5 * M_LOG2E * log (rho_sq * wc * wc / det_sq) + LOD_BIAS;
#if 0
g_print ("%g %g %g\n", 0.5 * viewport_width * pm.xx / pm.ww, 0.5 * viewport_height * pm.yy / pm.ww, lambda);
g_print ("%g %g %g\n", 0.5 * viewport_width * pm.xx / pm.ww,
0.5 * viewport_height * pm.yy / pm.ww, lambda);
#endif
if (lambda <= 0.)
@ -365,7 +369,8 @@ texture_tower_create_texture (MetaTextureTower *tower,
CoglContext *context = clutter_backend_get_cogl_context (backend);
CoglTextureRectangle *texture_rectangle;
texture_rectangle = cogl_texture_rectangle_new_with_size (context, width, height);
texture_rectangle = cogl_texture_rectangle_new_with_size (context, width,
height);
tower->textures[level] = COGL_TEXTURE (texture_rectangle);
}
else
@ -407,14 +412,16 @@ texture_tower_revalidate (MetaTextureTower *tower,
return;
}
cogl_framebuffer_orthographic (fb, 0, 0, dest_texture_width, dest_texture_height, -1., 1.);
cogl_framebuffer_orthographic (fb, 0, 0, dest_texture_width,
dest_texture_height, -1., 1.);
if (!tower->pipeline_template)
{
CoglContext *ctx =
clutter_backend_get_cogl_context (clutter_get_default_backend ());
tower->pipeline_template = cogl_pipeline_new (ctx);
cogl_pipeline_set_blend (tower->pipeline_template, "RGBA = ADD (SRC_COLOR, 0)", NULL);
cogl_pipeline_set_blend (tower->pipeline_template,
"RGBA = ADD (SRC_COLOR, 0)", NULL);
}
pipeline = cogl_pipeline_copy (tower->pipeline_template);
@ -426,7 +433,8 @@ texture_tower_revalidate (MetaTextureTower *tower,
(2. * invalid->x1) / source_texture_width,
(2. * invalid->y1) / source_texture_height,
(2. * invalid->x2) / source_texture_width,
(2. * invalid->y2) / source_texture_height);
(2. * invalid->y2) /
source_texture_height);
cogl_object_unref (pipeline);
@ -474,12 +482,14 @@ meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
for (i = 1; i <= level; i++)
{
/* Use "floor" convention here to be consistent with the NPOT texture extension */
/* Use "floor" convention here to be consistent with the NPOT texture
* extension */
texture_width = MAX (1, texture_width / 2);
texture_height = MAX (1, texture_height / 2);
if (tower->textures[i] == NULL)
texture_tower_create_texture (tower, i, texture_width, texture_height);
texture_tower_create_texture (tower, i, texture_width,
texture_height);
}
for (i = 1; i <= level; i++)

View File

@ -3,7 +3,8 @@
/**
* SECTION:meta-window-actor
* @title: MetaWindowActor
* @short_description: An actor representing a top-level window in the scene graph
* @short_description: An actor representing a top-level window in the scene
*graph
*/
#include "config.h"
@ -40,7 +41,8 @@
#include "wayland/meta-wayland-surface.h"
#endif
typedef enum {
typedef enum
{
INITIALLY_FROZEN,
DRAWING_FIRST_FRAME,
EMITTED_FIRST_FRAME
@ -119,13 +121,15 @@ struct _MetaWindowActorPrivate
typedef struct _FrameData FrameData;
/* Each time the application updates the sync request counter to a new even value
/* Each time the application updates the sync request counter to a new even
* value
* value, we queue a frame into the windows list of frames. Once we're painting
* an update "in response" to the window, we fill in frame_counter with the
* Cogl counter for that frame, and send _NET_WM_FRAME_DRAWN at the end of the
* frame. _NET_WM_FRAME_TIMINGS is sent when we get a frame_complete callback.
*
* As an exception, if a window is completely obscured, we try to throttle drawning
* As an exception, if a window is completely obscured, we try to throttle
*drawning
* to a slower frame rate. In this case, frame_counter stays -1 until
* send_frame_message_timeout() runs, at which point we send both the
* _NET_WM_FRAME_DRAWN and _NET_WM_FRAME_TIMINGS messages.
@ -188,7 +192,8 @@ static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWindowActor, meta_window_actor, CLUTTER_TYPE_ACTOR,
G_ADD_PRIVATE (MetaWindowActor)
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
cullable_iface_init));
static void
frame_data_free (FrameData *frame)
@ -328,8 +333,8 @@ is_argb32 (MetaWindowActor *self)
MetaWindowActorPrivate *priv = self->priv;
/* assume we're argb until we get the window (because
in practice we're drawing nothing, so we're fully
transparent)
* in practice we're drawing nothing, so we're fully
* transparent)
*/
if (priv->surface)
return meta_surface_actor_is_argb32 (priv->surface);
@ -414,7 +419,8 @@ set_surface (MetaWindowActor *self,
g_signal_handler_disconnect (priv->surface, priv->repaint_scheduled_id);
g_signal_handler_disconnect (priv->surface, priv->size_changed_id);
priv->repaint_scheduled_id = 0;
clutter_actor_remove_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
clutter_actor_remove_child (CLUTTER_ACTOR (self),
CLUTTER_ACTOR (priv->surface));
g_object_unref (priv->surface);
}
@ -423,11 +429,16 @@ set_surface (MetaWindowActor *self,
if (priv->surface)
{
g_object_ref_sink (priv->surface);
priv->repaint_scheduled_id = g_signal_connect (priv->surface, "repaint-scheduled",
G_CALLBACK (surface_repaint_scheduled), self);
priv->repaint_scheduled_id = g_signal_connect (priv->surface,
"repaint-scheduled",
G_CALLBACK (
surface_repaint_scheduled),
self);
priv->size_changed_id = g_signal_connect (priv->surface, "size-changed",
G_CALLBACK (surface_size_changed), self);
clutter_actor_add_child (CLUTTER_ACTOR (self), CLUTTER_ACTOR (priv->surface));
G_CALLBACK (
surface_size_changed), self);
clutter_actor_add_child (CLUTTER_ACTOR (self),
CLUTTER_ACTOR (priv->surface));
meta_window_actor_update_shape (self);
@ -502,7 +513,8 @@ meta_window_actor_dispose (GObject *object)
g_clear_pointer (&priv->unfocused_shadow, meta_shadow_unref);
g_clear_pointer (&priv->shadow_shape, meta_window_shape_unref);
compositor->windows = g_list_remove (compositor->windows, (gconstpointer) self);
compositor->windows =
g_list_remove (compositor->windows, (gconstpointer) self);
g_clear_object (&priv->window);
@ -536,7 +548,8 @@ meta_window_actor_set_property (GObject *object,
case PROP_META_WINDOW:
priv->window = g_value_dup_object (value);
g_signal_connect_object (priv->window, "notify::appears-focused",
G_CALLBACK (window_appears_focused_notify), self, 0);
G_CALLBACK (
window_appears_focused_notify), self, 0);
break;
case PROP_SHADOW_MODE:
{
@ -648,7 +661,8 @@ meta_window_actor_get_shadow_bounds (MetaWindowActor *self,
cairo_rectangle_int_t *bounds)
{
MetaWindowActorPrivate *priv = self->priv;
MetaShadow *shadow = appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
MetaShadow *shadow =
appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
cairo_rectangle_int_t shape_bounds;
MetaShadowParams params;
@ -712,7 +726,8 @@ meta_window_actor_paint (ClutterActor *actor)
MetaWindowActor *self = META_WINDOW_ACTOR (actor);
MetaWindowActorPrivate *priv = self->priv;
gboolean appears_focused = meta_window_appears_focused (priv->window);
MetaShadow *shadow = appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
MetaShadow *shadow =
appears_focused ? priv->focused_shadow : priv->unfocused_shadow;
/* This window got damage when obscured; we set up a timer
* to send frame completion events, but since we're drawing
@ -741,7 +756,8 @@ meta_window_actor_paint (ClutterActor *actor)
*/
if (!clip && clip_shadow_under_window (self))
{
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (priv->window);
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (
priv->window);
cairo_rectangle_int_t bounds;
meta_window_actor_get_shadow_bounds (self, appears_focused, &bounds);
@ -755,9 +771,12 @@ meta_window_actor_paint (ClutterActor *actor)
params.y_offset + shape_bounds.y,
shape_bounds.width,
shape_bounds.height,
(clutter_actor_get_paint_opacity (actor) * params.opacity * window->opacity) / (255 * 255),
(clutter_actor_get_paint_opacity (actor) *
params.opacity * window->opacity) / (255 * 255),
clip,
clip_shadow_under_window (self)); /* clip_strictly - not just as an optimization */
clip_shadow_under_window (self)); /* clip_strictly -
* not just as an
* optimization */
if (clip && clip != priv->shadow_clip)
cairo_region_destroy (clip);
@ -790,7 +809,8 @@ meta_window_actor_get_paint_volume (ClutterActor *actor,
* at all.
*/
meta_window_actor_get_shadow_bounds (self, appears_focused, &shadow_bounds);
meta_window_actor_get_shadow_bounds (self, appears_focused,
&shadow_bounds);
shadow_box.x1 = shadow_bounds.x;
shadow_box.x2 = shadow_bounds.x + shadow_bounds.width;
shadow_box.y1 = shadow_bounds.y;
@ -803,7 +823,9 @@ meta_window_actor_get_paint_volume (ClutterActor *actor,
{
const ClutterPaintVolume *child_volume;
child_volume = clutter_actor_get_transformed_paint_volume (CLUTTER_ACTOR (priv->surface), actor);
child_volume =
clutter_actor_get_transformed_paint_volume (CLUTTER_ACTOR (
priv->surface), actor);
if (!child_volume)
return FALSE;
@ -992,12 +1014,18 @@ queue_send_frame_messages_timeout (MetaWindowActor *self)
interval = (int) (1000000 / refresh_rate) * 6;
offset = MAX (0, priv->frame_drawn_time + interval - current_time) / 1000;
/* The clutter master clock source has already been added with META_PRIORITY_REDRAW,
* so the timer will run *after* the clutter frame handling, if a frame is ready
/* The clutter master clock source has already been added with
* META_PRIORITY_REDRAW,
* so the timer will run *after* the clutter frame handling, if a frame is
*ready
* to be drawn when the timer expires.
*/
priv->send_frame_messages_timer = g_timeout_add_full (META_PRIORITY_REDRAW, offset, send_frame_messages_timeout, self, NULL);
g_source_set_name_by_id (priv->send_frame_messages_timer, "[mutter] send_frame_messages_timeout");
priv->send_frame_messages_timer = g_timeout_add_full (META_PRIORITY_REDRAW,
offset,
send_frame_messages_timeout, self,
NULL);
g_source_set_name_by_id (priv->send_frame_messages_timer,
"[mutter] send_frame_messages_timeout");
}
void
@ -1051,7 +1079,8 @@ meta_window_actor_queue_frame_drawn (MetaWindowActor *self,
if (priv->surface)
{
const cairo_rectangle_int_t clip = { 0, 0, 1, 1 };
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (priv->surface), &clip);
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (
priv->surface), &clip);
priv->repaint_scheduled = TRUE;
}
}
@ -1407,7 +1436,8 @@ meta_window_actor_size_change (MetaWindowActor *self,
meta_window_actor_freeze (self);
if (!meta_plugin_manager_event_size_change (compositor->plugin_mgr, self,
which_change, old_frame_rect, old_buffer_rect))
which_change, old_frame_rect,
old_buffer_rect))
{
self->priv->size_change_in_progress--;
meta_window_actor_thaw (self);
@ -1493,7 +1523,8 @@ see_region (cairo_region_t *region,
int height,
char *filename)
{
cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width, height);
cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_A8, width,
height);
cairo_t *cr = cairo_create (surface);
gdk_cairo_region (cr, region);
@ -1534,7 +1565,8 @@ meta_window_actor_set_clip_region_beneath (MetaWindowActor *self,
if (clip_shadow_under_window (self))
{
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (priv->window);
cairo_region_t *frame_bounds = meta_window_get_frame_bounds (
priv->window);
cairo_region_subtract (priv->shadow_clip, frame_bounds);
}
}
@ -1626,8 +1658,10 @@ check_needs_shadow (MetaWindowActor *self)
meta_window_actor_get_shape_bounds (self, &shape_bounds);
*shadow_location = meta_shadow_factory_get_shadow (factory,
priv->shadow_shape,
shape_bounds.width, shape_bounds.height,
shadow_class, appears_focused);
shape_bounds.width,
shape_bounds.height,
shadow_class,
appears_focused);
}
if (old_shadow != NULL)
@ -1684,7 +1718,8 @@ scan_visible_region (guchar *mask_data,
for (x = rect.x; x < (rect.x + rect.width); x++)
{
int x2 = x;
while (mask_data[y * stride + x2] == 255 && x2 < (rect.x + rect.width))
while (mask_data[y * stride + x2] == 255 &&
x2 < (rect.x + rect.width))
x2++;
if (x2 > x)
@ -1757,7 +1792,8 @@ build_and_scan_frame_mask (MetaWindowActor *self,
meta_frame_get_mask (priv->window->frame, cr);
cairo_surface_flush (surface);
scanned_region = scan_visible_region (mask_data, stride, frame_paint_region);
scanned_region = scan_visible_region (mask_data, stride,
frame_paint_region);
cairo_region_union (shape_region, scanned_region);
cairo_region_destroy (scanned_region);
cairo_region_destroy (frame_paint_region);
@ -1768,7 +1804,9 @@ build_and_scan_frame_mask (MetaWindowActor *self,
if (meta_texture_rectangle_check (paint_tex))
{
mask_texture = COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, tex_width, tex_height));
mask_texture =
COGL_TEXTURE (cogl_texture_rectangle_new_with_size (ctx, tex_width,
tex_height));
cogl_texture_set_components (mask_texture, COGL_TEXTURE_COMPONENTS_A);
cogl_texture_set_region (mask_texture,
0, 0, /* src_x/y */
@ -1782,9 +1820,11 @@ build_and_scan_frame_mask (MetaWindowActor *self,
{
CoglError *error = NULL;
mask_texture = COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
mask_texture =
COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
COGL_PIXEL_FORMAT_A_8,
stride, mask_data, &error));
stride,
mask_data, &error));
if (error)
{
@ -1972,7 +2012,8 @@ do_send_frame_drawn (MetaWindowActor *self, FrameData *frame)
XClientMessageEvent ev = { 0, };
frame->frame_drawn_time = meta_compositor_monotonic_time_to_server_time (display,
frame->frame_drawn_time = meta_compositor_monotonic_time_to_server_time (
display,
g_get_monotonic_time ());
priv->frame_drawn_time = frame->frame_drawn_time;
@ -2049,9 +2090,11 @@ do_send_frame_timings (MetaWindowActor *self,
if (presentation_time != 0)
{
gint64 presentation_time_server = meta_compositor_monotonic_time_to_server_time (display,
gint64 presentation_time_server =
meta_compositor_monotonic_time_to_server_time (display,
presentation_time);
gint64 presentation_time_offset = presentation_time_server - frame->frame_drawn_time;
gint64 presentation_time_offset = presentation_time_server -
frame->frame_drawn_time;
if (presentation_time_offset == 0)
presentation_time_offset = 1;
@ -2107,10 +2150,12 @@ meta_window_actor_frame_complete (MetaWindowActor *self,
if (frame->frame_counter != -1 && frame->frame_counter <= frame_counter)
{
if (G_UNLIKELY (frame->frame_drawn_time == 0))
g_warning ("%s: Frame has assigned frame counter but no frame drawn time",
g_warning (
"%s: Frame has assigned frame counter but no frame drawn time",
priv->window->desc);
if (G_UNLIKELY (frame->frame_counter < frame_counter))
g_warning ("%s: frame_complete callback never occurred for frame %" G_GINT64_FORMAT,
g_warning (
"%s: frame_complete callback never occurred for frame %" G_GINT64_FORMAT,
priv->window->desc, frame->frame_counter);
priv->frames = g_list_delete_link (priv->frames, l);
@ -2170,7 +2215,8 @@ meta_window_actor_sync_updates_frozen (MetaWindowActor *self)
MetaWindowActorPrivate *priv = self->priv;
MetaWindow *window = priv->window;
meta_window_actor_set_updates_frozen (self, meta_window_updates_are_frozen (window));
meta_window_actor_set_updates_frozen (self,
meta_window_updates_are_frozen (window));
}
MetaWindowActor *

View File

@ -28,7 +28,8 @@ struct _MetaWindowGroup
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaWindowGroup, meta_window_group, CLUTTER_TYPE_ACTOR,
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE, cullable_iface_init));
G_IMPLEMENT_INTERFACE (META_TYPE_CULLABLE,
cullable_iface_init));
static void
meta_window_group_cull_out (MetaCullable *cullable,
@ -115,7 +116,8 @@ meta_window_group_paint (ClutterActor *actor)
cairo_region_translate (clip_region, -paint_x_origin, -paint_y_origin);
meta_cullable_cull_out (META_CULLABLE (window_group), unobscured_region, clip_region);
meta_cullable_cull_out (META_CULLABLE (
window_group), unobscured_region, clip_region);
cairo_region_destroy (unobscured_region);
cairo_region_destroy (clip_region);

View File

@ -144,9 +144,11 @@ meta_window_shape_new (cairo_region_t *region)
#if 0
g_print ("%d: +%d+%dx%dx%d => +%d+%dx%dx%d\n",
iter.i, iter.rectangle.x, iter.rectangle.y, iter.rectangle.width, iter.rectangle.height,
iter.i, iter.rectangle.x, iter.rectangle.y, iter.rectangle.width,
iter.rectangle.height,
shape->rectangles[iter.i].x, shape->rectangles[iter.i].y,
hape->rectangles[iter.i].width, shape->rectangles[iter.i].height);
hape->rectangles[iter.i].width,
shape->rectangles[iter.i].height);
#endif
hash = hash * 31 + x1 * 17 + x2 * 27 + y1 * 37 + y2 * 43;
@ -155,7 +157,8 @@ meta_window_shape_new (cairo_region_t *region)
shape->hash = hash;
#if 0
g_print ("%d %d %d %d: %#x\n\n", shape->top, shape->right, shape->bottom, shape->left, shape->hash);
g_print ("%d %d %d %d: %#x\n\n", shape->top, shape->right, shape->bottom,
shape->left, shape->hash);
#endif
return shape;

View File

@ -44,14 +44,23 @@
#define DISPLAY_TILE_PREVIEW_DATA_KEY "MCCP-Default-display-tile-preview-data"
#define META_TYPE_DEFAULT_PLUGIN (meta_default_plugin_get_type ())
#define META_DEFAULT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), META_TYPE_DEFAULT_PLUGIN, MetaDefaultPlugin))
#define META_DEFAULT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), META_TYPE_DEFAULT_PLUGIN, MetaDefaultPluginClass))
#define META_IS_DEFAULT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), META_DEFAULT_PLUGIN_TYPE))
#define META_IS_DEFAULT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), META_TYPE_DEFAULT_PLUGIN))
#define META_DEFAULT_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), META_TYPE_DEFAULT_PLUGIN, MetaDefaultPluginClass))
#define META_DEFAULT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
META_TYPE_DEFAULT_PLUGIN, \
MetaDefaultPlugin))
#define META_DEFAULT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
META_TYPE_DEFAULT_PLUGIN, \
MetaDefaultPluginClass))
#define META_IS_DEFAULT_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
META_DEFAULT_PLUGIN_TYPE))
#define META_IS_DEFAULT_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
META_TYPE_DEFAULT_PLUGIN))
#define META_DEFAULT_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
META_TYPE_DEFAULT_PLUGIN, \
MetaDefaultPluginClass))
#define META_DEFAULT_PLUGIN_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_DEFAULT_PLUGIN, MetaDefaultPluginPrivate))
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_DEFAULT_PLUGIN, \
MetaDefaultPluginPrivate))
typedef struct _MetaDefaultPlugin MetaDefaultPlugin;
typedef struct _MetaDefaultPluginClass MetaDefaultPluginClass;
@ -347,8 +356,8 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
clutter_actor_set_size (background_actor, rect.width, rect.height);
/* Don't use rand() here, mesa calls srand() internally when
parsing the driconf XML, but it's nice if the colors are
reproducible.
* parsing the driconf XML, but it's nice if the colors are
* reproducible.
*/
clutter_color_init (&color,
g_rand_int_range (rand, 0, 255),
@ -358,10 +367,12 @@ on_monitors_changed (MetaMonitorManager *monitor_manager,
background = meta_background_new (display);
meta_background_set_color (background, &color);
meta_background_actor_set_background (META_BACKGROUND_ACTOR (background_actor), background);
meta_background_actor_set_background (META_BACKGROUND_ACTOR (
background_actor), background);
g_object_unref (background);
meta_background_actor_set_vignette (META_BACKGROUND_ACTOR (background_actor),
meta_background_actor_set_vignette (META_BACKGROUND_ACTOR (
background_actor),
TRUE,
0.5,
0.5);
@ -437,7 +448,9 @@ switch_workspace (MetaPlugin *plugin,
MetaWorkspace *workspace;
gint win_workspace;
workspace = meta_window_get_workspace (meta_window_actor_get_meta_window (window_actor));
workspace =
meta_window_get_workspace (meta_window_actor_get_meta_window (
window_actor));
win_workspace = meta_workspace_index (workspace);
if (win_workspace == to || win_workspace == from)
@ -493,7 +506,8 @@ switch_workspace (MetaPlugin *plugin,
* calls the manager callback function.
*/
static void
on_minimize_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
on_minimize_effect_complete (ClutterTimeline *timeline,
EffectCompleteData *data)
{
/*
* Must reverse the effect of the effect; must hide it first to ensure
@ -557,7 +571,6 @@ minimize (MetaPlugin *plugin, MetaWindowActor *window_actor)
g_signal_connect (apriv->tml_minimize, "completed",
G_CALLBACK (on_minimize_effect_complete),
data);
}
else
meta_plugin_minimize_completed (plugin, window_actor);
@ -679,7 +692,8 @@ free_display_tile_preview (gpointer data)
{
DisplayTilePreview *preview = data;
if (G_LIKELY (preview != NULL)) {
if (G_LIKELY (preview != NULL))
{
clutter_actor_destroy (preview->actor);
g_slice_free (DisplayTilePreview, preview);
}
@ -688,10 +702,13 @@ free_display_tile_preview (gpointer data)
static DisplayTilePreview *
get_display_tile_preview (MetaDisplay *display)
{
DisplayTilePreview *preview = g_object_get_qdata (G_OBJECT (display), display_tile_preview_data_quark);
DisplayTilePreview *preview = g_object_get_qdata (G_OBJECT (
display),
display_tile_preview_data_quark);
if (G_UNLIKELY (display_tile_preview_data_quark == 0))
display_tile_preview_data_quark = g_quark_from_static_string (DISPLAY_TILE_PREVIEW_DATA_KEY);
display_tile_preview_data_quark = g_quark_from_static_string (
DISPLAY_TILE_PREVIEW_DATA_KEY);
if (G_UNLIKELY (!preview))
{
@ -701,7 +718,8 @@ get_display_tile_preview (MetaDisplay *display)
clutter_actor_set_background_color (preview->actor, CLUTTER_COLOR_Blue);
clutter_actor_set_opacity (preview->actor, 100);
clutter_actor_add_child (meta_get_window_group_for_display (display), preview->actor);
clutter_actor_add_child (meta_get_window_group_for_display (
display), preview->actor);
g_object_set_qdata_full (G_OBJECT (display),
display_tile_preview_data_quark, preview,
free_display_tile_preview);
@ -733,7 +751,8 @@ show_tile_preview (MetaPlugin *plugin,
clutter_actor_show (preview->actor);
window_actor = CLUTTER_ACTOR (meta_window_get_compositor_private (window));
clutter_actor_set_child_below_sibling (clutter_actor_get_parent (preview->actor),
clutter_actor_set_child_below_sibling (clutter_actor_get_parent (preview->
actor),
preview->actor,
window_actor);

View File

@ -30,17 +30,20 @@
* that are unsorted or overlap; unioning such a set of rectangles 1-by-1
* using cairo_region_union_rectangle() produces O(N^2) behavior (if the union
* adds or removes rectangles in the middle of the region, then it has to
* move all the rectangles after that.) To avoid this behavior, MetaRegionBuilder
* move all the rectangles after that.) To avoid this behavior,
*MetaRegionBuilder
* creates regions for small groups of rectangles and merges them together in
* a binary tree.
*
* Possible improvement: From a glance at the code, accumulating all the rectangles
* Possible improvement: From a glance at the code, accumulating all the
*rectangles
* into a flat array and then calling the (not usefully documented)
* cairo_region_create_rectangles() would have the same behavior and would be
* simpler and a bit more efficient.
*/
/* Optimium performance seems to be with MAX_CHUNK_RECTANGLES=4; 8 is about 10% slower.
/* Optimium performance seems to be with MAX_CHUNK_RECTANGLES=4; 8 is about 10%
* slower.
* But using 8 may be more robust to systems with slow malloc(). */
#define MAX_CHUNK_RECTANGLES 8
@ -165,7 +168,8 @@ meta_region_iterator_next (MetaRegionIterator *iter)
if (iter->i + 1 < iter->n_rectangles)
{
cairo_region_get_rectangle (iter->region, iter->i + 1, &iter->next_rectangle);
cairo_region_get_rectangle (iter->region, iter->i + 1,
&iter->next_rectangle);
iter->line_end = iter->next_rectangle.y != iter->rectangle.y;
}
else
@ -261,11 +265,13 @@ add_expanded_rect (MetaRegionBuilder *builder,
if (flip)
meta_region_builder_add_rectangle (builder,
y - y_amount, x - x_amount,
height + 2 * y_amount, width + 2 * x_amount);
height + 2 * y_amount,
width + 2 * x_amount);
else
meta_region_builder_add_rectangle (builder,
x - x_amount, y - y_amount,
width + 2 * x_amount, height + 2 * y_amount);
width + 2 * x_amount,
height + 2 * y_amount);
}
static cairo_region_t *
@ -337,10 +343,14 @@ expand_region_inverse (cairo_region_t *region,
if (iter.line_end)
{
if (extents.x + extents.width > iter.rectangle.x + iter.rectangle.width)
if (extents.x + extents.width >
iter.rectangle.x + iter.rectangle.width)
add_expanded_rect (&builder,
iter.rectangle.x + iter.rectangle.width, iter.rectangle.y,
(extents.x + extents.width) - (iter.rectangle.x + iter.rectangle.width), iter.rectangle.height,
iter.rectangle.x + iter.rectangle.width,
iter.rectangle.y,
(extents.x + extents.width) -
(iter.rectangle.x + iter.rectangle.width),
iter.rectangle.height,
x_amount, y_amount, flip);
last_x = extents.x;
}

View File

@ -260,9 +260,11 @@ bell_audible_notify (MetaDisplay *display,
if (window)
{
ca_proplist_sets (p, CA_PROP_WINDOW_NAME, window->title);
ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu", (unsigned long)window->xwindow);
ca_proplist_setf (p, CA_PROP_WINDOW_X11_XID, "%lu",
(unsigned long) window->xwindow);
ca_proplist_sets (p, CA_PROP_APPLICATION_NAME, window->res_name);
ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d", window->net_wm_pid);
ca_proplist_setf (p, CA_PROP_APPLICATION_PROCESS_ID, "%d",
window->net_wm_pid);
}
res = ca_context_play_full (ca_gtk_context_get (), 1, p, NULL, NULL);

View File

@ -59,7 +59,9 @@ meta_rectangle_get_type (void)
static GType type_id = 0;
if (!type_id)
type_id = g_boxed_type_register_static (g_intern_static_string ("MetaRectangle"),
type_id =
g_boxed_type_register_static (g_intern_static_string (
"MetaRectangle"),
(GBoxedCopyFunc) meta_rectangle_copy,
(GBoxedFreeFunc) meta_rectangle_free);
return type_id;
@ -528,7 +530,6 @@ merge_spanning_rects_in_region (GList *region)
g_free (delete_me->data);
region = g_list_delete_link (region, delete_me);
}
}
compare = compare->next;
@ -1735,8 +1736,7 @@ fix_up_edges (MetaRectangle *rect, MetaEdge *edge,
* list of edges.
*/
GList *
meta_rectangle_remove_intersections_with_boxes_from_edges (
GList *edges,
meta_rectangle_remove_intersections_with_boxes_from_edges (GList *edges,
const GSList *rectangles)
{
const GSList *rect_iter;
@ -1758,7 +1758,6 @@ meta_rectangle_remove_intersections_with_boxes_from_edges (
/* If this edge overlaps with this rect... */
if (rectangle_and_edge_intersection (rect, edge, &overlap, &handle))
{
/* "Intersections" where the edges touch but are opposite
* sides (e.g. a left edge against the right edge) should not
* be split. Note that the comments in
@ -1889,8 +1888,7 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
*
*/
GList *
meta_rectangle_find_nonintersected_monitor_edges (
const GList *monitor_rects,
meta_rectangle_find_nonintersected_monitor_edges (const GList *monitor_rects,
const GSList *all_struts)
{
/* This function cannot easily be merged with

View File

@ -38,66 +38,67 @@
#include "meta/prefs.h"
#if 0
// This is the short and sweet version of how to hack on this file; see
// doc/how-constraints-works.txt for the gory details. The basics of
// understanding this file can be shown by the steps needed to add a new
// constraint, which are:
// 1) Add a new entry in the ConstraintPriority enum; higher values
// have higher priority
// 2) Write a new function following the format of the example below,
// "constrain_whatever".
// 3) Add your function to the all_constraints and all_constraint_names
// arrays (the latter of which is for debugging purposes)
//
// An example constraint function, constrain_whatever:
//
// /* constrain_whatever does the following:
// * Quits (returning true) if priority is higher than PRIORITY_WHATEVER
// * If check_only is TRUE
// * Returns whether the constraint is satisfied or not
// * otherwise
// * Enforces the constraint
// * Note that the value of PRIORITY_WHATEVER is centralized with the
// * priorities of other constraints in the definition of ConstrainPriority
// * for easier maintenance and shuffling of priorities.
// */
// static gboolean
// constrain_whatever (MetaWindow *window,
// ConstraintInfo *info,
// ConstraintPriority priority,
// gboolean check_only)
// {
// if (priority > PRIORITY_WHATEVER)
// return TRUE;
//
// /* Determine whether constraint applies; note that if the constraint
// * cannot possibly be satisfied, constraint_applies should be set to
// * false. If we don't do this, all constraints with a lesser priority
// * will be dropped along with this one, and we'd rather apply as many as
// * possible.
// */
// if (!constraint_applies)
// return TRUE;
//
// /* Determine whether constraint is already satisfied; if we're only
// * checking the status of whether the constraint is satisfied, we end
// * here.
// */
// if (check_only || constraint_already_satisfied)
// return constraint_already_satisfied;
//
// /* Enforce constraints */
// return TRUE; /* Note that we exited early if check_only is FALSE; also,
// * we know we can return TRUE here because we exited early
// * if the constraint could not be satisfied; not that the
// * return value is heeded in this case...
// */
// }
/* This is the short and sweet version of how to hack on this file; see */
/* doc/how-constraints-works.txt for the gory details. The basics of */
/* understanding this file can be shown by the steps needed to add a new */
/* constraint, which are: */
/* 1) Add a new entry in the ConstraintPriority enum; higher values */
/* have higher priority */
/* 2) Write a new function following the format of the example below, */
/* "constrain_whatever". */
/* 3) Add your function to the all_constraints and all_constraint_names */
/* arrays (the latter of which is for debugging purposes) */
/* */
/* An example constraint function, constrain_whatever: */
/* */
/* / * constrain_whatever does the following: */
/* * Quits (returning true) if priority is higher than PRIORITY_WHATEVER */
/* * If check_only is TRUE */
/* * Returns whether the constraint is satisfied or not */
/* * otherwise */
/* * Enforces the constraint */
/* * Note that the value of PRIORITY_WHATEVER is centralized with the */
/* * priorities of other constraints in the definition of ConstrainPriority */
/* * for easier maintenance and shuffling of priorities. */
/* * / */
/* static gboolean */
/* constrain_whatever (MetaWindow *window, */
/* ConstraintInfo *info, */
/* ConstraintPriority priority, */
/* gboolean check_only) */
/* { */
/* if (priority > PRIORITY_WHATEVER) */
/* return TRUE; */
/* */
/* / * Determine whether constraint applies; note that if the constraint */
/* * cannot possibly be satisfied, constraint_applies should be set to */
/* * false. If we don't do this, all constraints with a lesser priority */
/* * will be dropped along with this one, and we'd rather apply as many as */
/* * possible. */
/* * / */
/* if (!constraint_applies) */
/* return TRUE; */
/* */
/* / * Determine whether constraint is already satisfied; if we're only */
/* * checking the status of whether the constraint is satisfied, we end */
/* * here. */
/* * / */
/* if (check_only || constraint_already_satisfied) */
/* return constraint_already_satisfied; */
/* */
/* / * Enforce constraints * / */
/* return TRUE; / * Note that we exited early if check_only is FALSE; also, */
/* * we know we can return TRUE here because we exited early */
/* * if the constraint could not be satisfied; not that the */
/* * return value is heeded in this case... */
/* * / */
/* } */
#endif
typedef enum
{
PRIORITY_MINIMUM = 0, /* Dummy value used for loop start = min(all priorities) */
PRIORITY_MINIMUM = 0, /* Dummy value used for loop start = min(all priorities)
* */
PRIORITY_ASPECT_RATIO = 0,
PRIORITY_ENTIRELY_VISIBLE_ON_SINGLE_MONITOR = 0,
PRIORITY_ENTIRELY_VISIBLE_ON_WORKAREA = 1,
@ -147,7 +148,8 @@ typedef struct
GList *usable_monitor_region;
} ConstraintInfo;
static gboolean do_screen_and_monitor_relative_constraints (MetaWindow *window,
static gboolean do_screen_and_monitor_relative_constraints (
MetaWindow *window,
GList *region_spanning_rectangles,
ConstraintInfo *info,
gboolean check_only);
@ -216,12 +218,14 @@ typedef gboolean (* ConstraintFunc) (MetaWindow *window,
ConstraintPriority priority,
gboolean check_only);
typedef struct {
typedef struct
{
ConstraintFunc func;
const char *name;
} Constraint;
static const Constraint all_constraints[] = {
static const Constraint all_constraints[] =
{
{constrain_custom_rule, "constrain_custom_rule"},
{constrain_modal_dialog, "constrain_modal_dialog"},
{constrain_maximization, "constrain_maximization"},
@ -301,7 +305,8 @@ meta_window_constrain (MetaWindow *window,
new);
place_window_if_needed (window, &info);
while (!satisfied && priority <= PRIORITY_MAXIMUM) {
while (!satisfied && priority <= PRIORITY_MAXIMUM)
{
gboolean check_only = TRUE;
/* Individually enforce all the high-enough priority constraints */
@ -348,7 +353,8 @@ setup_constraint_info (ConstraintInfo *info,
if (info->current.height < 1)
info->current.height = 1;
if (flags & META_MOVE_RESIZE_MOVE_ACTION && flags & META_MOVE_RESIZE_RESIZE_ACTION)
if (flags & META_MOVE_RESIZE_MOVE_ACTION &&
flags & META_MOVE_RESIZE_RESIZE_ACTION)
info->action_type = ACTION_MOVE_AND_RESIZE;
else if (flags & META_MOVE_RESIZE_RESIZE_ACTION)
info->action_type = ACTION_RESIZE;
@ -544,10 +550,15 @@ place_window_if_needed(MetaWindow *window,
if (window->maximize_horizontally_after_placement ||
window->maximize_vertically_after_placement)
meta_window_maximize_internal (window,
(window->maximize_horizontally_after_placement ?
(window->
maximize_horizontally_after_placement
?
META_MAXIMIZE_HORIZONTAL : 0) |
(window->maximize_vertically_after_placement ?
META_MAXIMIZE_VERTICAL : 0), &info->current);
(window->
maximize_vertically_after_placement
?
META_MAXIMIZE_VERTICAL : 0),
&info->current);
window->maximize_horizontally_after_placement = FALSE;
window->maximize_vertically_after_placement = FALSE;
@ -726,7 +737,7 @@ try_flip_window_position (MetaWindow *window,
MetaRectangle *rect,
MetaRectangle *intersection)
{
MetaPlacementRule flipped_rule = *placement_rule;;
MetaPlacementRule flipped_rule = *placement_rule;
MetaRectangle flipped_rect;
MetaRectangle flipped_intersection;
@ -920,9 +931,10 @@ constrain_modal_dialog (MetaWindow *window,
return TRUE;
/* We want to center the dialog on the parent, including the decorations
for both of them. info->current is in client X window coordinates, so we need
to convert them to frame coordinates, apply the centering and then
convert back to client.
* for both of them. info->current is in client X window coordinates, so we
* need
* to convert them to frame coordinates, apply the centering and then
* convert back to client.
*/
child_rect = info->current;
@ -930,11 +942,13 @@ constrain_modal_dialog (MetaWindow *window,
meta_window_get_frame_rect (parent, &parent_rect);
child_rect.x = parent_rect.x + (parent_rect.width / 2 - child_rect.width / 2);
child_rect.y = parent_rect.y + (parent_rect.height / 2 - child_rect.height / 2);
child_rect.y = parent_rect.y +
(parent_rect.height / 2 - child_rect.height / 2);
x = child_rect.x;
y = child_rect.y;
constraint_already_satisfied = (x == info->current.x) && (y == info->current.y);
constraint_already_satisfied = (x == info->current.x) &&
(y == info->current.y);
if (check_only || constraint_already_satisfied)
return constraint_already_satisfied;
@ -1008,8 +1022,10 @@ constrain_maximization (MetaWindow *window,
* windows, as per bug 327543.
*/
get_size_limits (window, &min_size, &max_size);
hminbad = target_size.width < min_size.width && window->maximized_horizontally;
vminbad = target_size.height < min_size.height && window->maximized_vertically;
hminbad = target_size.width < min_size.width &&
window->maximized_horizontally;
vminbad = target_size.height < min_size.height &&
window->maximized_vertically;
if (hminbad || vminbad)
return TRUE;
@ -1373,7 +1389,8 @@ constrain_aspect_ratio (MetaWindow *window,
meta_rectangle_find_linepoint_closest_to_point (alt_width, new_height,
new_width, alt_height,
new_width, new_height,
&best_width, &best_height);
&best_width,
&best_height);
/* Yeah, I suck for doing implicit rounding -- sue me */
new_width = best_width;
@ -1408,8 +1425,7 @@ constrain_aspect_ratio (MetaWindow *window,
}
static gboolean
do_screen_and_monitor_relative_constraints (
MetaWindow *window,
do_screen_and_monitor_relative_constraints (MetaWindow *window,
GList *region_spanning_rectangles,
ConstraintInfo *info,
gboolean check_only)
@ -1425,7 +1441,8 @@ do_screen_and_monitor_relative_constraints (
meta_topic (META_DEBUG_GEOMETRY,
"screen/monitor constraint; region_spanning_rectangles: %s\n",
meta_rectangle_region_to_string (region_spanning_rectangles, ", ",
meta_rectangle_region_to_string (region_spanning_rectangles,
", ",
spanning_region));
}
#endif

View File

@ -53,7 +53,8 @@ get_window (Display *xdisplay,
MetaWindow *window;
display = meta_display_for_x_display (xdisplay);
window = meta_x11_display_lookup_x_window (display->x11_display, frame_xwindow);
window =
meta_x11_display_lookup_x_window (display->x11_display, frame_xwindow);
if (window == NULL || window->frame == NULL)
{

View File

@ -50,7 +50,8 @@ meta_window_ensure_close_dialog (MetaWindow *window)
return;
display = window->display;
window->close_dialog = meta_compositor_create_close_dialog (display->compositor,
window->close_dialog = meta_compositor_create_close_dialog (
display->compositor,
window);
g_signal_connect (window->close_dialog, "response",
G_CALLBACK (close_dialog_response_cb), window);

View File

@ -151,7 +151,8 @@ enum
LAST_SIGNAL
};
enum {
enum
{
PROP_0,
PROP_FOCUS_WINDOW
@ -491,7 +492,6 @@ meta_display_class_init (MetaDisplayClass *klass)
"Currently focused window",
META_TYPE_WINDOW,
G_PARAM_READABLE));
}
@ -535,7 +535,8 @@ meta_display_remove_pending_pings_for_window (MetaDisplay *display,
{
MetaPingData *ping_data = tmp->data;
display->pending_pings = g_slist_remove (display->pending_pings, ping_data);
display->pending_pings =
g_slist_remove (display->pending_pings, ping_data);
ping_data_free (ping_data);
}
@ -620,8 +621,10 @@ gesture_tracker_state_changed (MetaGestureTracker *tracker,
XIAllowTouchEvents (meta_backend_x11_get_xdisplay (backend),
META_VIRTUAL_CORE_POINTER_ID,
clutter_x11_event_sequence_get_touch_detail (sequence),
DefaultRootWindow (display->x11_display->xdisplay), event_mode);
clutter_x11_event_sequence_get_touch_detail (
sequence),
DefaultRootWindow (
display->x11_display->xdisplay), event_mode);
}
}
@ -686,7 +689,7 @@ meta_display_open (void)
display->mouse_mode = TRUE; /* Only relevant for mouse or sloppy focus */
display->allow_terminal_deactivation = TRUE; /* Only relevant for when a
terminal has the focus */
* terminal has the focus */
i = 0;
while (i < N_IGNORED_CROSSING_SERIALS)
@ -783,15 +786,18 @@ meta_display_open (void)
if (old_active_xwindow != None)
{
MetaWindow *old_active_window;
old_active_window = meta_x11_display_lookup_x_window (display->x11_display,
old_active_window = meta_x11_display_lookup_x_window (
display->x11_display,
old_active_xwindow);
if (old_active_window)
meta_window_focus (old_active_window, timestamp);
else
meta_x11_display_focus_the_no_focus_window (display->x11_display, timestamp);
meta_x11_display_focus_the_no_focus_window (display->x11_display,
timestamp);
}
else if (display->x11_display)
meta_x11_display_focus_the_no_focus_window (display->x11_display, timestamp);
meta_x11_display_focus_the_no_focus_window (display->x11_display,
timestamp);
meta_idle_monitor_init_dbus ();
@ -998,7 +1004,8 @@ meta_display_for_x_display (Display *xdisplay)
if (the_display->x11_display->xdisplay == xdisplay)
return the_display;
meta_warning ("Could not find display for X display %p, probably going to crash\n",
meta_warning (
"Could not find display for X display %p, probably going to crash\n",
xdisplay);
return NULL;
@ -1048,7 +1055,8 @@ meta_grab_op_is_resizing (MetaGrabOp op)
if (!grab_op_is_window (op))
return FALSE;
return (op & META_GRAB_OP_WINDOW_DIR_MASK) != 0 || op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN;
return (op & META_GRAB_OP_WINDOW_DIR_MASK) != 0 ||
op == META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN;
}
gboolean
@ -1151,14 +1159,16 @@ meta_display_add_ignored_crossing_serial (MetaDisplay *display,
int i;
/* don't add the same serial more than once */
if (display->ignored_crossing_serials[N_IGNORED_CROSSING_SERIALS-1] == serial)
if (display->ignored_crossing_serials[N_IGNORED_CROSSING_SERIALS - 1] ==
serial)
return;
/* shift serials to the left */
i = 0;
while (i < (N_IGNORED_CROSSING_SERIALS - 1))
{
display->ignored_crossing_serials[i] = display->ignored_crossing_serials[i+1];
display->ignored_crossing_serials[i] =
display->ignored_crossing_serials[i + 1];
++i;
}
/* put new one on the end */
@ -1206,7 +1216,8 @@ meta_display_queue_autoraise_callback (MetaDisplay *display,
meta_prefs_get_auto_raise_delay (),
window_raise_with_delay_callback,
window, NULL);
g_source_set_name_by_id (display->autoraise_timeout_id, "[mutter] window_raise_with_delay_callback");
g_source_set_name_by_id (display->autoraise_timeout_id,
"[mutter] window_raise_with_delay_callback");
display->autoraise_window = window;
}
@ -1231,7 +1242,8 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
else if (display->focus_window && display->focus_window->surface)
focus_window = display->focus_window;
else
meta_topic (META_DEBUG_FOCUS, "Focus change has no effect, because there is no matching wayland surface");
meta_topic (META_DEBUG_FOCUS,
"Focus change has no effect, because there is no matching wayland surface");
meta_stage_set_active (stage, focus_window == NULL);
meta_wayland_compositor_set_input_focus (compositor, focus_window);
@ -1391,7 +1403,8 @@ meta_display_describe_stack_id (MetaDisplay *display,
window = meta_display_lookup_stack_id (display, stack_id);
if (window && window->title)
snprintf (result, sizeof(buffer[0]), "%#" G_GINT64_MODIFIER "x (%.10s)", stack_id, window->title);
snprintf (result, sizeof (buffer[0]), "%#" G_GINT64_MODIFIER "x (%.10s)",
stack_id, window->title);
else
snprintf (result, sizeof (buffer[0]), "%#" G_GINT64_MODIFIER "x", stack_id);
@ -1640,7 +1653,8 @@ meta_display_begin_grab_op (MetaDisplay *display,
if (display->grab_op != META_GRAB_OP_NONE)
{
meta_warning ("Attempt to perform window operation %u on window %s when operation %u on %s already in effect\n",
meta_warning (
"Attempt to perform window operation %u on window %s when operation %u on %s already in effect\n",
op, window->desc, display->grab_op,
display->grab_window ? display->grab_window->desc : "none");
return FALSE;
@ -1685,7 +1699,8 @@ meta_display_begin_grab_op (MetaDisplay *display,
timestamp);
XSync (display->x11_display->xdisplay, False);
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp))
if (meta_backend_grab_device (backend, META_VIRTUAL_CORE_POINTER_ID,
timestamp))
display->grab_have_pointer = TRUE;
if (!display->grab_have_pointer && !meta_grab_op_is_keyboard (op))
@ -1697,12 +1712,15 @@ meta_display_begin_grab_op (MetaDisplay *display,
/* Grab keys when beginning window ops; see #126497 */
if (event_route == META_EVENT_ROUTE_WINDOW_OP)
{
display->grab_have_keyboard = meta_window_grab_all_keys (grab_window, timestamp);
display->grab_have_keyboard = meta_window_grab_all_keys (grab_window,
timestamp);
if (!display->grab_have_keyboard)
{
meta_topic (META_DEBUG_WINDOW_OPS, "grabbing all keys failed, ungrabbing pointer\n");
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
meta_topic (META_DEBUG_WINDOW_OPS,
"grabbing all keys failed, ungrabbing pointer\n");
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID,
timestamp);
display->grab_have_pointer = FALSE;
return FALSE;
}
@ -1799,7 +1817,8 @@ meta_display_end_grab_op (MetaDisplay *display,
if (display->grab_have_pointer)
{
MetaBackend *backend = meta_get_backend ();
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID, timestamp);
meta_backend_ungrab_device (backend, META_VIRTUAL_CORE_POINTER_ID,
timestamp);
}
if (display->grab_have_keyboard)
@ -1829,7 +1848,7 @@ meta_display_end_grab_op (MetaDisplay *display,
/**
* meta_display_get_grab_op:
* @display: The #MetaDisplay that the window is on
*
* Gets the current grab operation, if any.
*
* Return value: the current grab operation, or %META_GRAB_OP_NONE if
@ -1848,7 +1867,8 @@ meta_display_check_threshold_reached (MetaDisplay *display,
int x,
int y)
{
/* Don't bother doing the check again if we've already reached the threshold */
/* Don't bother doing the check again if we've already reached the threshold
* */
if (meta_prefs_get_raise_on_click () ||
display->grab_threshold_movement_reached)
return;
@ -2009,7 +2029,8 @@ meta_display_ping_window (MetaWindow *window,
ping_data->ping_timeout_id = g_timeout_add (PING_TIMEOUT_DELAY,
meta_display_ping_timeout,
ping_data);
g_source_set_name_by_id (ping_data->ping_timeout_id, "[mutter] meta_display_ping_timeout");
g_source_set_name_by_id (ping_data->ping_timeout_id,
"[mutter] meta_display_ping_timeout");
display->pending_pings = g_slist_prepend (display->pending_pings, ping_data);
@ -2074,10 +2095,17 @@ get_focused_group (MetaDisplay *display)
return NULL;
}
#define IN_TAB_CHAIN(w,t) (((t) == META_TAB_LIST_NORMAL && META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \
|| ((t) == META_TAB_LIST_DOCKS && META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \
|| ((t) == META_TAB_LIST_GROUP && META_WINDOW_IN_GROUP_TAB_CHAIN (w, get_focused_group (w->display))) \
|| ((t) == META_TAB_LIST_NORMAL_ALL && META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w)))
#define IN_TAB_CHAIN(w, \
t) (((t) == META_TAB_LIST_NORMAL && \
META_WINDOW_IN_NORMAL_TAB_CHAIN (w)) \
|| ((t) == META_TAB_LIST_DOCKS && \
META_WINDOW_IN_DOCK_TAB_CHAIN (w)) \
|| ((t) == META_TAB_LIST_GROUP && \
META_WINDOW_IN_GROUP_TAB_CHAIN (w, \
get_focused_group ( \
w->display))) \
|| ((t) == META_TAB_LIST_NORMAL_ALL && \
META_WINDOW_IN_NORMAL_TAB_CHAIN_TYPE (w)))
static MetaWindow *
find_tab_forward (MetaDisplay *display,
@ -2285,9 +2313,15 @@ meta_display_get_tab_next (MetaDisplay *display,
g_assert (window->display == display);
if (backward)
ret = find_tab_backward (display, type, workspace, g_list_find (tab_list, window), TRUE);
ret =
find_tab_backward (display, type, workspace, g_list_find (tab_list,
window),
TRUE);
else
ret = find_tab_forward (display, type, workspace, g_list_find (tab_list, window), TRUE);
ret =
find_tab_forward (display, type, workspace, g_list_find (tab_list,
window),
TRUE);
}
else
{
@ -2390,7 +2424,8 @@ meta_display_manage_all_windows (MetaDisplay *display)
int n_children, i;
meta_stack_freeze (display->stack);
meta_stack_tracker_get_stack (display->stack_tracker, &_children, &n_children);
meta_stack_tracker_get_stack (display->stack_tracker, &_children,
&n_children);
/* Copy the stack as it will be modified as part of the loop */
children = g_memdup (_children, sizeof (guint64) * n_children);
@ -2454,7 +2489,8 @@ meta_display_stack_cmp (const void *a,
*
* Sorts a set of windows according to their current stacking order. If windows
* from multiple screens are present in the set of input windows, then all the
* windows on screen 0 are sorted below all the windows on screen 1, and so forth.
* windows on screen 0 are sorted below all the windows on screen 1, and so
*forth.
* Since the stacking order of override-redirect windows isn't controlled by
* Metacity, if override-redirect windows are in the input, the result may not
* correspond to the actual stacking order in the X server.
@ -2462,7 +2498,8 @@ meta_display_stack_cmp (const void *a,
* An example of using this would be to sort the list of transient dialogs for a
* window into their current stacking order.
*
* Returns: (transfer container) (element-type MetaWindow): Input windows sorted by stacking order, from lowest to highest
* Returns: (transfer container) (element-type MetaWindow): Input windows sorted
*by stacking order, from lowest to highest
*/
GSList *
meta_display_sort_windows_by_stacking (MetaDisplay *display,
@ -2598,7 +2635,8 @@ meta_display_modifiers_accelerator_activate (MetaDisplay *display)
{
gboolean freeze;
g_signal_emit (display, display_signals[MODIFIERS_ACCELERATOR_ACTIVATED], 0, &freeze);
g_signal_emit (display, display_signals[MODIFIERS_ACCELERATOR_ACTIVATED], 0,
&freeze);
return freeze;
}
@ -2812,7 +2850,8 @@ meta_display_request_pad_osd (MetaDisplay *display,
logical_monitor =
meta_input_settings_get_tablet_logical_monitor (input_settings, pad);
#ifdef HAVE_LIBWACOM
wacom_device = meta_input_settings_get_tablet_wacom_device (input_settings,
wacom_device = meta_input_settings_get_tablet_wacom_device (
input_settings,
pad);
layout_path = libwacom_get_layout_filename (wacom_device);
#endif
@ -2849,7 +2888,8 @@ meta_display_get_pad_action_label (MetaDisplay *display,
/* First, lookup the action, as imposed by settings */
settings = meta_backend_get_input_settings (meta_get_backend ());
label = meta_input_settings_get_pad_action_label (settings, pad, action_type, action_number);
label = meta_input_settings_get_pad_action_label (settings, pad, action_type,
action_number);
if (label)
return label;
@ -2862,7 +2902,8 @@ meta_display_get_pad_action_label (MetaDisplay *display,
MetaWaylandTabletPad *tablet_pad = NULL;
compositor = meta_wayland_compositor_get_default ();
tablet_seat = meta_wayland_tablet_manager_ensure_seat (compositor->tablet_manager,
tablet_seat = meta_wayland_tablet_manager_ensure_seat (
compositor->tablet_manager,
compositor->seat);
if (tablet_seat)
tablet_pad = meta_wayland_tablet_seat_lookup_pad (tablet_seat, pad);
@ -2903,7 +2944,8 @@ lookup_tablet_monitor (MetaDisplay *display,
if (!input_settings)
return -1;
monitor = meta_input_settings_get_tablet_logical_monitor (input_settings, device);
monitor = meta_input_settings_get_tablet_logical_monitor (input_settings,
device);
if (monitor)
{
@ -3160,7 +3202,8 @@ meta_display_apply_startup_properties (MetaDisplay *display,
sequence = seq;
g_assert (window->startup_id == NULL);
window->startup_id = g_strdup (sn_startup_sequence_get_id (sequence));
window->startup_id =
g_strdup (sn_startup_sequence_get_id (sequence));
startup_id = window->startup_id;
meta_topic (META_DEBUG_STARTUP,
@ -3316,7 +3359,8 @@ check_fullscreen_func (gpointer data)
{
/* We want to handle the case where an application is creating an
* override-redirect window the size of the screen (monitor) and treat
* it similarly to a fullscreen window, though it doesn't have fullscreen
* it similarly to a fullscreen window, though it doesn't have
*fullscreen
* window management behavior. (Being O-R, it's not managed at all.)
*/
if (meta_window_is_monitor_sized (window))
@ -3374,7 +3418,7 @@ check_fullscreen_func (gpointer data)
if (in_fullscreen_changed)
{
/* DOCK window stacking depends on the monitor's fullscreen
status so we need to trigger a re-layering. */
* status so we need to trigger a re-layering. */
MetaWindow *window = meta_stack_get_top (display->stack);
if (window)
meta_stack_update_layer (display->stack, window);
@ -3389,7 +3433,8 @@ void
meta_display_queue_check_fullscreen (MetaDisplay *display)
{
if (!display->check_fullscreen_later)
display->check_fullscreen_later = meta_later_add (META_LATER_CHECK_FULLSCREEN,
display->check_fullscreen_later = meta_later_add (
META_LATER_CHECK_FULLSCREEN,
check_fullscreen_func,
display, NULL);
}
@ -3544,7 +3589,8 @@ meta_display_get_monitor_geometry (MetaDisplay *display,
* You can get notification when this changes by connecting to
* MetaDisplay::in-fullscreen-changed.
*
* Returns: %TRUE if there is a fullscreen window covering the specified monitor.
* Returns: %TRUE if there is a fullscreen window covering the specified
*monitor.
*/
gboolean
meta_display_get_monitor_in_fullscreen (MetaDisplay *display,
@ -3568,7 +3614,7 @@ meta_display_get_monitor_in_fullscreen (MetaDisplay *display,
monitor);
/* We use -1 as a flag to mean "not known yet" for notification
purposes */ return logical_monitor->in_fullscreen == TRUE;
* purposes */return logical_monitor->in_fullscreen == TRUE;
}
MetaWindow *

View File

@ -624,7 +624,8 @@ apply_edge_resistance_to_each_side (MetaDisplay *display,
*/
for (i = 0; i < G_N_ELEMENTS (tile_edges); i++)
{
guint horizontal_point = workarea.x + floor (workarea.width * tile_edges[i]);
guint horizontal_point = workarea.x + floor (
workarea.width * tile_edges[i]);
if (ABS (horizontal_point - new_left) < 16)
{

View File

@ -216,7 +216,8 @@ meta_display_handle_event (MetaDisplay *display,
event->type == CLUTTER_PAD_RING ||
event->type == CLUTTER_PAD_STRIP))
{
if (meta_input_settings_handle_pad_event (meta_backend_get_input_settings (backend),
if (meta_input_settings_handle_pad_event (meta_backend_get_input_settings (
backend),
event))
{
bypass_wayland = bypass_clutter = TRUE;
@ -229,7 +230,8 @@ meta_display_handle_event (MetaDisplay *display,
if (source)
{
meta_backend_update_last_device (backend,
clutter_input_device_get_device_id (source));
clutter_input_device_get_device_id (
source));
}
#ifdef HAVE_WAYLAND
@ -239,9 +241,11 @@ meta_display_handle_event (MetaDisplay *display,
compositor = meta_wayland_compositor_get_default ();
if (meta_wayland_tablet_manager_consumes_event (compositor->tablet_manager, event))
if (meta_wayland_tablet_manager_consumes_event (compositor->tablet_manager,
event))
{
meta_wayland_tablet_manager_update_cursor_position (compositor->tablet_manager, event);
meta_wayland_tablet_manager_update_cursor_position (
compositor->tablet_manager, event);
}
else
{
@ -369,7 +373,8 @@ meta_display_handle_event (MetaDisplay *display,
{
if (META_IS_BACKEND_X11 (backend))
{
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (
backend));
meta_verbose ("Allowing events time %u\n",
(unsigned int) event->button.time);
XIAllowEvents (xdisplay, clutter_event_get_device_id (event),

View File

@ -96,7 +96,8 @@ meta_window_ensure_frame (MetaWindow *window)
* we don't want to take that as a withdraw
*/
meta_topic (META_DEBUG_WINDOW_STATE,
"Incrementing unmaps_pending on %s for reparent\n", window->desc);
"Incrementing unmaps_pending on %s for reparent\n",
window->desc);
window->unmaps_pending += 1;
}
@ -132,7 +133,8 @@ meta_window_ensure_frame (MetaWindow *window)
MetaBackend *backend = meta_get_backend ();
if (META_IS_BACKEND_X11 (backend))
{
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
/* Since the backend selects for events on another connection,
* make sure to sync the GTK+ connection to ensure that the
@ -140,7 +142,8 @@ meta_window_ensure_frame (MetaWindow *window)
XSync (x11_display->xdisplay, False);
unsigned char mask_bits[XIMaskLen (XI_LASTEVENT)] = { 0 };
XIEventMask mask = { XIAllMasterDevices, sizeof (mask_bits), mask_bits };
XIEventMask mask =
{ XIAllMasterDevices, sizeof (mask_bits), mask_bits };
XISelectEvents (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()),
frame->xwindow, &mask, 1);
@ -190,7 +193,8 @@ meta_window_destroy_frame (MetaWindow *window)
* by the client.
*/
meta_topic (META_DEBUG_WINDOW_STATE,
"Incrementing unmaps_pending on %s for reparent back to root\n", window->desc);
"Incrementing unmaps_pending on %s for reparent back to root\n",
window->desc);
window->unmaps_pending += 1;
}
meta_stack_tracker_record_add (window->display->stack_tracker,
@ -244,7 +248,7 @@ meta_frame_get_flags (MetaFrame *frame)
if (frame->window->border_only)
{
; /* FIXME this may disable the _function_ as well as decor
/* FIXME this may disable the _function_ as well as decor
* in some cases, which is sort of wrong.
*/
}

View File

@ -199,7 +199,8 @@ key_handler_free (MetaKeyHandler *handler)
}
typedef struct _MetaKeyGrab MetaKeyGrab;
struct _MetaKeyGrab {
struct _MetaKeyGrab
{
char *name;
guint action;
MetaKeyCombo combo;
@ -217,13 +218,13 @@ key_combo_key (MetaResolvedKeyCombo *resolved_combo,
int i)
{
/* On X, keycodes are only 8 bits while libxkbcommon supports 32 bit
keycodes, but since we're using the same XKB keymaps that X uses,
we won't find keycodes bigger than 8 bits in practice. The bits
that mutter cares about in the modifier mask are also all in the
lower 8 bits both on X and clutter key events. This means that we
can use a 32 bit integer to safely concatenate both keycode and
mask and thus making it easy to use them as an index in a
GHashTable. */
* keycodes, but since we're using the same XKB keymaps that X uses,
* we won't find keycodes bigger than 8 bits in practice. The bits
* that mutter cares about in the modifier mask are also all in the
* lower 8 bits both on X and clutter key events. This means that we
* can use a 32 bit integer to safely concatenate both keycode and
* mask and thus making it easy to use them as an index in a
* GHashTable. */
guint32 key = resolved_combo->keycodes[i] & 0xffff;
return (key << 16) | (resolved_combo->mask & 0xffff);
}
@ -237,11 +238,13 @@ reload_modmap (MetaKeyBindingManager *keys)
xkb_mod_mask_t dummy_mask;
/* Modifiers to find. */
struct {
struct
{
const char *name;
xkb_mod_mask_t *mask_p;
xkb_mod_mask_t *virtual_mask_p;
} mods[] = {
} mods[] =
{
{ "ScrollLock", &scroll_lock_mask, &dummy_mask },
{ "Meta", &keys->meta_mask, &keys->virtual_meta_mask },
{ "Hyper", &keys->hyper_mask, &keys->virtual_hyper_mask },
@ -261,7 +264,9 @@ reload_modmap (MetaKeyBindingManager *keys)
{
xkb_mod_mask_t vmodmask = (1 << idx);
xkb_state_update_mask (scratch_state, vmodmask, 0, 0, 0, 0, 0);
*mask_p = xkb_state_serialize_mods (scratch_state, XKB_STATE_MODS_DEPRESSED) & ~vmodmask;
*mask_p = xkb_state_serialize_mods (scratch_state,
XKB_STATE_MODS_DEPRESSED) &
~vmodmask;
*virtual_mask_p = vmodmask;
}
else
@ -294,7 +299,8 @@ is_keycode_for_keysym (struct xkb_keymap *keymap,
const xkb_keysym_t *syms;
int num_syms, k;
num_syms = xkb_keymap_key_get_syms_by_level (keymap, keycode, layout, level, &syms);
num_syms = xkb_keymap_key_get_syms_by_level (keymap, keycode, layout, level,
&syms);
for (k = 0; k < num_syms; k++)
{
if (syms[k] == keysym)
@ -430,7 +436,8 @@ calculate_n_layout_levels (struct xkb_keymap *keymap,
xkb_layout_index_t layout_index)
{
CalculateLayoutLevelState state = {
CalculateLayoutLevelState state =
{
.keymap = keymap,
.layout_index = layout_index,
@ -457,7 +464,8 @@ reload_iso_next_group_combos (MetaKeyBindingManager *keys)
if (iso_next_group_option == NULL)
return;
get_keycodes_for_keysym (keys, XKB_KEY_ISO_Next_Group, keys->iso_next_group_combo);
get_keycodes_for_keysym (keys, XKB_KEY_ISO_Next_Group,
keys->iso_next_group_combo);
if (keys->iso_next_group_combo[0].len == 0)
return;
@ -594,7 +602,6 @@ resolve_key_combo (MetaKeyBindingManager *keys,
MetaKeyCombo *combo,
MetaResolvedKeyCombo *resolved_combo)
{
resolved_key_combo_reset (resolved_combo);
if (combo->keysym != 0)
@ -664,7 +671,8 @@ find_latin_keysym (struct xkb_keymap *keymap,
static gboolean
needs_secondary_layout (MetaKeyBindingKeyboardLayout *layout)
{
gboolean required_keysyms_found[] = {
gboolean required_keysyms_found[] =
{
FALSE, /* XKB_KEY_a */
FALSE, /* XKB_KEY_b */
FALSE, /* XKB_KEY_c */
@ -692,7 +700,8 @@ needs_secondary_layout (MetaKeyBindingKeyboardLayout *layout)
FALSE, /* XKB_KEY_y */
FALSE, /* XKB_KEY_z */
};
FindLatinKeysymsState state = {
FindLatinKeysymsState state =
{
.layout = layout,
.required_keysyms_found = required_keysyms_found,
.n_required_keysyms = G_N_ELEMENTS (required_keysyms_found),
@ -713,7 +722,9 @@ clear_active_keyboard_layouts (MetaKeyBindingManager *keys)
MetaKeyBindingKeyboardLayout *layout = &keys->active_layouts[i];
g_clear_pointer (&layout->keymap, xkb_keymap_unref);
*layout = (MetaKeyBindingKeyboardLayout) { 0 };
*layout = (MetaKeyBindingKeyboardLayout) {
0
};
}
}
@ -731,7 +742,8 @@ create_us_layout (void)
names.options = "";
context = xkb_context_new (XKB_CONTEXT_NO_FLAGS);
keymap = xkb_keymap_new_from_names (context, &names, XKB_KEYMAP_COMPILE_NO_FLAGS);
keymap = xkb_keymap_new_from_names (context, &names,
XKB_KEYMAP_COMPILE_NO_FLAGS);
xkb_context_unref (context);
return (MetaKeyBindingKeyboardLayout) {
@ -781,7 +793,8 @@ reload_combos (MetaKeyBindingManager *keys)
reload_iso_next_group_combos (keys);
g_hash_table_foreach (keys->key_bindings, binding_reload_combos_foreach, keys);
g_hash_table_foreach (keys->key_bindings, binding_reload_combos_foreach,
keys);
}
static void
@ -993,9 +1006,11 @@ add_builtin_keybinding (MetaDisplay *display,
*
* Add a keybinding at runtime. The key @name in @schema needs to be of
* type %G_VARIANT_TYPE_STRING_ARRAY, with each string describing a
* keybinding in the form of "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1". The parser
* keybinding in the form of "&lt;Control&gt;a" or "&lt;Shift&gt;&lt;Alt&gt;F1".
*The parser
* is fairly liberal and allows lower or upper case, and also abbreviations
* such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;". If the key is set to the empty list or a
* such as "&lt;Ctl&gt;" and "&lt;Ctrl&gt;". If the key is set to the empty list
*or a
* list with a single element of either "" or "disabled", the keybinding is
* disabled.
*
@ -1136,16 +1151,20 @@ calc_grab_modifiers (MetaKeyBindingManager *keys,
GArray *mods_array = g_array_new (FALSE, TRUE, sizeof (XIGrabModifiers));
/* The X server crashes if XIAnyModifier gets passed in with any
other bits. It doesn't make sense to ask for a grab of
XIAnyModifier plus other bits anyway so we avoid that. */
* other bits. It doesn't make sense to ask for a grab of
* XIAnyModifier plus other bits anyway so we avoid that. */
if (modmask & XIAnyModifier)
{
mods = (XIGrabModifiers) { XIAnyModifier, 0 };
mods = (XIGrabModifiers) {
XIAnyModifier, 0
};
g_array_append_val (mods_array, mods);
return mods_array;
}
mods = (XIGrabModifiers) { modmask, 0 };
mods = (XIGrabModifiers) {
modmask, 0
};
g_array_append_val (mods_array, mods);
for (ignored_mask = 1;
@ -1154,7 +1173,9 @@ calc_grab_modifiers (MetaKeyBindingManager *keys,
{
if (ignored_mask & keys->ignored_modifier_mask)
{
mods = (XIGrabModifiers) { modmask | ignored_mask, 0 };
mods = (XIGrabModifiers) {
modmask | ignored_mask, 0
};
g_array_append_val (mods_array, mods);
}
}
@ -1448,7 +1469,8 @@ change_keygrab_foreach (gpointer key,
{
ChangeKeygrabData *data = user_data;
MetaKeyBinding *binding = value;
gboolean binding_is_per_window = (binding->flags & META_KEY_BINDING_PER_WINDOW) != 0;
gboolean binding_is_per_window =
(binding->flags & META_KEY_BINDING_PER_WINDOW) != 0;
if (data->only_per_window != binding_is_per_window)
return;
@ -1456,7 +1478,8 @@ change_keygrab_foreach (gpointer key,
if (binding->resolved_combo.len == 0)
return;
meta_change_keygrab (data->keys, data->xwindow, data->grab, &binding->resolved_combo);
meta_change_keygrab (data->keys, data->xwindow, data->grab,
&binding->resolved_combo);
}
static void
@ -1622,7 +1645,8 @@ meta_display_grab_accelerator (MetaDisplay *display,
return META_KEYBINDING_ACTION_NONE;
}
meta_change_keygrab (keys, display->x11_display->xroot, TRUE, &resolved_combo);
meta_change_keygrab (keys, display->x11_display->xroot, TRUE,
&resolved_combo);
grab = g_new0 (MetaKeyGrab, 1);
grab->action = next_dynamic_keybinding_action ();
@ -1672,7 +1696,8 @@ meta_display_ungrab_accelerator (MetaDisplay *display,
for (i = 0; i < binding->resolved_combo.len; i++)
{
guint32 index_key = key_combo_key (&binding->resolved_combo, i);
g_hash_table_remove (keys->key_bindings_index, GINT_TO_POINTER (index_key));
g_hash_table_remove (keys->key_bindings_index,
GINT_TO_POINTER (index_key));
}
g_hash_table_remove (keys->key_bindings, binding);
@ -1819,7 +1844,8 @@ meta_display_unfreeze_keyboard (MetaDisplay *display, guint32 timestamp)
if (!META_IS_BACKEND_X11 (backend))
return;
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XIAllowEvents (xdisplay, META_VIRTUAL_CORE_KEYBOARD_ID,
XIAsyncDevice, timestamp);
@ -1999,7 +2025,8 @@ process_overlay_key (MetaDisplay *display,
if (xdisplay)
XIAllowEvents (xdisplay,
clutter_input_device_get_device_id (event->device),
clutter_input_device_get_device_id (
event->device),
XIAsyncDevice, event->time);
}
else
@ -2008,7 +2035,8 @@ process_overlay_key (MetaDisplay *display,
* per-window key bindings or to the application */
if (xdisplay)
XIAllowEvents (xdisplay,
clutter_input_device_get_device_id (event->device),
clutter_input_device_get_device_id (
event->device),
XIReplayDevice, event->time);
return FALSE;
@ -2097,8 +2125,8 @@ process_iso_next_group (MetaDisplay *display,
mask == keys->iso_next_group_combo[i].mask)
{
/* If the signal handler returns TRUE the keyboard will
remain frozen. It's the signal handler's responsibility
to unfreeze it. */
* remain frozen. It's the signal handler's responsibility
* to unfreeze it. */
if (!meta_display_modifiers_accelerator_activate (display))
meta_display_unfreeze_keyboard (display, event->time);
activate = TRUE;
@ -2135,7 +2163,8 @@ process_key_event (MetaDisplay *display,
MetaBackend *backend = meta_get_backend ();
if (META_IS_BACKEND_X11 (backend))
{
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
Display *xdisplay =
meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XIAllowEvents (xdisplay,
clutter_input_device_get_device_id (event->device),
XIAsyncDevice, event->time);
@ -2160,20 +2189,23 @@ process_key_event (MetaDisplay *display,
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard move\n");
keep_grab = process_keyboard_move_grab (display, window, event);
keep_grab =
process_keyboard_move_grab (display, window, event);
}
else
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for keyboard resize\n");
keep_grab = process_keyboard_resize_grab (display, window, event);
keep_grab = process_keyboard_resize_grab (display, window,
event);
}
}
else
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Processing event for mouse-only move/resize\n");
keep_grab = process_mouse_move_resize_grab (display, window, event);
keep_grab =
process_mouse_move_resize_grab (display, window, event);
}
}
if (!keep_grab)
@ -2745,7 +2777,8 @@ handle_switch_to_last_workspace (MetaDisplay *display,
{
MetaWorkspaceManager *workspace_manager = display->workspace_manager;
gint target = meta_workspace_manager_get_n_workspaces (workspace_manager) - 1;
MetaWorkspace *workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, target);
MetaWorkspace *workspace = meta_workspace_manager_get_workspace_by_index (
workspace_manager, target);
meta_workspace_activate (workspace, event->time);
}
@ -2766,12 +2799,14 @@ handle_switch_to_workspace (MetaDisplay *display,
* current workspace.
*/
workspace = meta_workspace_get_neighbor (workspace_manager->active_workspace,
workspace = meta_workspace_get_neighbor (
workspace_manager->active_workspace,
which);
}
else
{
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, which);
workspace = meta_workspace_manager_get_workspace_by_index (
workspace_manager, which);
}
if (workspace)
@ -2987,7 +3022,8 @@ handle_move_to_center (MetaDisplay *display,
meta_window_move_frame (window,
TRUE,
work_area.x + (work_area.width - frame_rect.width) / 2,
work_area.y + (work_area.height - frame_rect.height) / 2);
work_area.y + (work_area.height - frame_rect.height) /
2);
}
static void
@ -3171,7 +3207,8 @@ handle_toggle_tiled (MetaDisplay *display,
if ((META_WINDOW_TILED_LEFT (window) && mode == META_TILE_LEFT) ||
(META_WINDOW_TILED_RIGHT (window) && mode == META_TILE_RIGHT))
{
window->tile_monitor_number = window->saved_maximize ? window->monitor->number
window->tile_monitor_number =
window->saved_maximize ? window->monitor->number
: -1;
window->tile_mode = window->saved_maximize ? META_TILE_MAXIMIZED
: META_TILE_NONE;
@ -3325,7 +3362,8 @@ handle_move_to_workspace_last (MetaDisplay *display,
return;
which = meta_workspace_manager_get_n_workspaces (workspace_manager) - 1;
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, which);
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager,
which);
meta_window_change_workspace (window, workspace);
}
@ -3356,12 +3394,14 @@ handle_move_to_workspace (MetaDisplay *display,
workspace = NULL;
if (flip)
{
workspace = meta_workspace_get_neighbor (workspace_manager->active_workspace,
workspace = meta_workspace_get_neighbor (
workspace_manager->active_workspace,
which);
}
else
{
workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, which);
workspace = meta_workspace_manager_get_workspace_by_index (
workspace_manager, which);
}
if (workspace)
@ -3592,7 +3632,8 @@ init_builtin_key_bindings (MetaDisplay *display)
{
GSettings *common_keybindings = g_settings_new (SCHEMA_COMMON_KEYBINDINGS);
GSettings *mutter_keybindings = g_settings_new (SCHEMA_MUTTER_KEYBINDINGS);
GSettings *mutter_wayland_keybindings = g_settings_new (SCHEMA_MUTTER_WAYLAND_KEYBINDINGS);
GSettings *mutter_wayland_keybindings = g_settings_new (
SCHEMA_MUTTER_WAYLAND_KEYBINDINGS);
add_builtin_keybinding (display,
"switch-to-workspace-1",
@ -3845,7 +3886,8 @@ init_builtin_key_bindings (MetaDisplay *display)
common_keybindings,
META_KEY_BINDING_NONE,
META_KEYBINDING_ACTION_PANEL_RUN_DIALOG,
handle_panel, META_KEYBINDING_ACTION_PANEL_RUN_DIALOG);
handle_panel,
META_KEYBINDING_ACTION_PANEL_RUN_DIALOG);
add_builtin_keybinding (display,
"set-spew-mark",
@ -4383,7 +4425,8 @@ meta_display_init_keys (MetaDisplay *display)
keys->super_mask = 0;
keys->meta_mask = 0;
keys->key_bindings = g_hash_table_new_full (NULL, NULL, NULL, (GDestroyNotify) meta_key_binding_free);
keys->key_bindings = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) meta_key_binding_free);
keys->key_bindings_index = g_hash_table_new (NULL, NULL);
reload_modmap (keys);

View File

@ -178,7 +178,8 @@ static gboolean opt_display_server;
#endif
static gboolean opt_x11;
static GOptionEntry meta_options[] = {
static GOptionEntry meta_options[] =
{
{
"sm-disable", 0, 0, G_OPTION_ARG_NONE,
&opt_disable_sm,
@ -263,7 +264,8 @@ meta_get_option_context (void)
GOptionContext *ctx;
if (setlocale (LC_ALL, "") == NULL)
meta_warning ("Locale not understood by C library, internationalization will not work\n");
meta_warning (
"Locale not understood by C library, internationalization will not work\n");
bindtextdomain (GETTEXT_PACKAGE, MUTTER_LOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
@ -301,7 +303,8 @@ meta_finalize (void)
if (display)
meta_display_close (display,
META_CURRENT_TIME); /* I doubt correct timestamps matter here */
META_CURRENT_TIME); /* I doubt correct timestamps matter
* here */
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
@ -439,7 +442,8 @@ calculate_compositor_configuration (MetaCompositorType *compositor_type,
if ((opt_wayland || opt_nested) && opt_x11)
#endif
{
meta_warning ("Can't run both as Wayland compositor and X11 compositing manager\n");
meta_warning (
"Can't run both as Wayland compositor and X11 compositing manager\n");
meta_exit (META_EXIT_ERROR);
}
@ -592,7 +596,8 @@ meta_init (void)
meta_clutter_init ();
#ifdef HAVE_WAYLAND
/* Bring up Wayland. This also launches Xwayland and sets DISPLAY as well... */
/* Bring up Wayland. This also launches Xwayland and sets DISPLAY as well...
* */
if (meta_is_wayland_compositor ())
meta_wayland_init ();
#endif
@ -627,7 +632,8 @@ meta_init (void)
/**
* meta_register_with_session:
*
* Registers mutter with the session manager. Call this after completing your own
* Registers mutter with the session manager. Call this after completing your
*own
* initialization.
*
* This should be called when the session manager can safely continue to the

View File

@ -229,7 +229,8 @@ accelerator_parse (const gchar *accelerator,
}
else if (len >= 6 && is_modx (accelerator))
{
static const guint mod_vals[] = {
static const guint mod_vals[] =
{
META_VIRTUAL_ALT_MASK,
META_VIRTUAL_MOD2_MASK,
META_VIRTUAL_MOD3_MASK,
@ -299,11 +300,13 @@ accelerator_parse (const gchar *accelerator,
}
else
{
keyval = xkb_keysym_from_name (accelerator, XKB_KEYSYM_CASE_INSENSITIVE);
keyval = xkb_keysym_from_name (accelerator,
XKB_KEYSYM_CASE_INSENSITIVE);
if (keyval == XKB_KEY_NoSymbol)
{
char *with_xf86 = g_strconcat ("XF86", accelerator, NULL);
keyval = xkb_keysym_from_name (with_xf86, XKB_KEYSYM_CASE_INSENSITIVE);
keyval = xkb_keysym_from_name (with_xf86,
XKB_KEYSYM_CASE_INSENSITIVE);
g_free (with_xf86);
if (keyval == XKB_KEY_NoSymbol)
@ -329,7 +332,9 @@ meta_parse_accelerator (const char *accel,
{
g_return_val_if_fail (combo != NULL, FALSE);
*combo = (MetaKeyCombo) { 0 };
*combo = (MetaKeyCombo) {
0
};
if (!accel[0] || strcmp (accel, "disabled") == 0)
return TRUE;

View File

@ -46,7 +46,8 @@ struct _MetaCloseDialogDefault
guint child_watch_id;
};
enum {
enum
{
PROP_0,
PROP_WINDOW,
N_PROPS
@ -72,7 +73,8 @@ dialog_exited (GPid pid,
/* exit status of 0 means the user pressed "Force Quit" */
if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
g_signal_emit_by_name (dialog, "response", META_CLOSE_DIALOG_RESPONSE_FORCE_CLOSE);
g_signal_emit_by_name (dialog, "response",
META_CLOSE_DIALOG_RESPONSE_FORCE_CLOSE);
}
static void

View File

@ -25,7 +25,8 @@
#include "meta/meta-close-dialog.h"
#include "meta/meta-enum-types.h"
enum {
enum
{
RESPONSE,
N_SIGNALS
};
@ -120,7 +121,8 @@ meta_close_dialog_response (MetaCloseDialog *dialog,
gboolean
meta_close_dialog_is_visible (MetaCloseDialog *dialog)
{
return GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (dialog), quark_visible));
return GPOINTER_TO_INT (g_object_get_qdata (G_OBJECT (dialog),
quark_visible));
}
/**

View File

@ -61,7 +61,8 @@ struct _GestureActionData
struct _MetaGestureTrackerPrivate
{
GHashTable *sequences; /* Hashtable of ClutterEventSequence->MetaSequenceInfo */
GHashTable *sequences; /* Hashtable of ClutterEventSequence->MetaSequenceInfo
* */
MetaSequenceState stage_state;
GArray *stage_gestures; /* Array of GestureActionData */
@ -69,7 +70,8 @@ struct _MetaGestureTrackerPrivate
guint autodeny_timeout;
};
enum {
enum
{
PROP_0,
PROP_AUTODENY_TIMEOUT,
PROP_LAST,
@ -77,7 +79,8 @@ enum {
static GParamSpec *obj_props[PROP_LAST];
enum {
enum
{
STATE_CHANGED,
N_SIGNALS
};
@ -88,14 +91,16 @@ static guint signals[N_SIGNALS] = { 0 };
static void meta_gesture_tracker_untrack_stage (MetaGestureTracker *tracker);
G_DEFINE_TYPE_WITH_PRIVATE (MetaGestureTracker, meta_gesture_tracker, G_TYPE_OBJECT)
G_DEFINE_TYPE_WITH_PRIVATE (MetaGestureTracker, meta_gesture_tracker,
G_TYPE_OBJECT)
static void
meta_gesture_tracker_finalize (GObject *object)
{
MetaGestureTrackerPrivate *priv;
priv = meta_gesture_tracker_get_instance_private (META_GESTURE_TRACKER (object));
priv = meta_gesture_tracker_get_instance_private (META_GESTURE_TRACKER (
object));
g_hash_table_destroy (priv->sequences);
g_array_free (priv->stage_gestures, TRUE);
@ -112,7 +117,8 @@ meta_gesture_tracker_set_property (GObject *object,
{
MetaGestureTrackerPrivate *priv;
priv = meta_gesture_tracker_get_instance_private (META_GESTURE_TRACKER (object));
priv = meta_gesture_tracker_get_instance_private (META_GESTURE_TRACKER (
object));
switch (prop_id)
{
@ -133,7 +139,8 @@ meta_gesture_tracker_get_property (GObject *object,
{
MetaGestureTrackerPrivate *priv;
priv = meta_gesture_tracker_get_instance_private (META_GESTURE_TRACKER (object));
priv = meta_gesture_tracker_get_instance_private (META_GESTURE_TRACKER (
object));
switch (prop_id)
{
@ -158,7 +165,8 @@ meta_gesture_tracker_class_init (MetaGestureTrackerClass *klass)
obj_props[PROP_AUTODENY_TIMEOUT] = g_param_spec_uint ("autodeny-timeout",
"Auto-deny timeout",
"Auto-deny timeout",
0, G_MAXUINT, DEFAULT_AUTODENY_TIMEOUT,
0, G_MAXUINT,
DEFAULT_AUTODENY_TIMEOUT,
G_PARAM_STATIC_STRINGS |
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY);
@ -349,7 +357,8 @@ meta_gesture_tracker_init (MetaGestureTracker *tracker)
priv->sequences = g_hash_table_new_full (NULL, NULL, NULL,
(GDestroyNotify) meta_sequence_info_free);
priv->stage_gestures = g_array_new (FALSE, FALSE, sizeof (GestureActionData));
g_array_set_clear_func (priv->stage_gestures, (GDestroyNotify) clear_gesture_data);
g_array_set_clear_func (priv->stage_gestures,
(GDestroyNotify) clear_gesture_data);
}
MetaGestureTracker *
@ -544,7 +553,8 @@ meta_gesture_tracker_set_sequence_state (MetaGestureTracker *tracker,
info->state = state;
g_signal_emit (tracker, signals[STATE_CHANGED], 0, sequence, info->state);
/* If the sequence was denied, set immediately to PENDING_END after emission */
/* If the sequence was denied, set immediately to PENDING_END after emission
* */
if (state == META_SEQUENCE_REJECTED)
{
info->state = META_SEQUENCE_PENDING_END;
@ -561,7 +571,8 @@ meta_gesture_tracker_get_sequence_state (MetaGestureTracker *tracker,
MetaGestureTrackerPrivate *priv;
MetaSequenceInfo *info;
g_return_val_if_fail (META_IS_GESTURE_TRACKER (tracker), META_SEQUENCE_PENDING_END);
g_return_val_if_fail (META_IS_GESTURE_TRACKER (
tracker), META_SEQUENCE_PENDING_END);
priv = meta_gesture_tracker_get_instance_private (tracker);
info = g_hash_table_lookup (priv->sequences, sequence);

View File

@ -25,7 +25,8 @@
#include "core/window-private.h"
#include "meta/meta-inhibit-shortcuts-dialog.h"
typedef struct _MetaInhibitShortcutsDialogDefaultPrivate MetaInhibitShortcutsDialogDefaultPrivate;
typedef struct _MetaInhibitShortcutsDialogDefaultPrivate
MetaInhibitShortcutsDialogDefaultPrivate;
struct _MetaInhibitShortcutsDialogDefault
{
@ -33,25 +34,32 @@ struct _MetaInhibitShortcutsDialogDefault
MetaWindow *window;
};
enum {
enum
{
PROP_0,
PROP_WINDOW,
N_PROPS
};
static void meta_inhibit_shortcuts_dialog_iface_init (MetaInhibitShortcutsDialogInterface *iface);
static void meta_inhibit_shortcuts_dialog_iface_init (
MetaInhibitShortcutsDialogInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaInhibitShortcutsDialogDefault, meta_inhibit_shortcuts_dialog_default,
G_DEFINE_TYPE_WITH_CODE (MetaInhibitShortcutsDialogDefault,
meta_inhibit_shortcuts_dialog_default,
G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (META_TYPE_INHIBIT_SHORTCUTS_DIALOG,
G_IMPLEMENT_INTERFACE (
META_TYPE_INHIBIT_SHORTCUTS_DIALOG,
meta_inhibit_shortcuts_dialog_iface_init))
static void
meta_inhibit_shortcuts_dialog_default_show (MetaInhibitShortcutsDialog *dialog)
{
/* Default to allow shortcuts inhibitor, but complain that no dialog is implemented */
g_warning ("No MetaInhibitShortcutDialog implementation, falling back on allowing");
meta_inhibit_shortcuts_dialog_response (dialog, META_INHIBIT_SHORTCUTS_DIALOG_RESPONSE_ALLOW);
/* Default to allow shortcuts inhibitor, but complain that no dialog is
* implemented */
g_warning (
"No MetaInhibitShortcutDialog implementation, falling back on allowing");
meta_inhibit_shortcuts_dialog_response (dialog,
META_INHIBIT_SHORTCUTS_DIALOG_RESPONSE_ALLOW);
}
static void
@ -60,7 +68,8 @@ meta_inhibit_shortcuts_dialog_default_hide (MetaInhibitShortcutsDialog *dialog)
}
static void
meta_inhibit_shortcuts_dialog_iface_init (MetaInhibitShortcutsDialogInterface *iface)
meta_inhibit_shortcuts_dialog_iface_init (
MetaInhibitShortcutsDialogInterface *iface)
{
iface->show = meta_inhibit_shortcuts_dialog_default_show;
iface->hide = meta_inhibit_shortcuts_dialog_default_hide;
@ -107,18 +116,22 @@ meta_inhibit_shortcuts_dialog_default_get_property (GObject *object,
}
static void
meta_inhibit_shortcuts_dialog_default_class_init (MetaInhibitShortcutsDialogDefaultClass *klass)
meta_inhibit_shortcuts_dialog_default_class_init (
MetaInhibitShortcutsDialogDefaultClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = meta_inhibit_shortcuts_dialog_default_set_property;
object_class->get_property = meta_inhibit_shortcuts_dialog_default_get_property;
object_class->set_property =
meta_inhibit_shortcuts_dialog_default_set_property;
object_class->get_property =
meta_inhibit_shortcuts_dialog_default_get_property;
g_object_class_override_property (object_class, PROP_WINDOW, "window");
}
static void
meta_inhibit_shortcuts_dialog_default_init (MetaInhibitShortcutsDialogDefault *dialog)
meta_inhibit_shortcuts_dialog_default_init (
MetaInhibitShortcutsDialogDefault *dialog)
{
}

View File

@ -30,10 +30,12 @@ enum
static guint inhibit_dialog_signals[LAST_SIGNAL] = { 0, };
G_DEFINE_INTERFACE (MetaInhibitShortcutsDialog, meta_inhibit_shortcuts_dialog, G_TYPE_OBJECT)
G_DEFINE_INTERFACE (MetaInhibitShortcutsDialog, meta_inhibit_shortcuts_dialog,
G_TYPE_OBJECT)
static void
meta_inhibit_shortcuts_dialog_default_init (MetaInhibitShortcutsDialogInterface *iface)
meta_inhibit_shortcuts_dialog_default_init (
MetaInhibitShortcutsDialogInterface *iface)
{
g_object_interface_install_property (iface,
g_param_spec_object ("window",
@ -41,7 +43,8 @@ meta_inhibit_shortcuts_dialog_default_init (MetaInhibitShortcutsDialogInterface
"Window",
META_TYPE_WINDOW,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_CONSTRUCT_ONLY
|
G_PARAM_STATIC_STRINGS));
inhibit_dialog_signals[RESPONSE] =
g_signal_new ("response",
@ -95,7 +98,8 @@ meta_inhibit_shortcuts_dialog_hide (MetaInhibitShortcutsDialog *dialog)
* implementations.
**/
void
meta_inhibit_shortcuts_dialog_response (MetaInhibitShortcutsDialog *dialog,
meta_inhibit_shortcuts_dialog_response (
MetaInhibitShortcutsDialog *dialog,
MetaInhibitShortcutsDialogResponse response)
{
g_signal_emit (dialog, inhibit_dialog_signals[RESPONSE], 0, response);

View File

@ -46,7 +46,8 @@ enum
LAST_SIGNAL
};
enum {
enum
{
PROP_0,
PROP_N_WORKSPACES
@ -68,7 +69,9 @@ meta_workspace_manager_get_property (GObject *object,
switch (prop_id)
{
case PROP_N_WORKSPACES:
g_value_set_int (value, meta_workspace_manager_get_n_workspaces (workspace_manager));
g_value_set_int (value,
meta_workspace_manager_get_n_workspaces (
workspace_manager));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -168,7 +171,8 @@ meta_workspace_manager_init (MetaWorkspaceManager *workspace_manager)
}
void
meta_workspace_manager_reload_work_areas (MetaWorkspaceManager *workspace_manager)
meta_workspace_manager_reload_work_areas (
MetaWorkspaceManager *workspace_manager)
{
GList *l;
@ -231,9 +235,11 @@ meta_workspace_manager_init_workspaces (MetaWorkspaceManager *workspace_manager)
else
num = meta_prefs_get_num_workspaces ();
meta_workspace_manager_update_num_workspaces (workspace_manager, META_CURRENT_TIME, num);
meta_workspace_manager_update_num_workspaces (workspace_manager,
META_CURRENT_TIME, num);
meta_workspace_activate (workspace_manager->workspaces->data, META_CURRENT_TIME);
meta_workspace_activate (workspace_manager->workspaces->data,
META_CURRENT_TIME);
meta_workspace_manager_reload_work_areas (workspace_manager);
}
@ -249,22 +255,26 @@ meta_workspace_manager_get_n_workspaces (MetaWorkspaceManager *workspace_manager
* @workspace_manager: a #MetaWorkspaceManager
* @index: index of one of the display's workspaces
*
* Gets the workspace object for one of a workspace manager's workspaces given the workspace
* Gets the workspace object for one of a workspace manager's workspaces given
*the workspace
* index. It's valid to call this function with an out-of-range index and it
* will robustly return %NULL.
*
* Return value: (transfer none): the workspace object with specified index, or %NULL
* Return value: (transfer none): the workspace object with specified index, or
*%NULL
* if the index is out of range.
*/
MetaWorkspace *
meta_workspace_manager_get_workspace_by_index (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_get_workspace_by_index (
MetaWorkspaceManager *workspace_manager,
int idx)
{
return g_list_nth_data (workspace_manager->workspaces, idx);
}
void
meta_workspace_manager_remove_workspace (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_remove_workspace (
MetaWorkspaceManager *workspace_manager,
MetaWorkspace *workspace,
guint32 timestamp)
{
@ -299,7 +309,8 @@ meta_workspace_manager_remove_workspace (MetaWorkspaceManager *workspace_manager
/* To emit the signal after removing the workspace */
index = meta_workspace_index (workspace);
active_index = meta_workspace_manager_get_active_workspace_index (workspace_manager);
active_index = meta_workspace_manager_get_active_workspace_index (
workspace_manager);
active_index_changed = index < active_index;
/* This also removes the workspace from the displays list */
@ -339,13 +350,15 @@ meta_workspace_manager_remove_workspace (MetaWorkspaceManager *workspace_manager
* focusing a window on the new workspace. (Doesn't hurt to pass a valid
* timestamp when available even if not switching workspaces.)
*
* Append a new workspace to the workspace manager and (optionally) switch to that
* Append a new workspace to the workspace manager and (optionally) switch to
*that
* display.
*
* Return value: (transfer none): the newly appended workspace.
*/
MetaWorkspace *
meta_workspace_manager_append_new_workspace (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_append_new_workspace (
MetaWorkspaceManager *workspace_manager,
gboolean activate,
guint32 timestamp)
{
@ -376,7 +389,8 @@ meta_workspace_manager_append_new_workspace (MetaWorkspaceManager *workspace_man
}
void
meta_workspace_manager_update_num_workspaces (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_update_num_workspaces (
MetaWorkspaceManager *workspace_manager,
guint32 timestamp,
int new_num)
{
@ -450,7 +464,8 @@ meta_workspace_manager_update_num_workspaces (MetaWorkspaceManager *workspace_ma
}
void
meta_workspace_manager_update_workspace_layout (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_update_workspace_layout (
MetaWorkspaceManager *workspace_manager,
MetaDisplayCorner starting_corner,
gboolean vertical_layout,
int n_rows,
@ -468,7 +483,8 @@ meta_workspace_manager_update_workspace_layout (MetaWorkspaceManager *workspace_
workspace_manager->rows_of_workspaces = n_rows;
workspace_manager->columns_of_workspaces = n_columns;
meta_verbose ("Workspace layout rows = %d cols = %d orientation = %d starting corner = %u\n",
meta_verbose (
"Workspace layout rows = %d cols = %d orientation = %d starting corner = %u\n",
workspace_manager->rows_of_workspaces,
workspace_manager->columns_of_workspaces,
workspace_manager->vertical_workspaces,
@ -479,17 +495,22 @@ meta_workspace_manager_update_workspace_layout (MetaWorkspaceManager *workspace_
* meta_workspace_manager_override_workspace_layout:
* @workspace_manager: a #MetaWorkspaceManager
* @starting_corner: the corner at which the first workspace is found
* @vertical_layout: if %TRUE the workspaces are laid out in columns rather than rows
* @n_rows: number of rows of workspaces, or -1 to determine the number of rows from
* @vertical_layout: if %TRUE the workspaces are laid out in columns rather than
*rows
* @n_rows: number of rows of workspaces, or -1 to determine the number of rows
*from
* @n_columns and the total number of workspaces
* @n_columns: number of columns of workspaces, or -1 to determine the number of columns from
* @n_columns: number of columns of workspaces, or -1 to determine the number of
*columns from
* @n_rows and the total number of workspaces
*
* Explicitly set the layout of workspaces. Once this has been called, the contents of the
* Explicitly set the layout of workspaces. Once this has been called, the
*contents of the
* _NET_DESKTOP_LAYOUT property on the root window are completely ignored.
*/
void
meta_workspace_manager_override_workspace_layout (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_override_workspace_layout (
MetaWorkspaceManager *workspace_manager,
MetaDisplayCorner starting_corner,
gboolean vertical_layout,
int n_rows,
@ -527,7 +548,8 @@ meta_workspace_manager_corner_to_string (MetaDisplayCorner corner)
#endif /* WITH_VERBOSE_MODE */
void
meta_workspace_manager_calc_workspace_layout (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_calc_workspace_layout (
MetaWorkspaceManager *workspace_manager,
int num_workspaces,
int current_space,
MetaWorkspaceLayout *layout)
@ -562,7 +584,8 @@ meta_workspace_manager_calc_workspace_layout (MetaWorkspaceManager *workspace_ma
"num_spaces = %d vertical = %s corner = %s\n",
rows, cols, current_space, num_workspaces,
workspace_manager->vertical_workspaces ? "(true)" : "(false)",
meta_workspace_manager_corner_to_string (workspace_manager->starting_corner));
meta_workspace_manager_corner_to_string (workspace_manager->
starting_corner));
/* ok, we want to setup the distances in the workspace array to go
* in each direction. Remember, there are many ways that a workspace
@ -810,7 +833,8 @@ queue_windows_showing (MetaWorkspaceManager *workspace_manager)
* active_workspace's window list, because the active_workspace's
* window list may not contain the on_all_workspace windows.
*/
windows = meta_display_list_windows (workspace_manager->display, META_LIST_DEFAULT);
windows = meta_display_list_windows (workspace_manager->display,
META_LIST_DEFAULT);
for (l = windows; l; l = l->next)
{
@ -823,7 +847,8 @@ queue_windows_showing (MetaWorkspaceManager *workspace_manager)
}
void
meta_workspace_manager_minimize_all_on_active_workspace_except (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_minimize_all_on_active_workspace_except (
MetaWorkspaceManager *workspace_manager,
MetaWindow *keep)
{
GList *l;
@ -888,7 +913,8 @@ meta_workspace_manager_unshow_desktop (MetaWorkspaceManager *workspace_manager)
* meta_workspace_manager_get_workspaces: (skip)
* @workspace_manager: a #MetaWorkspaceManager
*
* Returns: (transfer none) (element-type Meta.Workspace): The workspaces for @display
* Returns: (transfer none) (element-type Meta.Workspace): The workspaces for
*@display
*/
GList *
meta_workspace_manager_get_workspaces (MetaWorkspaceManager *workspace_manager)
@ -897,7 +923,8 @@ meta_workspace_manager_get_workspaces (MetaWorkspaceManager *workspace_manager)
}
int
meta_workspace_manager_get_active_workspace_index (MetaWorkspaceManager *workspace_manager)
meta_workspace_manager_get_active_workspace_index (
MetaWorkspaceManager *workspace_manager)
{
MetaWorkspace *active = workspace_manager->active_workspace;
@ -914,13 +941,15 @@ meta_workspace_manager_get_active_workspace_index (MetaWorkspaceManager *workspa
* Returns: (transfer none): The current workspace
*/
MetaWorkspace *
meta_workspace_manager_get_active_workspace (MetaWorkspaceManager *workspace_manager)
meta_workspace_manager_get_active_workspace (
MetaWorkspaceManager *workspace_manager)
{
return workspace_manager->active_workspace;
}
void
meta_workspace_manager_workspace_switched (MetaWorkspaceManager *workspace_manager,
meta_workspace_manager_workspace_switched (
MetaWorkspaceManager *workspace_manager,
int from,
int to,
MetaMotionDirection direction)

View File

@ -45,7 +45,8 @@ print_version (const gchar *option_name,
static const char *plugin = "libdefault";
GOptionEntry mutter_options[] = {
GOptionEntry mutter_options[] =
{
{
"version", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
print_version,

View File

@ -150,7 +150,8 @@ find_next_cascade (MetaWindow *window,
{
meta_window_get_titlebar_rect (w, &titlebar_rect);
/* Cascade the window evenly by the titlebar height; this isn't a typo. */
/* Cascade the window evenly by the titlebar height; this isn't a
* typo. */
cascade_x = wx + titlebar_rect.height;
cascade_y = wy + titlebar_rect.height;
@ -725,7 +726,8 @@ meta_window_place (MetaWindow *window,
{
/* don't constrain with placement algorithm */
meta_topic (META_DEBUG_PLACEMENT,
"Honoring USPosition for %s instead of using placement algorithm\n", window->desc);
"Honoring USPosition for %s instead of using placement algorithm\n",
window->desc);
goto done;
}
@ -798,7 +800,8 @@ meta_window_place (MetaWindow *window,
*/
y += (parent_frame_rect.height - frame_rect.height) / 3;
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s over transient parent\n",
meta_topic (META_DEBUG_PLACEMENT,
"Centered window %s over transient parent\n",
window->desc);
avoid_being_obscured_as_second_modal_dialog (window, &x, &y);
@ -845,7 +848,8 @@ meta_window_place (MetaWindow *window,
GSList *all_windows;
GSList *tmp;
all_windows = meta_display_list_windows (window->display, META_LIST_DEFAULT);
all_windows =
meta_display_list_windows (window->display, META_LIST_DEFAULT);
tmp = all_windows;
while (tmp != NULL)
@ -885,7 +889,8 @@ meta_window_place (MetaWindow *window,
/* If the window is bigger than the screen, then automaximize. Do NOT
* auto-maximize the directions independently. See #419810.
*/
if (frame_rect.width >= workarea.width && frame_rect.height >= workarea.height)
if (frame_rect.width >= workarea.width &&
frame_rect.height >= workarea.height)
{
window->maximize_horizontally_after_placement = TRUE;
window->maximize_vertically_after_placement = TRUE;

View File

@ -82,14 +82,18 @@ static PangoFontDescription *titlebar_font = NULL;
static MetaVirtualModifier mouse_button_mods = Mod1Mask;
static MetaKeyCombo overlay_key_combo = { 0, 0, 0 };
static GDesktopFocusMode focus_mode = G_DESKTOP_FOCUS_MODE_CLICK;
static GDesktopFocusNewWindows focus_new_windows = G_DESKTOP_FOCUS_NEW_WINDOWS_SMART;
static GDesktopFocusNewWindows focus_new_windows =
G_DESKTOP_FOCUS_NEW_WINDOWS_SMART;
static gboolean raise_on_click = TRUE;
static gboolean center_new_windows = FALSE;
static gboolean attach_modal_dialogs = FALSE;
static int num_workspaces = 4;
static GDesktopTitlebarAction action_double_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE;
static GDesktopTitlebarAction action_middle_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_LOWER;
static GDesktopTitlebarAction action_right_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_MENU;
static GDesktopTitlebarAction action_double_click_titlebar =
G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE;
static GDesktopTitlebarAction action_middle_click_titlebar =
G_DESKTOP_TITLEBAR_ACTION_LOWER;
static GDesktopTitlebarAction action_right_click_titlebar =
G_DESKTOP_TITLEBAR_ACTION_MENU;
static gboolean dynamic_workspaces = FALSE;
static gboolean disable_workarounds = FALSE;
static gboolean auto_raise = FALSE;
@ -114,7 +118,8 @@ static gboolean ignore_request_hide_titlebar = FALSE;
static gboolean auto_maximize = TRUE;
static gboolean show_fallback_app_menu = FALSE;
static GDesktopVisualBellType visual_bell_type = G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH;
static GDesktopVisualBellType visual_bell_type =
G_DESKTOP_VISUAL_BELL_FULLSCREEN_FLASH;
static MetaButtonLayout button_layout;
/* NULL-terminated array */
@ -227,43 +232,37 @@ static MetaEnumPreference preferences_enum[] =
{
{ "focus-new-windows",
SCHEMA_GENERAL,
META_PREF_FOCUS_NEW_WINDOWS,
},
META_PREF_FOCUS_NEW_WINDOWS, },
&focus_new_windows,
},
{
{ "focus-mode",
SCHEMA_GENERAL,
META_PREF_FOCUS_MODE,
},
META_PREF_FOCUS_MODE, },
&focus_mode,
},
{
{ "visual-bell-type",
SCHEMA_GENERAL,
META_PREF_VISUAL_BELL_TYPE,
},
META_PREF_VISUAL_BELL_TYPE, },
&visual_bell_type,
},
{
{ "action-double-click-titlebar",
SCHEMA_GENERAL,
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
},
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR, },
&action_double_click_titlebar,
},
{
{ "action-middle-click-titlebar",
SCHEMA_GENERAL,
META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
},
META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR, },
&action_middle_click_titlebar,
},
{
{ "action-right-click-titlebar",
SCHEMA_GENERAL,
META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
},
META_PREF_ACTION_RIGHT_CLICK_TITLEBAR, },
&action_right_click_titlebar,
},
{ { NULL, 0, 0 }, NULL },
@ -274,22 +273,19 @@ static MetaBoolPreference preferences_bool[] =
{
{ "attach-modal-dialogs",
SCHEMA_MUTTER,
META_PREF_ATTACH_MODAL_DIALOGS,
},
META_PREF_ATTACH_MODAL_DIALOGS, },
&attach_modal_dialogs,
},
{
{ "center-new-windows",
SCHEMA_MUTTER,
META_PREF_CENTER_NEW_WINDOWS,
},
META_PREF_CENTER_NEW_WINDOWS, },
&center_new_windows,
},
{
{ "raise-on-click",
SCHEMA_GENERAL,
META_PREF_RAISE_ON_CLICK,
},
META_PREF_RAISE_ON_CLICK, },
&raise_on_click,
},
{
@ -302,85 +298,73 @@ static MetaBoolPreference preferences_bool[] =
{
{ "dynamic-workspaces",
SCHEMA_MUTTER,
META_PREF_DYNAMIC_WORKSPACES,
},
META_PREF_DYNAMIC_WORKSPACES, },
&dynamic_workspaces,
},
{
{ "disable-workarounds",
SCHEMA_GENERAL,
META_PREF_DISABLE_WORKAROUNDS,
},
META_PREF_DISABLE_WORKAROUNDS, },
&disable_workarounds,
},
{
{ "auto-raise",
SCHEMA_GENERAL,
META_PREF_AUTO_RAISE,
},
META_PREF_AUTO_RAISE, },
&auto_raise,
},
{
{ "focus-change-on-pointer-rest",
SCHEMA_MUTTER,
META_PREF_FOCUS_CHANGE_ON_POINTER_REST,
},
META_PREF_FOCUS_CHANGE_ON_POINTER_REST, },
&focus_change_on_pointer_rest
},
{
{ "visual-bell",
SCHEMA_GENERAL,
META_PREF_VISUAL_BELL,
},
META_PREF_VISUAL_BELL, },
&bell_is_visible, /* FIXME: change the name: it's confusing */
},
{
{ "audible-bell",
SCHEMA_GENERAL,
META_PREF_AUDIBLE_BELL,
},
META_PREF_AUDIBLE_BELL, },
&bell_is_audible, /* FIXME: change the name: it's confusing */
},
{
{ KEY_GNOME_ACCESSIBILITY,
SCHEMA_INTERFACE,
META_PREF_GNOME_ACCESSIBILITY,
},
META_PREF_GNOME_ACCESSIBILITY, },
&gnome_accessibility,
},
{
{ KEY_GNOME_ANIMATIONS,
SCHEMA_INTERFACE,
META_PREF_GNOME_ANIMATIONS,
},
META_PREF_GNOME_ANIMATIONS, },
&gnome_animations,
},
{
{ "resize-with-right-button",
SCHEMA_GENERAL,
META_PREF_RESIZE_WITH_RIGHT_BUTTON,
},
META_PREF_RESIZE_WITH_RIGHT_BUTTON, },
&resize_with_right_button,
},
{
{ "edge-tiling",
SCHEMA_MUTTER,
META_PREF_EDGE_TILING,
},
META_PREF_EDGE_TILING, },
&edge_tiling,
},
{
{ "workspaces-only-on-primary",
SCHEMA_MUTTER,
META_PREF_WORKSPACES_ONLY_ON_PRIMARY,
},
META_PREF_WORKSPACES_ONLY_ON_PRIMARY, },
&workspaces_only_on_primary,
},
{
{ "auto-maximize",
SCHEMA_MUTTER,
META_PREF_AUTO_MAXIMIZE,
},
META_PREF_AUTO_MAXIMIZE, },
&auto_maximize,
},
{ { NULL, 0, 0 }, NULL },
@ -391,40 +375,35 @@ static MetaStringPreference preferences_string[] =
{
{ "mouse-button-modifier",
SCHEMA_GENERAL,
META_PREF_MOUSE_BUTTON_MODS,
},
META_PREF_MOUSE_BUTTON_MODS, },
mouse_button_mods_handler,
NULL,
},
{
{ KEY_TITLEBAR_FONT,
SCHEMA_GENERAL,
META_PREF_TITLEBAR_FONT,
},
META_PREF_TITLEBAR_FONT, },
titlebar_handler,
NULL,
},
{
{ "button-layout",
SCHEMA_GENERAL,
META_PREF_BUTTON_LAYOUT,
},
META_PREF_BUTTON_LAYOUT, },
button_layout_handler,
NULL,
},
{
{ "cursor-theme",
SCHEMA_INTERFACE,
META_PREF_CURSOR_THEME,
},
META_PREF_CURSOR_THEME, },
NULL,
&cursor_theme,
},
{
{ "overlay-key",
SCHEMA_MUTTER,
META_PREF_KEYBINDINGS,
},
META_PREF_KEYBINDINGS, },
overlay_key_handler,
NULL,
},
@ -436,16 +415,14 @@ static MetaStringArrayPreference preferences_string_array[] =
{
{ KEY_WORKSPACE_NAMES,
SCHEMA_GENERAL,
META_PREF_WORKSPACE_NAMES,
},
META_PREF_WORKSPACE_NAMES, },
NULL,
&workspace_names,
},
{
{ KEY_XKB_OPTIONS,
SCHEMA_INPUT_SOURCES,
META_PREF_KEYBINDINGS,
},
META_PREF_KEYBINDINGS, },
iso_next_group_handler,
NULL,
},
@ -457,36 +434,31 @@ static MetaIntPreference preferences_int[] =
{
{ KEY_NUM_WORKSPACES,
SCHEMA_GENERAL,
META_PREF_NUM_WORKSPACES,
},
META_PREF_NUM_WORKSPACES, },
&num_workspaces
},
{
{ "auto-raise-delay",
SCHEMA_GENERAL,
META_PREF_AUTO_RAISE_DELAY,
},
META_PREF_AUTO_RAISE_DELAY, },
&auto_raise_delay
},
{
{ "draggable-border-width",
SCHEMA_MUTTER,
META_PREF_DRAGGABLE_BORDER_WIDTH,
},
META_PREF_DRAGGABLE_BORDER_WIDTH, },
&draggable_border_width
},
{
{ "drag-threshold",
SCHEMA_MOUSE,
META_PREF_DRAG_THRESHOLD,
},
META_PREF_DRAG_THRESHOLD, },
&drag_threshold
},
{
{ "cursor-size",
SCHEMA_INTERFACE,
META_PREF_CURSOR_SIZE,
},
META_PREF_CURSOR_SIZE, },
&cursor_size
},
{ { NULL, 0, 0 }, NULL },
@ -956,7 +928,8 @@ meta_prefs_init (void)
settings = g_settings_new (SCHEMA_INPUT_SOURCES);
g_signal_connect (settings, "changed::" KEY_XKB_OPTIONS,
G_CALLBACK (settings_changed), NULL);
g_hash_table_insert (settings_schemas, g_strdup (SCHEMA_INPUT_SOURCES), settings);
g_hash_table_insert (settings_schemas, g_strdup (
SCHEMA_INPUT_SOURCES), settings);
/* Pick up initial values. */
@ -1027,7 +1000,6 @@ settings_changed (GSettings *settings,
while (cursor->base.key != NULL)
{
if (strcmp (key, cursor->base.key) == 0)
found_enum = TRUE;
@ -1328,7 +1300,8 @@ button_layout_handler (GVariant *value,
}
else
{
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
meta_topic (META_DEBUG_PREFS,
"Ignoring unknown or already-used button name \"%s\"\n",
buttons[b]);
}
}
@ -1379,7 +1352,8 @@ button_layout_handler (GVariant *value,
}
else
{
meta_topic (META_DEBUG_PREFS, "Ignoring unknown or already-used button name \"%s\"\n",
meta_topic (META_DEBUG_PREFS,
"Ignoring unknown or already-used button name \"%s\"\n",
buttons[b]);
}
}
@ -1404,14 +1378,19 @@ button_layout_handler (GVariant *value,
MetaButtonLayout rtl_layout;
int j;
for (i = 0; new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST; i++);
for (i = 0; new_layout.left_buttons[i] != META_BUTTON_FUNCTION_LAST; i++)
;
for (j = 0; j < i; j++)
{
rtl_layout.right_buttons[j] = new_layout.left_buttons[i - j - 1];
if (j == 0)
rtl_layout.right_buttons_has_spacer[i - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
rtl_layout.right_buttons_has_spacer[i -
1] =
new_layout.left_buttons_has_spacer[i - j - 1];
else
rtl_layout.right_buttons_has_spacer[j - 1] = new_layout.left_buttons_has_spacer[i - j - 1];
rtl_layout.right_buttons_has_spacer[j -
1] =
new_layout.left_buttons_has_spacer[i - j - 1];
}
for (; j < MAX_BUTTONS_PER_CORNER; j++)
{
@ -1419,14 +1398,19 @@ button_layout_handler (GVariant *value,
rtl_layout.right_buttons_has_spacer[j] = FALSE;
}
for (i = 0; new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++);
for (i = 0; new_layout.right_buttons[i] != META_BUTTON_FUNCTION_LAST; i++)
;
for (j = 0; j < i; j++)
{
rtl_layout.left_buttons[j] = new_layout.right_buttons[i - j - 1];
if (j == 0)
rtl_layout.left_buttons_has_spacer[i - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
rtl_layout.left_buttons_has_spacer[i -
1] =
new_layout.right_buttons_has_spacer[i - j - 1];
else
rtl_layout.left_buttons_has_spacer[j - 1] = new_layout.right_buttons_has_spacer[i - j - 1];
rtl_layout.left_buttons_has_spacer[j -
1] =
new_layout.right_buttons_has_spacer[i - j - 1];
}
for (; j < MAX_BUTTONS_PER_CORNER; j++)
{
@ -1719,13 +1703,15 @@ update_binding (MetaKeyPref *binding,
{
meta_topic (META_DEBUG_KEYBINDINGS,
"Failed to parse new GSettings value\n");
meta_warning ("\"%s\" found in configuration database is not a valid value for keybinding \"%s\"\n",
meta_warning (
"\"%s\" found in configuration database is not a valid value for keybinding \"%s\"\n",
strokes[i], binding->name);
g_free (combo);
/* Value is kept and will thus be removed next time we save the key.
* Changing the key in response to a modification could lead to cyclic calls. */
* Changing the key in response to a modification could lead to cyclic
*calls. */
continue;
}
@ -1904,7 +1890,9 @@ meta_prefs_add_keybinding (const char *name,
{
id = g_signal_connect (settings, "changed",
G_CALLBACK (bindings_changed), NULL);
g_object_set_data (G_OBJECT (settings), "changed-signal", GUINT_TO_POINTER (id));
g_object_set_data (G_OBJECT (
settings), "changed-signal", GUINT_TO_POINTER (
id));
}
}
else

View File

@ -54,7 +54,8 @@ main (int argc,
-100, -100, 1, 1, 0,
0,
InputOnly,
DefaultVisual (display, DefaultScreen (display)),
DefaultVisual (display,
DefaultScreen (display)),
mask, &xwa);
XSetSelectionOwner (display,

Some files were not shown because too many files have changed in this diff Show More