Compare commits
2 Commits
citadel
...
wip/nielsd
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7efb315568 | ||
![]() |
2dfcf8dcac |
112
data/uncrustify.cfg
Normal file
112
data/uncrustify.cfg
Normal 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
|
@ -59,11 +59,11 @@ decode_vendor_and_product_identification (const uchar *edid, MonitorInfo *info)
|
||||
int is_model_year;
|
||||
|
||||
/* Manufacturer Code */
|
||||
info->manufacturer_code[0] = get_bits (edid[0x08], 2, 6);
|
||||
info->manufacturer_code[1] = get_bits (edid[0x08], 0, 1) << 3;
|
||||
info->manufacturer_code[0] = get_bits (edid[0x08], 2, 6);
|
||||
info->manufacturer_code[1] = get_bits (edid[0x08], 0, 1) << 3;
|
||||
info->manufacturer_code[1] |= get_bits (edid[0x09], 5, 7);
|
||||
info->manufacturer_code[2] = get_bits (edid[0x09], 0, 4);
|
||||
info->manufacturer_code[3] = '\0';
|
||||
info->manufacturer_code[2] = get_bits (edid[0x09], 0, 4);
|
||||
info->manufacturer_code[3] = '\0';
|
||||
|
||||
info->manufacturer_code[0] += 'A' - 1;
|
||||
info->manufacturer_code[1] += 'A' - 1;
|
||||
@ -128,14 +128,14 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info)
|
||||
int bits;
|
||||
|
||||
static const int bit_depth[8] =
|
||||
{
|
||||
-1, 6, 8, 10, 12, 14, 16, -1
|
||||
};
|
||||
{
|
||||
-1, 6, 8, 10, 12, 14, 16, -1
|
||||
};
|
||||
|
||||
static const Interface interfaces[6] =
|
||||
{
|
||||
UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT
|
||||
};
|
||||
{
|
||||
UNDEFINED, DVI, HDMI_A, HDMI_B, MDDI, DISPLAY_PORT
|
||||
};
|
||||
|
||||
bits = get_bits (edid[0x14], 4, 6);
|
||||
info->connector.digital.bits_per_primary = bit_depth[bits];
|
||||
@ -152,12 +152,12 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info)
|
||||
int bits = get_bits (edid[0x14], 5, 6);
|
||||
|
||||
static const double levels[][3] =
|
||||
{
|
||||
{ 0.7, 0.3, 1.0 },
|
||||
{ 0.714, 0.286, 1.0 },
|
||||
{ 1.0, 0.4, 1.4 },
|
||||
{ 0.7, 0.0, 0.7 },
|
||||
};
|
||||
{
|
||||
{ 0.7, 0.3, 1.0 },
|
||||
{ 0.714, 0.286, 1.0 },
|
||||
{ 1.0, 0.4, 1.4 },
|
||||
{ 0.7, 0.0, 0.7 },
|
||||
};
|
||||
|
||||
info->connector.analog.video_signal_level = levels[bits][0];
|
||||
info->connector.analog.sync_signal_level = levels[bits][1];
|
||||
@ -190,7 +190,7 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info)
|
||||
info->width_mm = -1;
|
||||
info->height_mm = -1;
|
||||
info->aspect_ratio = 100.0 / (edid[0x16] + 99);
|
||||
info->aspect_ratio = 1/info->aspect_ratio; /* portrait */
|
||||
info->aspect_ratio = 1 / info->aspect_ratio; /* portrait */
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -221,9 +221,9 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info)
|
||||
{
|
||||
int bits = get_bits (edid[0x18], 3, 4);
|
||||
ColorType color_type[4] =
|
||||
{
|
||||
MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR
|
||||
};
|
||||
{
|
||||
MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR
|
||||
};
|
||||
|
||||
info->connector.analog.color_type = color_type[bits];
|
||||
}
|
||||
@ -271,38 +271,38 @@ static int
|
||||
decode_established_timings (const uchar *edid, MonitorInfo *info)
|
||||
{
|
||||
static const Timing established[][8] =
|
||||
{
|
||||
{
|
||||
{
|
||||
{ 800, 600, 60 },
|
||||
{ 800, 600, 56 },
|
||||
{ 640, 480, 75 },
|
||||
{ 640, 480, 72 },
|
||||
{ 640, 480, 67 },
|
||||
{ 640, 480, 60 },
|
||||
{ 720, 400, 88 },
|
||||
{ 720, 400, 70 }
|
||||
},
|
||||
{
|
||||
{ 1280, 1024, 75 },
|
||||
{ 1024, 768, 75 },
|
||||
{ 1024, 768, 70 },
|
||||
{ 1024, 768, 60 },
|
||||
{ 1024, 768, 87 },
|
||||
{ 832, 624, 75 },
|
||||
{ 800, 600, 75 },
|
||||
{ 800, 600, 72 }
|
||||
},
|
||||
{
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 1152, 870, 75 }
|
||||
},
|
||||
};
|
||||
{ 800, 600, 60 },
|
||||
{ 800, 600, 56 },
|
||||
{ 640, 480, 75 },
|
||||
{ 640, 480, 72 },
|
||||
{ 640, 480, 67 },
|
||||
{ 640, 480, 60 },
|
||||
{ 720, 400, 88 },
|
||||
{ 720, 400, 70 }
|
||||
},
|
||||
{
|
||||
{ 1280, 1024, 75 },
|
||||
{ 1024, 768, 75 },
|
||||
{ 1024, 768, 70 },
|
||||
{ 1024, 768, 60 },
|
||||
{ 1024, 768, 87 },
|
||||
{ 832, 624, 75 },
|
||||
{ 800, 600, 75 },
|
||||
{ 800, 600, 72 }
|
||||
},
|
||||
{
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 0, 0, 0 },
|
||||
{ 1152, 870, 75 }
|
||||
},
|
||||
};
|
||||
|
||||
int i, j, idx;
|
||||
|
||||
@ -310,12 +310,12 @@ decode_established_timings (const uchar *edid, MonitorInfo *info)
|
||||
for (i = 0; i < 3; ++i)
|
||||
{
|
||||
for (j = 0; j < 8; ++j)
|
||||
{
|
||||
{
|
||||
int byte = edid[0x23 + i];
|
||||
|
||||
if (get_bit (byte, j) && established[i][j].frequency != 0)
|
||||
info->established[idx++] = established[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@ -331,22 +331,26 @@ decode_standard_timings (const uchar *edid, MonitorInfo *info)
|
||||
int second = edid[0x27 + 2 * i];
|
||||
|
||||
if (first != 0x01 && second != 0x01)
|
||||
{
|
||||
{
|
||||
int w = 8 * (first + 31);
|
||||
int h = 0;
|
||||
|
||||
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;
|
||||
info->standard[i].height = h;
|
||||
info->standard[i].frequency = get_bits (second, 0, 5) + 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -359,25 +363,25 @@ decode_lf_string (const uchar *s, int n_chars, char *result)
|
||||
for (i = 0; i < n_chars; ++i)
|
||||
{
|
||||
if (s[i] == 0x0a)
|
||||
{
|
||||
{
|
||||
*result++ = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (s[i] == 0x00)
|
||||
{
|
||||
{
|
||||
/* Convert embedded 0's to spaces */
|
||||
*result++ = ' ';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
*result++ = s[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
decode_display_descriptor (const uchar *desc,
|
||||
MonitorInfo *info)
|
||||
MonitorInfo *info)
|
||||
{
|
||||
switch (desc[0x03])
|
||||
{
|
||||
@ -414,16 +418,16 @@ decode_display_descriptor (const uchar *desc,
|
||||
}
|
||||
|
||||
static void
|
||||
decode_detailed_timing (const uchar *timing,
|
||||
DetailedTiming *detailed)
|
||||
decode_detailed_timing (const uchar *timing,
|
||||
DetailedTiming *detailed)
|
||||
{
|
||||
int bits;
|
||||
StereoType stereo[] =
|
||||
{
|
||||
NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT,
|
||||
TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN,
|
||||
FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE
|
||||
};
|
||||
{
|
||||
NO_STEREO, NO_STEREO, FIELD_RIGHT, FIELD_LEFT,
|
||||
TWO_WAY_RIGHT_ON_EVEN, TWO_WAY_LEFT_ON_EVEN,
|
||||
FOUR_WAY_INTERLEAVED, SIDE_BY_SIDE
|
||||
};
|
||||
|
||||
detailed->pixel_clock = (timing[0x00] | timing[0x01] << 8) * 10000;
|
||||
detailed->h_addr = timing[0x02] | ((timing[0x04] & 0xf0) << 4);
|
||||
@ -436,7 +440,7 @@ decode_detailed_timing (const uchar *timing,
|
||||
get_bits (timing[0x0a], 4, 7) | get_bits (timing[0x0b], 2, 3) << 4;
|
||||
detailed->v_sync =
|
||||
get_bits (timing[0x0a], 0, 3) | get_bits (timing[0x0b], 0, 1) << 4;
|
||||
detailed->width_mm = timing[0x0c] | get_bits (timing[0x0e], 4, 7) << 8;
|
||||
detailed->width_mm = timing[0x0c] | get_bits (timing[0x0e], 4, 7) << 8;
|
||||
detailed->height_mm = timing[0x0d] | get_bits (timing[0x0e], 0, 3) << 8;
|
||||
detailed->right_border = timing[0x0f];
|
||||
detailed->top_border = timing[0x10];
|
||||
@ -456,15 +460,15 @@ decode_detailed_timing (const uchar *timing,
|
||||
detailed->connector.digital.composite = !get_bit (bits, 3);
|
||||
|
||||
if (detailed->connector.digital.composite)
|
||||
{
|
||||
{
|
||||
detailed->connector.digital.serrations = get_bit (bits, 2);
|
||||
detailed->connector.digital.negative_vsync = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
detailed->connector.digital.serrations = FALSE;
|
||||
detailed->connector.digital.negative_vsync = !get_bit (bits, 2);
|
||||
}
|
||||
}
|
||||
|
||||
detailed->connector.digital.negative_hsync = !get_bit (bits, 0);
|
||||
}
|
||||
@ -489,13 +493,14 @@ decode_descriptors (const uchar *edid, MonitorInfo *info)
|
||||
int index = 0x36 + i * 18;
|
||||
|
||||
if (edid[index + 0] == 0x00 && edid[index + 1] == 0x00)
|
||||
{
|
||||
{
|
||||
decode_display_descriptor (edid + index, info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
decode_detailed_timing (edid + index, &(info->detailed_timings[timing_idx++]));
|
||||
}
|
||||
{
|
||||
decode_detailed_timing (edid + index,
|
||||
&(info->detailed_timings[timing_idx++]));
|
||||
}
|
||||
}
|
||||
|
||||
info->n_detailed_timings = timing_idx;
|
||||
@ -505,7 +510,7 @@ decode_descriptors (const uchar *edid, MonitorInfo *info)
|
||||
|
||||
static void
|
||||
decode_check_sum (const uchar *edid,
|
||||
MonitorInfo *info)
|
||||
MonitorInfo *info)
|
||||
{
|
||||
int i;
|
||||
uchar check = 0;
|
||||
|
@ -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 */
|
||||
@ -521,12 +533,12 @@ meta_backend_real_select_stage_events (MetaBackend *backend)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_backend_real_get_relative_motion_deltas (MetaBackend *backend,
|
||||
const ClutterEvent *event,
|
||||
double *dx,
|
||||
double *dy,
|
||||
double *dx_unaccel,
|
||||
double *dy_unaccel)
|
||||
meta_backend_real_get_relative_motion_deltas (MetaBackend *backend,
|
||||
const ClutterEvent *event,
|
||||
double *dx,
|
||||
double *dy,
|
||||
double *dx_unaccel,
|
||||
double *dy_unaccel)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -655,7 +667,7 @@ meta_backend_constructed (GObject *object)
|
||||
MetaBackend *backend = META_BACKEND (object);
|
||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||
MetaBackendClass *backend_class =
|
||||
META_BACKEND_GET_CLASS (backend);
|
||||
META_BACKEND_GET_CLASS (backend);
|
||||
|
||||
if (backend_class->is_lid_closed != meta_backend_real_is_lid_closed)
|
||||
return;
|
||||
@ -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] =
|
||||
@ -782,9 +795,9 @@ system_bus_gotten_cb (GObject *object,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_backend_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
meta_backend_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = META_BACKEND (initable);
|
||||
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
|
||||
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1025,7 +1042,7 @@ meta_backend_get_keymap_layout_group (MetaBackend *backend)
|
||||
|
||||
void
|
||||
meta_backend_lock_layout_group (MetaBackend *backend,
|
||||
guint idx)
|
||||
guint idx)
|
||||
{
|
||||
META_BACKEND_GET_CLASS (backend)->lock_layout_group (backend, idx);
|
||||
}
|
||||
@ -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;
|
||||
@ -1116,12 +1134,12 @@ meta_backend_update_last_device (MetaBackend *backend,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_backend_get_relative_motion_deltas (MetaBackend *backend,
|
||||
const ClutterEvent *event,
|
||||
double *dx,
|
||||
double *dy,
|
||||
double *dx_unaccel,
|
||||
double *dy_unaccel)
|
||||
meta_backend_get_relative_motion_deltas (MetaBackend *backend,
|
||||
const ClutterEvent *event,
|
||||
double *dx,
|
||||
double *dy,
|
||||
double *dx_unaccel,
|
||||
double *dy_unaccel)
|
||||
{
|
||||
MetaBackendClass *klass = META_BACKEND_GET_CLASS (backend);
|
||||
return klass->get_relative_motion_deltas (backend,
|
||||
@ -1163,8 +1181,8 @@ meta_backend_set_client_pointer_constraint (MetaBackend *backend,
|
||||
*/
|
||||
|
||||
static gboolean
|
||||
event_prepare (GSource *source,
|
||||
gint *timeout_)
|
||||
event_prepare (GSource *source,
|
||||
gint *timeout_)
|
||||
{
|
||||
*timeout_ = -1;
|
||||
|
||||
@ -1193,7 +1211,8 @@ event_dispatch (GSource *source,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static GSourceFuncs event_funcs = {
|
||||
static GSourceFuncs event_funcs =
|
||||
{
|
||||
event_prepare,
|
||||
event_check,
|
||||
event_dispatch
|
||||
|
@ -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
|
||||
@ -336,7 +346,7 @@ meta_barrier_event_ref (MetaBarrierEvent *event)
|
||||
g_return_val_if_fail (event != NULL, NULL);
|
||||
g_return_val_if_fail (event->ref_count > 0, NULL);
|
||||
|
||||
g_atomic_int_inc ((volatile int *)&event->ref_count);
|
||||
g_atomic_int_inc ((volatile int *) &event->ref_count);
|
||||
return event;
|
||||
}
|
||||
|
||||
@ -346,7 +356,7 @@ meta_barrier_event_unref (MetaBarrierEvent *event)
|
||||
g_return_if_fail (event != NULL);
|
||||
g_return_if_fail (event->ref_count > 0);
|
||||
|
||||
if (g_atomic_int_dec_and_test ((volatile int *)&event->ref_count))
|
||||
if (g_atomic_int_dec_and_test ((volatile int *) &event->ref_count))
|
||||
g_slice_free (MetaBarrierEvent, event);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ G_DEFINE_TYPE (MetaCrtc, meta_crtc, G_TYPE_OBJECT)
|
||||
G_DEFINE_TYPE (MetaCrtcMode, meta_crtc_mode, G_TYPE_OBJECT)
|
||||
|
||||
MetaGpu *
|
||||
meta_crtc_get_gpu (MetaCrtc *crtc)
|
||||
meta_crtc_get_gpu (MetaCrtc * crtc)
|
||||
{
|
||||
return crtc->gpu;
|
||||
}
|
||||
|
@ -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,14 +184,16 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
|
||||
height = cogl_texture_get_height (texture);
|
||||
|
||||
return (ClutterRect) {
|
||||
.origin = {
|
||||
.x = priv->current_x - (hot_x * texture_scale),
|
||||
.y = priv->current_y - (hot_y * texture_scale)
|
||||
},
|
||||
.size = {
|
||||
.width = width * texture_scale,
|
||||
.height = height * texture_scale
|
||||
}
|
||||
.origin =
|
||||
{
|
||||
.x = priv->current_x - (hot_x * texture_scale),
|
||||
.y = priv->current_y - (hot_y * texture_scale)
|
||||
},
|
||||
.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 ());
|
||||
|
||||
@ -270,15 +279,16 @@ meta_cursor_renderer_get_position (MetaCursorRenderer *renderer)
|
||||
meta_cursor_renderer_get_instance_private (renderer);
|
||||
|
||||
return (ClutterPoint) {
|
||||
.x = priv->current_x,
|
||||
.y = priv->current_y
|
||||
.x = priv->current_x,
|
||||
.y = priv->current_y
|
||||
};
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -99,8 +99,8 @@ meta_cursor_sprite_xcursor_get_cursor (MetaCursorSpriteXcursor *sprite_xcursor)
|
||||
}
|
||||
|
||||
Cursor
|
||||
meta_create_x_cursor (Display *xdisplay,
|
||||
MetaCursor cursor)
|
||||
meta_create_x_cursor (Display *xdisplay,
|
||||
MetaCursor cursor)
|
||||
{
|
||||
return XcursorLibraryLoadCursor (xdisplay, translate_meta_cursor (cursor));
|
||||
}
|
||||
@ -160,8 +160,9 @@ load_from_current_xcursor_image (MetaCursorSpriteXcursor *sprite_xcursor)
|
||||
}
|
||||
|
||||
void
|
||||
meta_cursor_sprite_xcursor_set_theme_scale (MetaCursorSpriteXcursor *sprite_xcursor,
|
||||
int theme_scale)
|
||||
meta_cursor_sprite_xcursor_set_theme_scale (
|
||||
MetaCursorSpriteXcursor *sprite_xcursor,
|
||||
int theme_scale)
|
||||
{
|
||||
if (sprite_xcursor->theme_scale != theme_scale)
|
||||
sprite_xcursor->theme_dirty = TRUE;
|
||||
@ -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];
|
||||
}
|
||||
|
@ -46,7 +46,8 @@
|
||||
|
||||
G_DEFINE_TYPE (MetaCursorTracker, meta_cursor_tracker, G_TYPE_OBJECT);
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
CURSOR_CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
@ -204,7 +205,7 @@ meta_cursor_tracker_handle_xevent (MetaCursorTracker *tracker,
|
||||
if (xevent->xany.type != x11_display->xfixes_event_base + XFixesCursorNotify)
|
||||
return FALSE;
|
||||
|
||||
notify_event = (XFixesCursorNotifyEvent *)xevent;
|
||||
notify_event = (XFixesCursorNotifyEvent *) xevent;
|
||||
if (notify_event->subtype != XFixesDisplayCursorNotify)
|
||||
return FALSE;
|
||||
|
||||
@ -337,9 +338,9 @@ meta_cursor_tracker_update_position (MetaCursorTracker *tracker,
|
||||
}
|
||||
|
||||
static void
|
||||
get_pointer_position_gdk (int *x,
|
||||
int *y,
|
||||
int *mods)
|
||||
get_pointer_position_gdk (int *x,
|
||||
int *y,
|
||||
int *mods)
|
||||
{
|
||||
GdkSeat *gseat;
|
||||
GdkDevice *gdevice;
|
||||
@ -352,20 +353,21 @@ get_pointer_position_gdk (int *x,
|
||||
if (mods)
|
||||
gdk_device_get_state (gdevice,
|
||||
gdk_screen_get_root_window (gscreen),
|
||||
NULL, (GdkModifierType*)mods);
|
||||
NULL, (GdkModifierType *) mods);
|
||||
}
|
||||
|
||||
static void
|
||||
get_pointer_position_clutter (int *x,
|
||||
int *y,
|
||||
int *mods)
|
||||
get_pointer_position_clutter (int *x,
|
||||
int *y,
|
||||
int *mods)
|
||||
{
|
||||
ClutterDeviceManager *cmanager;
|
||||
ClutterInputDevice *cdevice;
|
||||
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,15 +384,17 @@ 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);
|
||||
get_pointer_position_clutter (x, y, (int *) mods);
|
||||
else
|
||||
get_pointer_position_gdk (x, y, (int*)mods);
|
||||
get_pointer_position_gdk (x, y, (int *) mods);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -92,8 +92,9 @@ meta_dbus_session_client_destroy (MetaDbusSessionClient *client)
|
||||
}
|
||||
|
||||
static void
|
||||
meta_dbus_session_watcher_destroy_client (MetaDbusSessionWatcher *session_watcher,
|
||||
MetaDbusSessionClient *client)
|
||||
meta_dbus_session_watcher_destroy_client (
|
||||
MetaDbusSessionWatcher *session_watcher,
|
||||
MetaDbusSessionClient *client)
|
||||
{
|
||||
g_hash_table_remove (session_watcher->clients, client->dbus_name);
|
||||
}
|
||||
@ -169,9 +170,10 @@ meta_dbus_session_watcher_get_client (MetaDbusSessionWatcher *session_watcher,
|
||||
}
|
||||
|
||||
void
|
||||
meta_dbus_session_watcher_watch_session (MetaDbusSessionWatcher *session_watcher,
|
||||
const char *client_dbus_name,
|
||||
MetaDbusSession *session)
|
||||
meta_dbus_session_watcher_watch_session (
|
||||
MetaDbusSessionWatcher *session_watcher,
|
||||
const char *client_dbus_name,
|
||||
MetaDbusSession *session)
|
||||
{
|
||||
MetaDbusSessionClient *client;
|
||||
|
||||
|
@ -62,7 +62,8 @@ struct _MetaEgl
|
||||
|
||||
PFNEGLSTREAMCONSUMEROUTPUTEXTPROC eglStreamConsumerOutputEXT;
|
||||
|
||||
PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC eglStreamConsumerGLTextureExternalKHR;
|
||||
PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC
|
||||
eglStreamConsumerGLTextureExternalKHR;
|
||||
|
||||
PFNEGLSTREAMCONSUMERACQUIREKHRPROC eglStreamConsumerAcquireKHR;
|
||||
PFNEGLSTREAMCONSUMERACQUIREATTRIBNVPROC eglStreamConsumerAcquireAttribNV;
|
||||
@ -73,7 +74,7 @@ struct _MetaEgl
|
||||
|
||||
G_DEFINE_TYPE (MetaEgl, meta_egl, G_TYPE_OBJECT)
|
||||
|
||||
G_DEFINE_QUARK (-meta-egl-error-quark, meta_egl_error)
|
||||
G_DEFINE_QUARK (-meta - egl - error - quark, meta_egl_error)
|
||||
|
||||
static const char *
|
||||
get_egl_error_str (EGLint error_number)
|
||||
@ -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;
|
||||
@ -266,12 +281,12 @@ meta_egl_get_proc_address (MetaEgl *egl,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_egl_get_config_attrib (MetaEgl *egl,
|
||||
EGLDisplay display,
|
||||
EGLConfig config,
|
||||
EGLint attribute,
|
||||
EGLint *value,
|
||||
GError **error)
|
||||
meta_egl_get_config_attrib (MetaEgl *egl,
|
||||
EGLDisplay display,
|
||||
EGLConfig config,
|
||||
EGLint attribute,
|
||||
EGLint *value,
|
||||
GError **error)
|
||||
{
|
||||
if (!eglGetConfigAttrib (display,
|
||||
config,
|
||||
@ -286,11 +301,11 @@ meta_egl_get_config_attrib (MetaEgl *egl,
|
||||
}
|
||||
|
||||
EGLConfig *
|
||||
meta_egl_choose_all_configs (MetaEgl *egl,
|
||||
EGLDisplay display,
|
||||
const EGLint *attrib_list,
|
||||
EGLint *out_num_configs,
|
||||
GError **error)
|
||||
meta_egl_choose_all_configs (MetaEgl *egl,
|
||||
EGLDisplay display,
|
||||
const EGLint *attrib_list,
|
||||
EGLint *out_num_configs,
|
||||
GError **error)
|
||||
{
|
||||
EGLint num_configs;
|
||||
EGLConfig *configs;
|
||||
@ -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);
|
||||
@ -332,11 +348,11 @@ meta_egl_choose_all_configs (MetaEgl *egl,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_egl_choose_first_config (MetaEgl *egl,
|
||||
EGLDisplay display,
|
||||
const EGLint *attrib_list,
|
||||
EGLConfig *chosen_config,
|
||||
GError **error)
|
||||
meta_egl_choose_first_config (MetaEgl *egl,
|
||||
EGLDisplay display,
|
||||
const EGLint *attrib_list,
|
||||
EGLConfig *chosen_config,
|
||||
GError **error)
|
||||
{
|
||||
EGLint num_configs;
|
||||
EGLConfig *configs;
|
||||
@ -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);
|
||||
@ -615,7 +632,7 @@ meta_egl_query_wayland_buffer (MetaEgl *egl,
|
||||
GError **error)
|
||||
{
|
||||
if (!is_egl_proc_valid (egl->eglQueryWaylandBufferWL, error))
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
|
||||
if (!egl->eglQueryWaylandBufferWL (display, buffer, attribute, value))
|
||||
{
|
||||
@ -827,10 +844,10 @@ meta_egl_create_stream_attrib (MetaEgl *egl,
|
||||
}
|
||||
|
||||
EGLSurface
|
||||
meta_egl_create_stream_producer_surface (MetaEgl *egl,
|
||||
EGLDisplay display,
|
||||
EGLConfig config,
|
||||
EGLStreamKHR stream,
|
||||
meta_egl_create_stream_producer_surface (MetaEgl *egl,
|
||||
EGLDisplay display,
|
||||
EGLConfig config,
|
||||
EGLStreamKHR stream,
|
||||
const EGLint *attrib_list,
|
||||
GError **error)
|
||||
{
|
||||
@ -944,7 +961,7 @@ meta_egl_query_dma_buf_formats (MetaEgl *egl,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
@ -968,7 +985,7 @@ meta_egl_query_dma_buf_modifiers (MetaEgl *egl,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define GET_EGL_PROC_ADDR(proc) \
|
||||
|
@ -42,7 +42,7 @@ struct _MetaGles3
|
||||
G_DEFINE_TYPE (MetaGles3, meta_gles3, G_TYPE_OBJECT)
|
||||
|
||||
MetaGles3Table *
|
||||
meta_gles3_get_table (MetaGles3 *gles3)
|
||||
meta_gles3_get_table (MetaGles3 * gles3)
|
||||
{
|
||||
return &gles3->table;
|
||||
}
|
||||
@ -72,15 +72,15 @@ get_gl_error_str (GLenum gl_error)
|
||||
case GL_INVALID_ENUM:
|
||||
return "An unacceptable value is specified for an enumerated argument.";
|
||||
case GL_INVALID_VALUE:
|
||||
return "A numeric argument is out of range.";
|
||||
return "A numeric argument is out of range.";
|
||||
case GL_INVALID_OPERATION:
|
||||
return "The specified operation is not allowed in the current state.";
|
||||
return "The specified operation is not allowed in the current state.";
|
||||
case GL_INVALID_FRAMEBUFFER_OPERATION:
|
||||
return "The framebuffer object is not complete.";
|
||||
return "The framebuffer object is not complete.";
|
||||
case GL_OUT_OF_MEMORY:
|
||||
return "There is not enough memory left to execute the command.";
|
||||
return "There is not enough memory left to execute the command.";
|
||||
default:
|
||||
return "Unknown error";
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,8 +65,8 @@ meta_gpu_has_hotplug_mode_update (MetaGpu *gpu)
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_gpu_read_current (MetaGpu *gpu,
|
||||
GError **error)
|
||||
meta_gpu_read_current (MetaGpu *gpu,
|
||||
GError **error)
|
||||
{
|
||||
MetaGpuPrivate *priv = meta_gpu_get_instance_private (gpu);
|
||||
gboolean ret;
|
||||
@ -131,7 +131,7 @@ meta_gpu_take_outputs (MetaGpu *gpu,
|
||||
|
||||
void
|
||||
meta_gpu_take_crtcs (MetaGpu *gpu,
|
||||
GList *crtcs)
|
||||
GList *crtcs)
|
||||
{
|
||||
MetaGpuPrivate *priv = meta_gpu_get_instance_private (gpu);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -41,7 +41,7 @@
|
||||
#include "meta/meta-idle-monitor.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
G_STATIC_ASSERT(sizeof(unsigned long) == sizeof(gpointer));
|
||||
G_STATIC_ASSERT (sizeof (unsigned long) == sizeof (gpointer));
|
||||
|
||||
enum
|
||||
{
|
||||
@ -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
|
||||
@ -213,15 +215,16 @@ update_inhibited (MetaIdleMonitor *monitor,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_idle_monitor_inhibited_actions_changed (GDBusProxy *session,
|
||||
GVariant *changed,
|
||||
char **invalidated,
|
||||
gpointer user_data)
|
||||
meta_idle_monitor_inhibited_actions_changed (GDBusProxy *session,
|
||||
GVariant *changed,
|
||||
char **invalidated,
|
||||
gpointer user_data)
|
||||
{
|
||||
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;
|
||||
@ -311,9 +314,9 @@ get_next_watch_serial (void)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
idle_monitor_dispatch_timeout (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
idle_monitor_dispatch_timeout (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaIdleMonitorWatch *watch = (MetaIdleMonitorWatch *) user_data;
|
||||
|
||||
@ -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,
|
||||
@ -331,11 +335,11 @@ static GSourceFuncs idle_monitor_source_funcs = {
|
||||
};
|
||||
|
||||
static MetaIdleMonitorWatch *
|
||||
make_watch (MetaIdleMonitor *monitor,
|
||||
guint64 timeout_msec,
|
||||
MetaIdleMonitorWatchFunc callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
make_watch (MetaIdleMonitor *monitor,
|
||||
guint64 timeout_msec,
|
||||
MetaIdleMonitorWatchFunc callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
MetaIdleMonitorWatch *watch;
|
||||
|
||||
@ -395,11 +399,11 @@ make_watch (MetaIdleMonitor *monitor,
|
||||
* meta_idle_monitor_add_user_active_watch().
|
||||
*/
|
||||
guint
|
||||
meta_idle_monitor_add_idle_watch (MetaIdleMonitor *monitor,
|
||||
guint64 interval_msec,
|
||||
MetaIdleMonitorWatchFunc callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
meta_idle_monitor_add_idle_watch (MetaIdleMonitor *monitor,
|
||||
guint64 interval_msec,
|
||||
MetaIdleMonitorWatchFunc callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
MetaIdleMonitorWatch *watch;
|
||||
|
||||
@ -432,10 +436,10 @@ meta_idle_monitor_add_idle_watch (MetaIdleMonitor *monitor,
|
||||
* meta_idle_monitor_add_idle_watch(), has triggered.
|
||||
*/
|
||||
guint
|
||||
meta_idle_monitor_add_user_active_watch (MetaIdleMonitor *monitor,
|
||||
MetaIdleMonitorWatchFunc callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
meta_idle_monitor_add_user_active_watch (MetaIdleMonitor *monitor,
|
||||
MetaIdleMonitorWatchFunc callback,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify)
|
||||
{
|
||||
MetaIdleMonitorWatch *watch;
|
||||
|
||||
@ -461,7 +465,7 @@ meta_idle_monitor_add_user_active_watch (MetaIdleMonitor *monitor,
|
||||
*/
|
||||
void
|
||||
meta_idle_monitor_remove_watch (MetaIdleMonitor *monitor,
|
||||
guint id)
|
||||
guint id)
|
||||
{
|
||||
g_return_if_fail (META_IS_IDLE_MONITOR (monitor));
|
||||
|
||||
|
@ -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,11 +118,12 @@ 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,
|
||||
ClutterInputDeviceType type)
|
||||
meta_input_settings_get_devices (MetaInputSettings * settings,
|
||||
ClutterInputDeviceType type)
|
||||
{
|
||||
MetaInputSettingsPrivate *priv;
|
||||
const GSList *devices;
|
||||
@ -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);
|
||||
|
||||
@ -189,10 +194,10 @@ settings_device_set_bool_setting (MetaInputSettings *input_settings,
|
||||
}
|
||||
|
||||
static void
|
||||
settings_set_bool_setting (MetaInputSettings *input_settings,
|
||||
ClutterInputDeviceType type,
|
||||
ConfigBoolFunc func,
|
||||
gboolean enabled)
|
||||
settings_set_bool_setting (MetaInputSettings *input_settings,
|
||||
ClutterInputDeviceType type,
|
||||
ConfigBoolFunc func,
|
||||
gboolean enabled)
|
||||
{
|
||||
GSList *devices, *d;
|
||||
|
||||
@ -214,10 +219,10 @@ settings_device_set_double_setting (MetaInputSettings *input_settings,
|
||||
}
|
||||
|
||||
static void
|
||||
settings_set_double_setting (MetaInputSettings *input_settings,
|
||||
ClutterInputDeviceType type,
|
||||
ConfigDoubleFunc func,
|
||||
gdouble value)
|
||||
settings_set_double_setting (MetaInputSettings *input_settings,
|
||||
ClutterInputDeviceType type,
|
||||
ConfigDoubleFunc func,
|
||||
gdouble value)
|
||||
{
|
||||
GSList *devices, *d;
|
||||
|
||||
@ -239,10 +244,10 @@ settings_device_set_uint_setting (MetaInputSettings *input_settings,
|
||||
}
|
||||
|
||||
static void
|
||||
settings_set_uint_setting (MetaInputSettings *input_settings,
|
||||
ClutterInputDeviceType type,
|
||||
ConfigUintFunc func,
|
||||
guint value)
|
||||
settings_set_uint_setting (MetaInputSettings *input_settings,
|
||||
ClutterInputDeviceType type,
|
||||
ConfigUintFunc func,
|
||||
guint value)
|
||||
{
|
||||
GSList *devices, *d;
|
||||
|
||||
@ -397,8 +402,8 @@ update_pointer_accel_profile (MetaInputSettings *input_settings,
|
||||
}
|
||||
|
||||
static GSettings *
|
||||
get_settings_for_device_type (MetaInputSettings *input_settings,
|
||||
ClutterInputDeviceType type)
|
||||
get_settings_for_device_type (MetaInputSettings *input_settings,
|
||||
ClutterInputDeviceType type)
|
||||
{
|
||||
MetaInputSettingsPrivate *priv;
|
||||
priv = meta_input_settings_get_instance_private (input_settings);
|
||||
@ -414,8 +419,8 @@ get_settings_for_device_type (MetaInputSettings *input_settings,
|
||||
}
|
||||
|
||||
static void
|
||||
update_device_speed (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *device)
|
||||
update_device_speed (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
GSettings *settings;
|
||||
ConfigDoubleFunc func;
|
||||
@ -426,27 +431,32 @@ 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));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_device_natural_scroll (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *device)
|
||||
update_device_natural_scroll (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
GSettings *settings;
|
||||
ConfigBoolFunc func;
|
||||
@ -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));
|
||||
}
|
||||
@ -494,9 +507,10 @@ update_touchpad_disable_while_typing (MetaInputSettings *input_settings,
|
||||
enabled = g_settings_get_boolean (priv->touchpad_settings, key);
|
||||
|
||||
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;
|
||||
@ -574,7 +588,7 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings,
|
||||
}
|
||||
|
||||
static void
|
||||
update_touchpad_edge_scroll (MetaInputSettings *input_settings,
|
||||
update_touchpad_edge_scroll (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
MetaInputSettingsClass *input_settings_class;
|
||||
@ -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)
|
||||
@ -612,7 +630,7 @@ update_touchpad_edge_scroll (MetaInputSettings *input_settings,
|
||||
}
|
||||
|
||||
static void
|
||||
update_touchpad_two_finger_scroll (MetaInputSettings *input_settings,
|
||||
update_touchpad_two_finger_scroll (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
MetaInputSettingsClass *input_settings_class;
|
||||
@ -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)
|
||||
@ -650,7 +669,7 @@ update_touchpad_two_finger_scroll (MetaInputSettings *input_settings,
|
||||
}
|
||||
|
||||
static void
|
||||
update_touchpad_click_method (MetaInputSettings *input_settings,
|
||||
update_touchpad_click_method (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
MetaInputSettingsClass *input_settings_class;
|
||||
@ -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)
|
||||
{
|
||||
@ -1075,7 +1105,7 @@ meta_input_settings_changed_cb (GSettings *settings,
|
||||
update_touchpad_tap_enabled (input_settings, NULL);
|
||||
else if (strcmp (key, "tap-and-drag") == 0)
|
||||
update_touchpad_tap_and_drag_enabled (input_settings, NULL);
|
||||
else if (strcmp(key, "disable-while-typing") == 0)
|
||||
else if (strcmp (key, "disable-while-typing") == 0)
|
||||
update_touchpad_disable_while_typing (input_settings, NULL);
|
||||
else if (strcmp (key, "send-events") == 0)
|
||||
update_touchpad_send_events (input_settings, NULL);
|
||||
@ -1140,23 +1170,25 @@ 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[] = {
|
||||
{ "enable", CLUTTER_A11Y_KEYBOARD_ENABLED },
|
||||
{ "timeout-enable", CLUTTER_A11Y_TIMEOUT_ENABLED },
|
||||
{ "mousekeys-enable", CLUTTER_A11Y_MOUSE_KEYS_ENABLED },
|
||||
{ "slowkeys-enable", CLUTTER_A11Y_SLOW_KEYS_ENABLED },
|
||||
{ "slowkeys-beep-press", CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS },
|
||||
{ "slowkeys-beep-accept", CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT },
|
||||
{ "slowkeys-beep-reject", CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT },
|
||||
{ "bouncekeys-enable", CLUTTER_A11Y_BOUNCE_KEYS_ENABLED },
|
||||
{ "bouncekeys-beep-reject", CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT },
|
||||
{ "togglekeys-enable", CLUTTER_A11Y_TOGGLE_KEYS_ENABLED },
|
||||
{ "stickykeys-enable", CLUTTER_A11Y_STICKY_KEYS_ENABLED },
|
||||
{ "stickykeys-modifier-beep", CLUTTER_A11Y_STICKY_KEYS_BEEP },
|
||||
{ "stickykeys-two-key-off", CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF },
|
||||
} settings_flags_pair[] =
|
||||
{
|
||||
{ "enable", CLUTTER_A11Y_KEYBOARD_ENABLED },
|
||||
{ "timeout-enable", CLUTTER_A11Y_TIMEOUT_ENABLED },
|
||||
{ "mousekeys-enable", CLUTTER_A11Y_MOUSE_KEYS_ENABLED },
|
||||
{ "slowkeys-enable", CLUTTER_A11Y_SLOW_KEYS_ENABLED },
|
||||
{ "slowkeys-beep-press", CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS },
|
||||
{ "slowkeys-beep-accept", CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT },
|
||||
{ "slowkeys-beep-reject", CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT },
|
||||
{ "bouncekeys-enable", CLUTTER_A11Y_BOUNCE_KEYS_ENABLED },
|
||||
{ "bouncekeys-beep-reject", CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT },
|
||||
{ "togglekeys-enable", CLUTTER_A11Y_TOGGLE_KEYS_ENABLED },
|
||||
{ "stickykeys-enable", CLUTTER_A11Y_STICKY_KEYS_ENABLED },
|
||||
{ "stickykeys-modifier-beep", CLUTTER_A11Y_STICKY_KEYS_BEEP },
|
||||
{ "stickykeys-two-key-off", CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF },
|
||||
{ "feature-state-change-beep", CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP },
|
||||
};
|
||||
|
||||
@ -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,
|
||||
"mousekeys-init-delay");
|
||||
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,
|
||||
"mousekeys-accel-time");
|
||||
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,
|
||||
"mousekeys-max-speed");
|
||||
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/",
|
||||
clutter_input_device_get_vendor_id (device),
|
||||
clutter_input_device_get_product_id (device));
|
||||
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,8 +1391,9 @@ lookup_pad_action_settings (ClutterInputDevice *device,
|
||||
|
||||
g_string_append_c (path, '/');
|
||||
|
||||
settings = g_settings_new_with_path ("org.gnome.desktop.peripherals.tablet.pad-button",
|
||||
path->str);
|
||||
settings = g_settings_new_with_path (
|
||||
"org.gnome.desktop.peripherals.tablet.pad-button",
|
||||
path->str);
|
||||
g_string_free (path, TRUE);
|
||||
|
||||
return settings;
|
||||
@ -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,22 +1778,26 @@ 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",
|
||||
clutter_settings_get_default (), "double-click-time",
|
||||
G_SETTINGS_BIND_GET);
|
||||
|
||||
priv->a11y_settings = g_settings_new ("org.gnome.desktop.a11y.keyboard");
|
||||
@ -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",
|
||||
@ -1831,9 +1887,9 @@ meta_input_settings_get_tablet_mapping (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static GDesktopPadButtonAction
|
||||
meta_input_settings_get_pad_button_action (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *pad,
|
||||
guint button)
|
||||
meta_input_settings_get_pad_button_action (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *pad,
|
||||
guint button)
|
||||
{
|
||||
GDesktopPadButtonAction action;
|
||||
GSettings *settings;
|
||||
@ -1853,7 +1909,7 @@ meta_input_settings_get_pad_button_action (MetaInputSettings *input_settings,
|
||||
|
||||
#ifdef HAVE_LIBWACOM
|
||||
WacomDevice *
|
||||
meta_input_settings_get_tablet_wacom_device (MetaInputSettings *settings,
|
||||
meta_input_settings_get_tablet_wacom_device (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device)
|
||||
{
|
||||
MetaInputSettingsPrivate *priv;
|
||||
@ -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 }
|
||||
@ -1992,9 +2053,9 @@ emulate_modifiers (ClutterVirtualInputDevice *device,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_emulate_keybinding (MetaInputSettings *input_settings,
|
||||
const gchar *accel,
|
||||
gboolean is_press)
|
||||
meta_input_settings_emulate_keybinding (MetaInputSettings *input_settings,
|
||||
const gchar *accel,
|
||||
gboolean is_press)
|
||||
{
|
||||
MetaInputSettingsPrivate *priv;
|
||||
ClutterKeyState state;
|
||||
@ -2039,14 +2100,16 @@ 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,
|
||||
ClutterInputDevice *pad,
|
||||
const ClutterPadButtonEvent *event)
|
||||
meta_input_settings_handle_pad_button (
|
||||
MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *pad,
|
||||
const ClutterPadButtonEvent *event)
|
||||
{
|
||||
GDesktopPadButtonAction action;
|
||||
gint button, group, mode;
|
||||
@ -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);
|
||||
@ -2109,12 +2174,12 @@ meta_input_settings_handle_pad_button (MetaInputSettings *input_settin
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_input_settings_handle_pad_action (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *pad,
|
||||
MetaPadActionType action,
|
||||
guint number,
|
||||
MetaPadDirection direction,
|
||||
guint mode)
|
||||
meta_input_settings_handle_pad_action (MetaInputSettings *input_settings,
|
||||
ClutterInputDevice *pad,
|
||||
MetaPadActionType action,
|
||||
guint number,
|
||||
MetaPadDirection direction,
|
||||
guint mode)
|
||||
{
|
||||
GSettings *settings;
|
||||
gboolean handled = FALSE;
|
||||
@ -2137,9 +2202,10 @@ meta_input_settings_handle_pad_action (MetaInputSettings *input_settings
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_input_settings_get_pad_action_direction (MetaInputSettings *input_settings,
|
||||
const ClutterEvent *event,
|
||||
MetaPadDirection *direction)
|
||||
meta_input_settings_get_pad_action_direction (
|
||||
MetaInputSettings *input_settings,
|
||||
const ClutterEvent *event,
|
||||
MetaPadDirection *direction)
|
||||
{
|
||||
MetaInputSettingsPrivate *priv;
|
||||
ClutterInputDevice *pad = clutter_event_get_device (event);
|
||||
@ -2178,7 +2244,7 @@ meta_input_settings_get_pad_action_direction (MetaInputSettings *input_settings
|
||||
value >= 0 && priv->last_pad_action_info.value >= 0)
|
||||
{
|
||||
*direction = (value - priv->last_pad_action_info.value) > 0 ?
|
||||
inc_dir : dec_dir;
|
||||
inc_dir : dec_dir;
|
||||
has_direction = TRUE;
|
||||
}
|
||||
|
||||
@ -2310,22 +2376,24 @@ 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)
|
||||
{
|
||||
case G_DESKTOP_PAD_BUTTON_ACTION_KEYBINDING:
|
||||
{
|
||||
GSettings *settings;
|
||||
gchar *accel;
|
||||
{
|
||||
GSettings *settings;
|
||||
gchar *accel;
|
||||
|
||||
settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON,
|
||||
button, META_PAD_DIRECTION_NONE, -1);
|
||||
accel = g_settings_get_string (settings, "keybinding");
|
||||
g_object_unref (settings);
|
||||
settings = lookup_pad_action_settings (pad, META_PAD_ACTION_BUTTON,
|
||||
button, META_PAD_DIRECTION_NONE,
|
||||
-1);
|
||||
accel = g_settings_get_string (settings, "keybinding");
|
||||
g_object_unref (settings);
|
||||
|
||||
return accel;
|
||||
}
|
||||
return accel;
|
||||
}
|
||||
case G_DESKTOP_PAD_BUTTON_ACTION_SWITCH_MONITOR:
|
||||
/* TRANSLATORS: This string refers to an action, cycles drawing tablets'
|
||||
* mapping through the available outputs.
|
||||
|
@ -30,8 +30,8 @@
|
||||
G_DEFINE_TYPE (MetaLogicalMonitor, meta_logical_monitor, G_TYPE_OBJECT)
|
||||
|
||||
static MetaMonitor *
|
||||
get_first_monitor (MetaMonitorManager *monitor_manager,
|
||||
GList *monitor_configs)
|
||||
get_first_monitor (MetaMonitorManager * monitor_manager,
|
||||
GList * monitor_configs)
|
||||
{
|
||||
MetaMonitorConfig *first_monitor_config;
|
||||
MetaMonitorSpec *first_monitor_spec;
|
||||
@ -89,9 +89,9 @@ meta_logical_monitor_new (MetaMonitorManager *monitor_manager,
|
||||
logical_monitor->is_presentation = TRUE;
|
||||
g_list_foreach (monitor_configs, (GFunc) add_monitor_from_config,
|
||||
&(AddMonitorFromConfigData) {
|
||||
.monitor_manager = monitor_manager,
|
||||
.logical_monitor = logical_monitor
|
||||
});
|
||||
.monitor_manager = monitor_manager,
|
||||
.logical_monitor = logical_monitor
|
||||
});
|
||||
|
||||
return logical_monitor;
|
||||
}
|
||||
@ -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
|
||||
@ -279,9 +280,9 @@ meta_logical_monitor_class_init (MetaLogicalMonitorClass *klass)
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_logical_monitor_has_neighbor (MetaLogicalMonitor *logical_monitor,
|
||||
MetaLogicalMonitor *neighbor,
|
||||
MetaDisplayDirection neighbor_direction)
|
||||
meta_logical_monitor_has_neighbor (MetaLogicalMonitor *logical_monitor,
|
||||
MetaLogicalMonitor *neighbor,
|
||||
MetaDisplayDirection neighbor_direction)
|
||||
{
|
||||
switch (neighbor_direction)
|
||||
{
|
||||
|
@ -330,14 +330,15 @@ meta_monitor_config_manager_assign (MetaMonitorManager *manager,
|
||||
static gboolean
|
||||
is_lid_closed (MetaMonitorManager *monitor_manager)
|
||||
{
|
||||
MetaBackend *backend;
|
||||
MetaBackend *backend;
|
||||
|
||||
backend = meta_monitor_manager_get_backend (monitor_manager);
|
||||
return meta_backend_is_lid_closed (backend);
|
||||
backend = meta_monitor_manager_get_backend (monitor_manager);
|
||||
return meta_backend_is_lid_closed (backend);
|
||||
}
|
||||
|
||||
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,8 +416,9 @@ typedef enum _MonitorMatchRule
|
||||
} MonitorMatchRule;
|
||||
|
||||
static MetaMonitor *
|
||||
find_monitor_with_highest_preferred_resolution (MetaMonitorManager *monitor_manager,
|
||||
MonitorMatchRule match_rule)
|
||||
find_monitor_with_highest_preferred_resolution (
|
||||
MetaMonitorManager *monitor_manager,
|
||||
MonitorMatchRule match_rule)
|
||||
{
|
||||
GList *monitors;
|
||||
GList *l;
|
||||
@ -517,12 +520,13 @@ create_monitor_config (MetaMonitor *monitor,
|
||||
}
|
||||
|
||||
static MetaLogicalMonitorConfig *
|
||||
create_preferred_logical_monitor_config (MetaMonitorManager *monitor_manager,
|
||||
MetaMonitor *monitor,
|
||||
int x,
|
||||
int y,
|
||||
MetaLogicalMonitorConfig *primary_logical_monitor_config,
|
||||
MetaLogicalMonitorLayoutMode layout_mode)
|
||||
create_preferred_logical_monitor_config (
|
||||
MetaMonitorManager *monitor_manager,
|
||||
MetaMonitor *monitor,
|
||||
int x,
|
||||
int y,
|
||||
MetaLogicalMonitorConfig *primary_logical_monitor_config,
|
||||
MetaLogicalMonitorLayoutMode layout_mode)
|
||||
{
|
||||
MetaMonitorMode *mode;
|
||||
int width, height;
|
||||
@ -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,
|
||||
MetaMonitorTransform transform)
|
||||
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,8 +1039,9 @@ create_for_switch_config_builtin (MetaMonitorConfigManager *config_manager)
|
||||
}
|
||||
|
||||
MetaMonitorsConfig *
|
||||
meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager *config_manager,
|
||||
MetaMonitorSwitchConfigType config_type)
|
||||
meta_monitor_config_manager_create_for_switch_config (
|
||||
MetaMonitorConfigManager *config_manager,
|
||||
MetaMonitorSwitchConfigType config_type)
|
||||
{
|
||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
||||
MetaMonitorsConfig *config;
|
||||
@ -1049,8 +1076,9 @@ meta_monitor_config_manager_create_for_switch_config (MetaMonitorConfigManager
|
||||
}
|
||||
|
||||
void
|
||||
meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_manager,
|
||||
MetaMonitorsConfig *config)
|
||||
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);
|
||||
@ -1244,17 +1279,18 @@ meta_monitors_config_get_switch_config (MetaMonitorsConfig *config)
|
||||
}
|
||||
|
||||
void
|
||||
meta_monitors_config_set_switch_config (MetaMonitorsConfig *config,
|
||||
MetaMonitorSwitchConfigType switch_config)
|
||||
meta_monitors_config_set_switch_config (MetaMonitorsConfig *config,
|
||||
MetaMonitorSwitchConfigType switch_config)
|
||||
{
|
||||
config->switch_config = switch_config;
|
||||
}
|
||||
|
||||
MetaMonitorsConfig *
|
||||
meta_monitors_config_new_full (GList *logical_monitor_configs,
|
||||
GList *disabled_monitor_specs,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitorsConfigFlag flags)
|
||||
meta_monitors_config_new_full (
|
||||
GList *logical_monitor_configs,
|
||||
GList *disabled_monitor_specs,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitorsConfigFlag flags)
|
||||
{
|
||||
MetaMonitorsConfig *config;
|
||||
|
||||
@ -1271,10 +1307,10 @@ meta_monitors_config_new_full (GList *logical_monitor_con
|
||||
}
|
||||
|
||||
MetaMonitorsConfig *
|
||||
meta_monitors_config_new (MetaMonitorManager *monitor_manager,
|
||||
GList *logical_monitor_configs,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitorsConfigFlag flags)
|
||||
meta_monitors_config_new (MetaMonitorManager *monitor_manager,
|
||||
GList *logical_monitor_configs,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitorsConfigFlag flags)
|
||||
{
|
||||
GList *disabled_monitor_specs = NULL;
|
||||
GList *monitors;
|
||||
@ -1400,10 +1436,11 @@ meta_verify_monitor_config (MetaMonitorConfig *monitor_config,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitorManager *monitor_manager,
|
||||
GError **error)
|
||||
meta_verify_logical_monitor_config (
|
||||
MetaLogicalMonitorConfig *logical_monitor_config,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitorManager *monitor_manager,
|
||||
GError **error)
|
||||
{
|
||||
GList *l;
|
||||
int expected_mode_width = 0;
|
||||
@ -1494,8 +1531,9 @@ has_adjecent_neighbour (MetaMonitorsConfig *config,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_logical_monitor_configs_have_monitor (GList *logical_monitor_configs,
|
||||
MetaMonitorSpec *monitor_spec)
|
||||
meta_logical_monitor_configs_have_monitor (
|
||||
GList *logical_monitor_configs,
|
||||
MetaMonitorSpec *monitor_spec)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
@ -1521,8 +1559,9 @@ static gboolean
|
||||
meta_monitors_config_is_monitor_enabled (MetaMonitorsConfig *config,
|
||||
MetaMonitorSpec *monitor_spec)
|
||||
{
|
||||
return meta_logical_monitor_configs_have_monitor (config->logical_monitor_configs,
|
||||
monitor_spec);
|
||||
return meta_logical_monitor_configs_have_monitor (
|
||||
config->logical_monitor_configs,
|
||||
monitor_spec);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -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,10 +45,11 @@
|
||||
#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,
|
||||
G_DEFINE_QUARK (meta - monitors - config - migration - error - quark,
|
||||
meta_monitors_config_migration_error)
|
||||
|
||||
enum _MetaConfigMigrationError
|
||||
@ -198,125 +200,125 @@ handle_start_element (GMarkupParseContext *context,
|
||||
switch (parser->state)
|
||||
{
|
||||
case STATE_INITIAL:
|
||||
{
|
||||
char *version;
|
||||
{
|
||||
char *version;
|
||||
|
||||
if (strcmp (element_name, "monitors") != 0)
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
|
||||
"Invalid document element %s", element_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!g_markup_collect_attributes (element_name,
|
||||
attribute_names,
|
||||
attribute_values,
|
||||
error,
|
||||
G_MARKUP_COLLECT_STRING,
|
||||
"version", &version,
|
||||
G_MARKUP_COLLECT_INVALID))
|
||||
if (strcmp (element_name, "monitors") != 0)
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
|
||||
"Invalid document element %s", element_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (version, "1") != 0)
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Invalid or unsupported version %s", version);
|
||||
return;
|
||||
}
|
||||
|
||||
parser->state = STATE_MONITORS;
|
||||
if (!g_markup_collect_attributes (element_name,
|
||||
attribute_names,
|
||||
attribute_values,
|
||||
error,
|
||||
G_MARKUP_COLLECT_STRING,
|
||||
"version", &version,
|
||||
G_MARKUP_COLLECT_INVALID))
|
||||
return;
|
||||
}
|
||||
|
||||
if (strcmp (version, "1") != 0)
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Invalid or unsupported version %s", version);
|
||||
return;
|
||||
}
|
||||
|
||||
parser->state = STATE_MONITORS;
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_MONITORS:
|
||||
{
|
||||
if (strcmp (element_name, "configuration") != 0)
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
|
||||
"Invalid toplevel element %s", element_name);
|
||||
return;
|
||||
}
|
||||
{
|
||||
if (strcmp (element_name, "configuration") != 0)
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
|
||||
"Invalid toplevel element %s", element_name);
|
||||
return;
|
||||
}
|
||||
|
||||
parser->key_array = g_array_new (FALSE, FALSE,
|
||||
sizeof (MetaOutputKey));
|
||||
parser->output_array = g_array_new (FALSE, FALSE,
|
||||
sizeof (MetaOutputConfig));
|
||||
parser->state = STATE_CONFIGURATION;
|
||||
return;
|
||||
}
|
||||
parser->key_array = g_array_new (FALSE, FALSE,
|
||||
sizeof (MetaOutputKey));
|
||||
parser->output_array = g_array_new (FALSE, FALSE,
|
||||
sizeof (MetaOutputConfig));
|
||||
parser->state = STATE_CONFIGURATION;
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_CONFIGURATION:
|
||||
{
|
||||
if (strcmp (element_name, "clone") == 0 &&
|
||||
parser->unknown_count == 0)
|
||||
{
|
||||
parser->state = STATE_CLONE;
|
||||
}
|
||||
else if (strcmp (element_name, "output") == 0 &&
|
||||
parser->unknown_count == 0)
|
||||
{
|
||||
char *name;
|
||||
{
|
||||
if (strcmp (element_name, "clone") == 0 &&
|
||||
parser->unknown_count == 0)
|
||||
{
|
||||
parser->state = STATE_CLONE;
|
||||
}
|
||||
else if (strcmp (element_name, "output") == 0 &&
|
||||
parser->unknown_count == 0)
|
||||
{
|
||||
char *name;
|
||||
|
||||
if (!g_markup_collect_attributes (element_name,
|
||||
attribute_names,
|
||||
attribute_values,
|
||||
error,
|
||||
G_MARKUP_COLLECT_STRING,
|
||||
"name", &name,
|
||||
G_MARKUP_COLLECT_INVALID))
|
||||
return;
|
||||
if (!g_markup_collect_attributes (element_name,
|
||||
attribute_names,
|
||||
attribute_values,
|
||||
error,
|
||||
G_MARKUP_COLLECT_STRING,
|
||||
"name", &name,
|
||||
G_MARKUP_COLLECT_INVALID))
|
||||
return;
|
||||
|
||||
memset (&parser->key, 0, sizeof (MetaOutputKey));
|
||||
memset (&parser->output, 0, sizeof (MetaOutputConfig));
|
||||
memset (&parser->key, 0, sizeof (MetaOutputKey));
|
||||
memset (&parser->output, 0, sizeof (MetaOutputConfig));
|
||||
|
||||
parser->key.connector = g_strdup (name);
|
||||
parser->state = STATE_OUTPUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->unknown_count++;
|
||||
}
|
||||
parser->key.connector = g_strdup (name);
|
||||
parser->state = STATE_OUTPUT;
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->unknown_count++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_OUTPUT:
|
||||
{
|
||||
if ((strcmp (element_name, "vendor") == 0 ||
|
||||
strcmp (element_name, "product") == 0 ||
|
||||
strcmp (element_name, "serial") == 0 ||
|
||||
strcmp (element_name, "width") == 0 ||
|
||||
strcmp (element_name, "height") == 0 ||
|
||||
strcmp (element_name, "rate") == 0 ||
|
||||
strcmp (element_name, "x") == 0 ||
|
||||
strcmp (element_name, "y") == 0 ||
|
||||
strcmp (element_name, "rotation") == 0 ||
|
||||
strcmp (element_name, "reflect_x") == 0 ||
|
||||
strcmp (element_name, "reflect_y") == 0 ||
|
||||
strcmp (element_name, "primary") == 0 ||
|
||||
strcmp (element_name, "presentation") == 0 ||
|
||||
strcmp (element_name, "underscanning") == 0) &&
|
||||
parser->unknown_count == 0)
|
||||
{
|
||||
parser->state = STATE_OUTPUT_FIELD;
|
||||
{
|
||||
if ((strcmp (element_name, "vendor") == 0 ||
|
||||
strcmp (element_name, "product") == 0 ||
|
||||
strcmp (element_name, "serial") == 0 ||
|
||||
strcmp (element_name, "width") == 0 ||
|
||||
strcmp (element_name, "height") == 0 ||
|
||||
strcmp (element_name, "rate") == 0 ||
|
||||
strcmp (element_name, "x") == 0 ||
|
||||
strcmp (element_name, "y") == 0 ||
|
||||
strcmp (element_name, "rotation") == 0 ||
|
||||
strcmp (element_name, "reflect_x") == 0 ||
|
||||
strcmp (element_name, "reflect_y") == 0 ||
|
||||
strcmp (element_name, "primary") == 0 ||
|
||||
strcmp (element_name, "presentation") == 0 ||
|
||||
strcmp (element_name, "underscanning") == 0) &&
|
||||
parser->unknown_count == 0)
|
||||
{
|
||||
parser->state = STATE_OUTPUT_FIELD;
|
||||
|
||||
parser->output_field = g_strdup (element_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->unknown_count++;
|
||||
}
|
||||
parser->output_field = g_strdup (element_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->unknown_count++;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_CLONE:
|
||||
case STATE_OUTPUT_FIELD:
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Unexpected element %s", element_name);
|
||||
return;
|
||||
}
|
||||
{
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Unexpected element %s", element_name);
|
||||
return;
|
||||
}
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
@ -334,92 +336,92 @@ handle_end_element (GMarkupParseContext *context,
|
||||
switch (parser->state)
|
||||
{
|
||||
case STATE_MONITORS:
|
||||
{
|
||||
parser->state = STATE_INITIAL;
|
||||
return;
|
||||
}
|
||||
{
|
||||
parser->state = STATE_INITIAL;
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_CONFIGURATION:
|
||||
{
|
||||
if (strcmp (element_name, "configuration") == 0 &&
|
||||
parser->unknown_count == 0)
|
||||
{
|
||||
MetaLegacyMonitorsConfig *config = legacy_config_new ();
|
||||
{
|
||||
if (strcmp (element_name, "configuration") == 0 &&
|
||||
parser->unknown_count == 0)
|
||||
{
|
||||
MetaLegacyMonitorsConfig *config = legacy_config_new ();
|
||||
|
||||
g_assert (parser->key_array->len == parser->output_array->len);
|
||||
g_assert (parser->key_array->len == parser->output_array->len);
|
||||
|
||||
config->n_outputs = parser->key_array->len;
|
||||
config->keys = (void*)g_array_free (parser->key_array, FALSE);
|
||||
config->outputs = (void*)g_array_free (parser->output_array, FALSE);
|
||||
config->n_outputs = parser->key_array->len;
|
||||
config->keys = (void *) g_array_free (parser->key_array, FALSE);
|
||||
config->outputs = (void *) g_array_free (parser->output_array, FALSE);
|
||||
|
||||
g_hash_table_replace (parser->configs, config, config);
|
||||
g_hash_table_replace (parser->configs, config, config);
|
||||
|
||||
parser->key_array = NULL;
|
||||
parser->output_array = NULL;
|
||||
parser->state = STATE_MONITORS;
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->unknown_count--;
|
||||
parser->key_array = NULL;
|
||||
parser->output_array = NULL;
|
||||
parser->state = STATE_MONITORS;
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->unknown_count--;
|
||||
|
||||
g_assert (parser->unknown_count >= 0);
|
||||
}
|
||||
g_assert (parser->unknown_count >= 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_OUTPUT:
|
||||
{
|
||||
if (strcmp (element_name, "output") == 0 && parser->unknown_count == 0)
|
||||
{
|
||||
if (parser->key.vendor == NULL ||
|
||||
parser->key.product == NULL ||
|
||||
parser->key.serial == NULL)
|
||||
{
|
||||
/* Disconnected output, ignore */
|
||||
free_output_key (&parser->key);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parser->output.rect.width == 0 ||
|
||||
parser->output.rect.height == 0)
|
||||
parser->output.enabled = FALSE;
|
||||
else
|
||||
parser->output.enabled = TRUE;
|
||||
{
|
||||
if (strcmp (element_name, "output") == 0 && parser->unknown_count == 0)
|
||||
{
|
||||
if (parser->key.vendor == NULL ||
|
||||
parser->key.product == NULL ||
|
||||
parser->key.serial == NULL)
|
||||
{
|
||||
/* Disconnected output, ignore */
|
||||
free_output_key (&parser->key);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (parser->output.rect.width == 0 ||
|
||||
parser->output.rect.height == 0)
|
||||
parser->output.enabled = FALSE;
|
||||
else
|
||||
parser->output.enabled = TRUE;
|
||||
|
||||
g_array_append_val (parser->key_array, parser->key);
|
||||
g_array_append_val (parser->output_array, parser->output);
|
||||
}
|
||||
g_array_append_val (parser->key_array, parser->key);
|
||||
g_array_append_val (parser->output_array, parser->output);
|
||||
}
|
||||
|
||||
memset (&parser->key, 0, sizeof (MetaOutputKey));
|
||||
memset (&parser->output, 0, sizeof (MetaOutputConfig));
|
||||
memset (&parser->key, 0, sizeof (MetaOutputKey));
|
||||
memset (&parser->output, 0, sizeof (MetaOutputConfig));
|
||||
|
||||
parser->state = STATE_CONFIGURATION;
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->unknown_count--;
|
||||
parser->state = STATE_CONFIGURATION;
|
||||
}
|
||||
else
|
||||
{
|
||||
parser->unknown_count--;
|
||||
|
||||
g_assert (parser->unknown_count >= 0);
|
||||
}
|
||||
g_assert (parser->unknown_count >= 0);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_CLONE:
|
||||
{
|
||||
parser->state = STATE_CONFIGURATION;
|
||||
return;
|
||||
}
|
||||
{
|
||||
parser->state = STATE_CONFIGURATION;
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_OUTPUT_FIELD:
|
||||
{
|
||||
g_free (parser->output_field);
|
||||
parser->output_field = NULL;
|
||||
{
|
||||
g_free (parser->output_field);
|
||||
parser->output_field = NULL;
|
||||
|
||||
parser->state = STATE_OUTPUT;
|
||||
return;
|
||||
}
|
||||
parser->state = STATE_OUTPUT;
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_INITIAL:
|
||||
default:
|
||||
@ -451,10 +453,10 @@ read_int (const char *text,
|
||||
}
|
||||
|
||||
static void
|
||||
read_float (const char *text,
|
||||
gsize text_len,
|
||||
gfloat *field,
|
||||
GError **error)
|
||||
read_float (const char *text,
|
||||
gsize text_len,
|
||||
gfloat *field,
|
||||
GError **error)
|
||||
{
|
||||
char buf[64];
|
||||
gfloat v;
|
||||
@ -474,9 +476,9 @@ read_float (const char *text,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
read_bool (const char *text,
|
||||
gsize text_len,
|
||||
GError **error)
|
||||
read_bool (const char *text,
|
||||
gsize text_len,
|
||||
GError **error)
|
||||
{
|
||||
if (strncmp (text, "no", text_len) == 0)
|
||||
return FALSE;
|
||||
@ -484,7 +486,7 @@ read_bool (const char *text,
|
||||
return TRUE;
|
||||
else
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Invalid boolean value %.*s", (int)text_len, text);
|
||||
"Invalid boolean value %.*s", (int) text_len, text);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@ -514,101 +516,101 @@ handle_text (GMarkupParseContext *context,
|
||||
switch (parser->state)
|
||||
{
|
||||
case STATE_MONITORS:
|
||||
{
|
||||
if (!is_all_whitespace (text, text_len))
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Unexpected content at this point");
|
||||
return;
|
||||
}
|
||||
{
|
||||
if (!is_all_whitespace (text, text_len))
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Unexpected content at this point");
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_CONFIGURATION:
|
||||
{
|
||||
if (parser->unknown_count == 0)
|
||||
{
|
||||
if (!is_all_whitespace (text, text_len))
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Unexpected content at this point");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handling unknown element, ignore */
|
||||
}
|
||||
{
|
||||
if (parser->unknown_count == 0)
|
||||
{
|
||||
if (!is_all_whitespace (text, text_len))
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Unexpected content at this point");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handling unknown element, ignore */
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_OUTPUT:
|
||||
{
|
||||
if (parser->unknown_count == 0)
|
||||
{
|
||||
if (!is_all_whitespace (text, text_len))
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Unexpected content at this point");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handling unknown element, ignore */
|
||||
}
|
||||
return;
|
||||
}
|
||||
{
|
||||
if (parser->unknown_count == 0)
|
||||
{
|
||||
if (!is_all_whitespace (text, text_len))
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Unexpected content at this point");
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Handling unknown element, ignore */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_CLONE:
|
||||
{
|
||||
/* Ignore the clone flag */
|
||||
return;
|
||||
}
|
||||
{
|
||||
/* Ignore the clone flag */
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_OUTPUT_FIELD:
|
||||
{
|
||||
if (strcmp (parser->output_field, "vendor") == 0)
|
||||
parser->key.vendor = g_strndup (text, text_len);
|
||||
else if (strcmp (parser->output_field, "product") == 0)
|
||||
parser->key.product = g_strndup (text, text_len);
|
||||
else if (strcmp (parser->output_field, "serial") == 0)
|
||||
parser->key.serial = g_strndup (text, text_len);
|
||||
else if (strcmp (parser->output_field, "width") == 0)
|
||||
read_int (text, text_len, &parser->output.rect.width, error);
|
||||
else if (strcmp (parser->output_field, "height") == 0)
|
||||
read_int (text, text_len, &parser->output.rect.height, error);
|
||||
else if (strcmp (parser->output_field, "rate") == 0)
|
||||
read_float (text, text_len, &parser->output.refresh_rate, error);
|
||||
else if (strcmp (parser->output_field, "x") == 0)
|
||||
read_int (text, text_len, &parser->output.rect.x, error);
|
||||
else if (strcmp (parser->output_field, "y") == 0)
|
||||
read_int (text, text_len, &parser->output.rect.y, error);
|
||||
else if (strcmp (parser->output_field, "rotation") == 0)
|
||||
{
|
||||
if (strncmp (text, "normal", text_len) == 0)
|
||||
parser->output.transform = META_MONITOR_TRANSFORM_NORMAL;
|
||||
else if (strncmp (text, "left", text_len) == 0)
|
||||
parser->output.transform = META_MONITOR_TRANSFORM_90;
|
||||
else if (strncmp (text, "upside_down", text_len) == 0)
|
||||
parser->output.transform = META_MONITOR_TRANSFORM_180;
|
||||
else if (strncmp (text, "right", text_len) == 0)
|
||||
parser->output.transform = META_MONITOR_TRANSFORM_270;
|
||||
else
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Invalid rotation type %.*s", (int)text_len, text);
|
||||
}
|
||||
else if (strcmp (parser->output_field, "reflect_x") == 0)
|
||||
parser->output.transform += read_bool (text, text_len, error) ?
|
||||
META_MONITOR_TRANSFORM_FLIPPED : 0;
|
||||
else if (strcmp (parser->output_field, "reflect_y") == 0)
|
||||
{
|
||||
if (read_bool (text, text_len, error))
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Y reflection is not supported");
|
||||
}
|
||||
else if (strcmp (parser->output_field, "primary") == 0)
|
||||
parser->output.is_primary = read_bool (text, text_len, error);
|
||||
else if (strcmp (parser->output_field, "presentation") == 0)
|
||||
parser->output.is_presentation = read_bool (text, text_len, error);
|
||||
else if (strcmp (parser->output_field, "underscanning") == 0)
|
||||
parser->output.is_underscanning = read_bool (text, text_len, error);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
}
|
||||
{
|
||||
if (strcmp (parser->output_field, "vendor") == 0)
|
||||
parser->key.vendor = g_strndup (text, text_len);
|
||||
else if (strcmp (parser->output_field, "product") == 0)
|
||||
parser->key.product = g_strndup (text, text_len);
|
||||
else if (strcmp (parser->output_field, "serial") == 0)
|
||||
parser->key.serial = g_strndup (text, text_len);
|
||||
else if (strcmp (parser->output_field, "width") == 0)
|
||||
read_int (text, text_len, &parser->output.rect.width, error);
|
||||
else if (strcmp (parser->output_field, "height") == 0)
|
||||
read_int (text, text_len, &parser->output.rect.height, error);
|
||||
else if (strcmp (parser->output_field, "rate") == 0)
|
||||
read_float (text, text_len, &parser->output.refresh_rate, error);
|
||||
else if (strcmp (parser->output_field, "x") == 0)
|
||||
read_int (text, text_len, &parser->output.rect.x, error);
|
||||
else if (strcmp (parser->output_field, "y") == 0)
|
||||
read_int (text, text_len, &parser->output.rect.y, error);
|
||||
else if (strcmp (parser->output_field, "rotation") == 0)
|
||||
{
|
||||
if (strncmp (text, "normal", text_len) == 0)
|
||||
parser->output.transform = META_MONITOR_TRANSFORM_NORMAL;
|
||||
else if (strncmp (text, "left", text_len) == 0)
|
||||
parser->output.transform = META_MONITOR_TRANSFORM_90;
|
||||
else if (strncmp (text, "upside_down", text_len) == 0)
|
||||
parser->output.transform = META_MONITOR_TRANSFORM_180;
|
||||
else if (strncmp (text, "right", text_len) == 0)
|
||||
parser->output.transform = META_MONITOR_TRANSFORM_270;
|
||||
else
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Invalid rotation type %.*s", (int) text_len, text);
|
||||
}
|
||||
else if (strcmp (parser->output_field, "reflect_x") == 0)
|
||||
parser->output.transform += read_bool (text, text_len, error) ?
|
||||
META_MONITOR_TRANSFORM_FLIPPED : 0;
|
||||
else if (strcmp (parser->output_field, "reflect_y") == 0)
|
||||
{
|
||||
if (read_bool (text, text_len, error))
|
||||
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT,
|
||||
"Y reflection is not supported");
|
||||
}
|
||||
else if (strcmp (parser->output_field, "primary") == 0)
|
||||
parser->output.is_primary = read_bool (text, text_len, error);
|
||||
else if (strcmp (parser->output_field, "presentation") == 0)
|
||||
parser->output.is_presentation = read_bool (text, text_len, error);
|
||||
else if (strcmp (parser->output_field, "underscanning") == 0)
|
||||
parser->output.is_underscanning = read_bool (text, text_len, error);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
}
|
||||
|
||||
case STATE_INITIAL:
|
||||
default:
|
||||
@ -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,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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,
|
||||
@ -483,7 +486,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
|
||||
for (j = 0; j < crtc_info->outputs->len; j++)
|
||||
{
|
||||
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
||||
output = ((MetaOutput **) crtc_info->outputs->pdata)[j];
|
||||
|
||||
output->is_dirty = TRUE;
|
||||
meta_output_assign_crtc (output, crtc);
|
||||
@ -566,10 +569,11 @@ update_screen_size (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_monitor_manager_dummy_apply_monitors_config (MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config,
|
||||
MetaMonitorsConfigMethod method,
|
||||
GError **error)
|
||||
meta_monitor_manager_dummy_apply_monitors_config (
|
||||
MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config,
|
||||
MetaMonitorsConfigMethod method,
|
||||
GError **error)
|
||||
{
|
||||
GPtrArray *crtc_infos;
|
||||
GPtrArray *output_infos;
|
||||
@ -621,9 +625,10 @@ meta_monitor_manager_dummy_is_transform_handled (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
static float
|
||||
meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *manager,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode)
|
||||
meta_monitor_manager_dummy_calculate_monitor_mode_scale (
|
||||
MetaMonitorManager *manager,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode)
|
||||
{
|
||||
MetaOutput *output;
|
||||
MetaOutputDummy *output_dummy;
|
||||
@ -635,11 +640,12 @@ meta_monitor_manager_dummy_calculate_monitor_mode_scale (MetaMonitorManager *man
|
||||
}
|
||||
|
||||
static float *
|
||||
meta_monitor_manager_dummy_calculate_supported_scales (MetaMonitorManager *manager,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
int *n_supported_scales)
|
||||
meta_monitor_manager_dummy_calculate_supported_scales (
|
||||
MetaMonitorManager *manager,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
int *n_supported_scales)
|
||||
{
|
||||
MetaMonitorScalesConstraint constraints =
|
||||
META_MONITOR_SCALES_CONSTRAINT_NONE;
|
||||
@ -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
|
||||
@ -748,8 +761,8 @@ meta_monitor_manager_dummy_init (MetaMonitorManagerDummy *manager_dummy)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_gpu_dummy_read_current (MetaGpu *gpu,
|
||||
GError **error)
|
||||
meta_gpu_dummy_read_current (MetaGpu *gpu,
|
||||
GError **error)
|
||||
{
|
||||
MetaMonitorManager *manager = meta_gpu_get_monitor_manager (gpu);
|
||||
|
||||
|
@ -58,30 +58,36 @@ 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] = {
|
||||
{ 1, 0, 0, 0, 1, 0 }, /* normal */
|
||||
{ 0, -1, 1, 1, 0, 0 }, /* 90° */
|
||||
{ -1, 0, 1, 0, -1, 1 }, /* 180° */
|
||||
{ 0, 1, 0, -1, 0, 1 }, /* 270° */
|
||||
{ -1, 0, 1, 0, 1, 0 }, /* normal flipped */
|
||||
{ 0, 1, 0, 1, 0, 0 }, /* 90° flipped */
|
||||
{ 1, 0, 0, 0, -1, 1 }, /* 180° flipped */
|
||||
{ 0, -1, 1, -1, 0, 1 }, /* 270° flipped */
|
||||
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° */
|
||||
{ 0, 1, 0, -1, 0, 1 }, /* 270° */
|
||||
{ -1, 0, 1, 0, 1, 0 }, /* normal flipped */
|
||||
{ 0, 1, 0, 1, 0, 0 }, /* 90° flipped */
|
||||
{ 1, 0, 0, 0, -1, 1 }, /* 180° flipped */
|
||||
{ 0, -1, 1, -1, 0, 1 }, /* 270° flipped */
|
||||
};
|
||||
|
||||
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,8 +240,9 @@ derive_scale_from_config (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_rebuild_logical_monitors_derived (MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config)
|
||||
meta_monitor_manager_rebuild_logical_monitors_derived (
|
||||
MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config)
|
||||
{
|
||||
GList *logical_monitors = NULL;
|
||||
GList *l;
|
||||
@ -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,11 +384,12 @@ meta_monitor_manager_calculate_monitor_mode_scale (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
float *
|
||||
meta_monitor_manager_calculate_supported_scales (MetaMonitorManager *manager,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
int *n_supported_scales)
|
||||
meta_monitor_manager_calculate_supported_scales (
|
||||
MetaMonitorManager *manager,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
int *n_supported_scales)
|
||||
{
|
||||
MetaMonitorManagerClass *manager_class =
|
||||
META_MONITOR_MANAGER_GET_CLASS (manager);
|
||||
@ -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,8 +573,9 @@ meta_monitor_manager_ensure_configured (MetaMonitorManager *manager)
|
||||
}
|
||||
|
||||
config =
|
||||
meta_monitor_config_manager_create_for_switch_config (manager->config_manager,
|
||||
META_MONITOR_SWITCH_CONFIG_ALL_LINEAR);
|
||||
meta_monitor_config_manager_create_for_switch_config (
|
||||
manager->config_manager,
|
||||
META_MONITOR_SWITCH_CONFIG_ALL_LINEAR);
|
||||
if (config)
|
||||
{
|
||||
if (!meta_monitor_manager_apply_monitors_config (manager,
|
||||
@ -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,
|
||||
@ -836,11 +850,11 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
|
||||
|
||||
signals[CONFIRM_DISPLAY_CHANGE] =
|
||||
g_signal_new ("confirm-display-change",
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 0);
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
obj_props[PROP_BACKEND] =
|
||||
g_param_spec_object ("backend",
|
||||
@ -853,10 +867,11 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
|
||||
g_object_class_install_properties (object_class, PROP_LAST, obj_props);
|
||||
}
|
||||
|
||||
static const double known_diagonals[] = {
|
||||
12.1,
|
||||
13.3,
|
||||
15.6
|
||||
static const double known_diagonals[] =
|
||||
{
|
||||
12.1,
|
||||
13.3,
|
||||
15.6
|
||||
};
|
||||
|
||||
static char *
|
||||
@ -868,7 +883,7 @@ diagonal_to_str (double d)
|
||||
{
|
||||
double delta;
|
||||
|
||||
delta = fabs(known_diagonals[i] - d);
|
||||
delta = fabs (known_diagonals[i] - d);
|
||||
if (delta < 0.1)
|
||||
return g_strdup_printf ("%0.1lf\"", known_diagonals[i]);
|
||||
}
|
||||
@ -884,7 +899,7 @@ make_display_name (MetaMonitorManager *manager,
|
||||
g_autofree char *vendor_name = NULL;
|
||||
|
||||
if (meta_output_is_laptop (output))
|
||||
return g_strdup (_("Built-in display"));
|
||||
return g_strdup (_("Built-in display"));
|
||||
|
||||
if (output->width_mm > 0 && output->height_mm > 0)
|
||||
{
|
||||
@ -952,8 +967,8 @@ get_connector_type_name (MetaConnectorType connector_type)
|
||||
}
|
||||
|
||||
static GList *
|
||||
combine_gpu_lists (MetaMonitorManager *manager,
|
||||
GList * (*list_getter) (MetaGpu *gpu))
|
||||
combine_gpu_lists (MetaMonitorManager *manager,
|
||||
GList * (*list_getter)(MetaGpu *gpu))
|
||||
{
|
||||
GList *list = NULL;
|
||||
GList *l;
|
||||
@ -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++)
|
||||
@ -1008,13 +1025,13 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
current_mode_index = -1;
|
||||
g_variant_builder_add (&crtc_builder, "(uxiiiiiuaua{sv})",
|
||||
i, /* ID */
|
||||
(gint64)crtc->crtc_id,
|
||||
(int)crtc->rect.x,
|
||||
(int)crtc->rect.y,
|
||||
(int)crtc->rect.width,
|
||||
(int)crtc->rect.height,
|
||||
(gint64) crtc->crtc_id,
|
||||
(int) crtc->rect.x,
|
||||
(int) crtc->rect.y,
|
||||
(int) crtc->rect.width,
|
||||
(int) crtc->rect.height,
|
||||
current_mode_index,
|
||||
(guint32)crtc->transform,
|
||||
(guint32) crtc->transform,
|
||||
&transforms,
|
||||
NULL /* properties */);
|
||||
}
|
||||
@ -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);
|
||||
}
|
||||
@ -1123,7 +1147,7 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
crtc_index = crtc ? g_list_index (combined_crtcs, crtc) : -1;
|
||||
g_variant_builder_add (&output_builder, "(uxiausauaua{sv})",
|
||||
i, /* ID */
|
||||
(gint64)output->winsys_id,
|
||||
(gint64) output->winsys_id,
|
||||
crtc_index,
|
||||
&crtcs,
|
||||
output->name,
|
||||
@ -1138,11 +1162,11 @@ meta_monitor_manager_handle_get_resources (MetaDBusDisplayConfig *skeleton,
|
||||
|
||||
g_variant_builder_add (&mode_builder, "(uxuudu)",
|
||||
i, /* ID */
|
||||
(gint64)mode->mode_id,
|
||||
(guint32)mode->width,
|
||||
(guint32)mode->height,
|
||||
(double)mode->refresh_rate,
|
||||
(guint32)mode->flags);
|
||||
(gint64) mode->mode_id,
|
||||
(guint32) mode->width,
|
||||
(guint32) mode->height,
|
||||
(double) mode->refresh_rate,
|
||||
(guint32) mode->flags);
|
||||
}
|
||||
|
||||
if (!meta_monitor_manager_get_max_screen_size (manager,
|
||||
@ -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,9 +1258,10 @@ 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 (),
|
||||
save_config_timeout,
|
||||
manager);
|
||||
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,
|
||||
"[mutter] save_config_timeout");
|
||||
|
||||
@ -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,10 +1809,11 @@ derive_logical_monitor_size (MetaMonitorConfig *monitor_config,
|
||||
}
|
||||
|
||||
static MetaLogicalMonitorConfig *
|
||||
create_logical_monitor_config_from_variant (MetaMonitorManager *manager,
|
||||
GVariant *logical_monitor_config_variant,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
GError **error)
|
||||
create_logical_monitor_config_from_variant (
|
||||
MetaMonitorManager *manager,
|
||||
GVariant *logical_monitor_config_variant,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
GError **error)
|
||||
{
|
||||
MetaLogicalMonitorConfig *logical_monitor_config;
|
||||
int x, y, width, height;
|
||||
@ -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,12 +1926,13 @@ is_valid_layout_mode (MetaLogicalMonitorLayoutMode layout_mode)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_monitor_manager_handle_apply_monitors_config (MetaDBusDisplayConfig *skeleton,
|
||||
GDBusMethodInvocation *invocation,
|
||||
guint serial,
|
||||
guint method,
|
||||
GVariant *logical_monitor_configs_variant,
|
||||
GVariant *properties_variant)
|
||||
meta_monitor_manager_handle_apply_monitors_config (
|
||||
MetaDBusDisplayConfig *skeleton,
|
||||
GDBusMethodInvocation *invocation,
|
||||
guint serial,
|
||||
guint method,
|
||||
GVariant *logical_monitor_configs_variant,
|
||||
GVariant *properties_variant)
|
||||
{
|
||||
MetaMonitorManager *manager = META_MONITOR_MANAGER (skeleton);
|
||||
MetaMonitorManagerCapability capabilities;
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -2230,9 +2264,9 @@ meta_monitor_manager_handle_set_crtc_gamma (MetaDBusDisplayConfig *skeleton,
|
||||
blue_bytes = g_variant_get_data_as_bytes (blue_v);
|
||||
|
||||
size = g_bytes_get_size (red_bytes) / sizeof (unsigned short);
|
||||
red = (unsigned short*) g_bytes_get_data (red_bytes, &dummy);
|
||||
green = (unsigned short*) g_bytes_get_data (green_bytes, &dummy);
|
||||
blue = (unsigned short*) g_bytes_get_data (blue_bytes, &dummy);
|
||||
red = (unsigned short *) g_bytes_get_data (red_bytes, &dummy);
|
||||
green = (unsigned short *) g_bytes_get_data (green_bytes, &dummy);
|
||||
blue = (unsigned short *) g_bytes_get_data (blue_bytes, &dummy);
|
||||
|
||||
klass = META_MONITOR_MANAGER_GET_CLASS (manager);
|
||||
if (klass->set_crtc_gamma)
|
||||
@ -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,
|
||||
int number)
|
||||
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;
|
||||
}
|
||||
@ -2345,7 +2383,7 @@ meta_monitor_manager_get_primary_logical_monitor (MetaMonitorManager *manager)
|
||||
|
||||
static MetaMonitor *
|
||||
find_monitor (MetaMonitorManager *monitor_manager,
|
||||
gboolean (*match_func) (MetaMonitor *monitor))
|
||||
gboolean (*match_func)(MetaMonitor *monitor))
|
||||
{
|
||||
GList *monitors;
|
||||
GList *l;
|
||||
@ -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,13 +2831,14 @@ 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);
|
||||
}
|
||||
|
||||
out:
|
||||
out:
|
||||
if (!output->vendor)
|
||||
output->vendor = g_strdup ("unknown");
|
||||
if (!output->product)
|
||||
@ -2837,7 +2877,7 @@ calculate_viewport_matrix (MetaMonitorManager *manager,
|
||||
|
||||
x = (float) logical_monitor->rect.x / manager->screen_width;
|
||||
y = (float) logical_monitor->rect.y / manager->screen_height;
|
||||
width = (float) logical_monitor->rect.width / manager->screen_width;
|
||||
width = (float) logical_monitor->rect.width / manager->screen_width;
|
||||
height = (float) logical_monitor->rect.height / manager->screen_height;
|
||||
|
||||
viewport[0] = width;
|
||||
@ -2852,8 +2892,8 @@ calculate_viewport_matrix (MetaMonitorManager *manager,
|
||||
|
||||
static inline void
|
||||
multiply_matrix (float a[6],
|
||||
float b[6],
|
||||
float res[6])
|
||||
float b[6],
|
||||
float res[6])
|
||||
{
|
||||
res[0] = a[0] * b[0] + a[1] * b[3];
|
||||
res[1] = a[0] * b[1] + a[1] * b[4];
|
||||
@ -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;
|
||||
@ -2946,8 +2987,8 @@ meta_monitor_manager_rotate_monitor (MetaMonitorManager *manager)
|
||||
}
|
||||
|
||||
void
|
||||
meta_monitor_manager_switch_config (MetaMonitorManager *manager,
|
||||
MetaMonitorSwitchConfigType config_type)
|
||||
meta_monitor_manager_switch_config (MetaMonitorManager *manager,
|
||||
MetaMonitorSwitchConfigType config_type)
|
||||
{
|
||||
GError *error = NULL;
|
||||
MetaMonitorsConfig *config;
|
||||
@ -2955,8 +2996,9 @@ 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,
|
||||
config_type);
|
||||
meta_monitor_config_manager_create_for_switch_config (
|
||||
manager->config_manager,
|
||||
config_type);
|
||||
if (!config)
|
||||
return;
|
||||
|
||||
|
@ -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));
|
||||
@ -353,8 +354,8 @@ meta_monitor_get_connector_type (MetaMonitor *monitor)
|
||||
}
|
||||
|
||||
MetaMonitorTransform
|
||||
meta_monitor_logical_to_crtc_transform (MetaMonitor *monitor,
|
||||
MetaMonitorTransform transform)
|
||||
meta_monitor_logical_to_crtc_transform (MetaMonitor *monitor,
|
||||
MetaMonitorTransform transform)
|
||||
{
|
||||
MetaOutput *output = meta_monitor_get_main_output (monitor);
|
||||
MetaMonitorTransform new_transform;
|
||||
@ -368,8 +369,8 @@ meta_monitor_logical_to_crtc_transform (MetaMonitor *monitor,
|
||||
}
|
||||
|
||||
MetaMonitorTransform
|
||||
meta_monitor_crtc_to_logical_transform (MetaMonitor *monitor,
|
||||
MetaMonitorTransform transform)
|
||||
meta_monitor_crtc_to_logical_transform (MetaMonitor *monitor,
|
||||
MetaMonitorTransform transform)
|
||||
{
|
||||
MetaOutput *output = meta_monitor_get_main_output (monitor);
|
||||
MetaMonitorTransform new_transform;
|
||||
@ -483,10 +484,10 @@ meta_monitor_create_spec (MetaMonitor *monitor,
|
||||
}
|
||||
|
||||
return (MetaMonitorModeSpec) {
|
||||
.width = width,
|
||||
.height = height,
|
||||
.refresh_rate = crtc_mode->refresh_rate,
|
||||
.flags = crtc_mode->flags & HANDLED_CRTC_MODE_FLAGS
|
||||
.width = width,
|
||||
.height = height,
|
||||
.refresh_rate = crtc_mode->refresh_rate,
|
||||
.flags = crtc_mode->flags & HANDLED_CRTC_MODE_FLAGS
|
||||
};
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ typedef struct _MetaOutputPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaOutput, meta_output, G_TYPE_OBJECT)
|
||||
|
||||
MetaGpu *
|
||||
meta_output_get_gpu (MetaOutput *output)
|
||||
meta_output_get_gpu (MetaOutput * output)
|
||||
{
|
||||
return output->gpu;
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ meta_pointer_constraint_constrain (MetaPointerConstraint *constraint,
|
||||
guint32 time,
|
||||
float prev_x,
|
||||
float prev_y,
|
||||
float *x,
|
||||
float *y)
|
||||
float *x,
|
||||
float *y)
|
||||
{
|
||||
META_POINTER_CONSTRAINT_GET_CLASS (constraint)->constrain (constraint,
|
||||
device,
|
||||
|
@ -87,8 +87,9 @@ meta_remote_access_handle_notify_stopped (MetaRemoteAccessHandle *handle)
|
||||
}
|
||||
|
||||
void
|
||||
meta_remote_access_controller_notify_new_handle (MetaRemoteAccessController *controller,
|
||||
MetaRemoteAccessHandle *handle)
|
||||
meta_remote_access_controller_notify_new_handle (
|
||||
MetaRemoteAccessController *controller,
|
||||
MetaRemoteAccessHandle *handle)
|
||||
{
|
||||
g_signal_emit (controller, controller_signals[CONTROLLER_NEW_HANDLE], 0,
|
||||
handle);
|
||||
|
@ -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,8 +75,9 @@ 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,
|
||||
meta_remote_desktop_session_init_iface)
|
||||
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))
|
||||
|
||||
@ -90,7 +93,7 @@ G_DEFINE_TYPE (MetaRemoteDesktopSessionHandle,
|
||||
META_TYPE_REMOTE_ACCESS_HANDLE)
|
||||
|
||||
static MetaRemoteDesktopSessionHandle *
|
||||
meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession *session);
|
||||
meta_remote_desktop_session_handle_new (MetaRemoteDesktopSession * session);
|
||||
|
||||
static gboolean
|
||||
meta_remote_desktop_session_is_running (MetaRemoteDesktopSession *session)
|
||||
@ -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,9 +201,10 @@ on_screen_cast_session_closed (MetaScreenCastSession *screen_cast_session,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_remote_desktop_session_register_screen_cast (MetaRemoteDesktopSession *session,
|
||||
MetaScreenCastSession *screen_cast_session,
|
||||
GError **error)
|
||||
meta_remote_desktop_session_register_screen_cast (
|
||||
MetaRemoteDesktopSession *session,
|
||||
MetaScreenCastSession *screen_cast_session,
|
||||
GError **error)
|
||||
{
|
||||
if (session->screen_cast_session)
|
||||
{
|
||||
@ -219,9 +224,9 @@ meta_remote_desktop_session_register_screen_cast (MetaRemoteDesktopSession *ses
|
||||
}
|
||||
|
||||
MetaRemoteDesktopSession *
|
||||
meta_remote_desktop_session_new (MetaRemoteDesktop *remote_desktop,
|
||||
const char *peer_name,
|
||||
GError **error)
|
||||
meta_remote_desktop_session_new (MetaRemoteDesktop *remote_desktop,
|
||||
const char *peer_name,
|
||||
GError **error)
|
||||
{
|
||||
GDBusInterfaceSkeleton *interface_skeleton;
|
||||
MetaRemoteDesktopSession *session;
|
||||
@ -452,11 +457,12 @@ handle_notify_pointer_axis (MetaDBusRemoteDesktopSession *skeleton,
|
||||
CLUTTER_SCROLL_FINISHED_VERTICAL);
|
||||
}
|
||||
|
||||
clutter_virtual_input_device_notify_scroll_continuous (session->virtual_pointer,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
dx, dy,
|
||||
CLUTTER_SCROLL_SOURCE_FINGER,
|
||||
finish_flags);
|
||||
clutter_virtual_input_device_notify_scroll_continuous (
|
||||
session->virtual_pointer,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
dx, dy,
|
||||
CLUTTER_SCROLL_SOURCE_FINGER,
|
||||
finish_flags);
|
||||
|
||||
meta_dbus_remote_desktop_session_complete_notify_pointer_axis (skeleton,
|
||||
invocation);
|
||||
@ -522,13 +528,15 @@ 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_CURRENT_TIME,
|
||||
direction,
|
||||
CLUTTER_SCROLL_SOURCE_WHEEL);
|
||||
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,
|
||||
invocation);
|
||||
meta_dbus_remote_desktop_session_complete_notify_pointer_axis_discrete (
|
||||
skeleton,
|
||||
invocation);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -553,8 +561,9 @@ handle_notify_pointer_motion_relative (MetaDBusRemoteDesktopSession *skeleton,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
dx, dy);
|
||||
|
||||
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_relative (skeleton,
|
||||
invocation);
|
||||
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_relative (
|
||||
skeleton,
|
||||
invocation);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -602,8 +611,9 @@ 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,
|
||||
invocation);
|
||||
meta_dbus_remote_desktop_session_complete_notify_pointer_motion_absolute (
|
||||
skeleton,
|
||||
invocation);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -699,10 +709,11 @@ 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_CURRENT_TIME,
|
||||
slot,
|
||||
abs_x, abs_y);
|
||||
clutter_virtual_input_device_notify_touch_motion (
|
||||
session->virtual_touchscreen,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
slot,
|
||||
abs_x, abs_y);
|
||||
|
||||
meta_dbus_remote_desktop_session_complete_notify_touch_motion (skeleton,
|
||||
invocation);
|
||||
@ -712,8 +723,8 @@ handle_notify_touch_motion (MetaDBusRemoteDesktopSession *skeleton,
|
||||
|
||||
static gboolean
|
||||
handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton,
|
||||
GDBusMethodInvocation *invocation,
|
||||
unsigned int slot)
|
||||
GDBusMethodInvocation *invocation,
|
||||
unsigned int slot)
|
||||
{
|
||||
MetaRemoteDesktopSession *session = META_REMOTE_DESKTOP_SESSION (skeleton);
|
||||
|
||||
@ -726,8 +737,8 @@ handle_notify_touch_up (MetaDBusRemoteDesktopSession *skeleton,
|
||||
}
|
||||
|
||||
clutter_virtual_input_device_notify_touch_up (session->virtual_touchscreen,
|
||||
CLUTTER_CURRENT_TIME,
|
||||
slot);
|
||||
CLUTTER_CURRENT_TIME,
|
||||
slot);
|
||||
|
||||
meta_dbus_remote_desktop_session_complete_notify_touch_up (skeleton,
|
||||
invocation);
|
||||
@ -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;
|
||||
@ -783,7 +797,7 @@ static void
|
||||
meta_remote_desktop_session_init (MetaRemoteDesktopSession *session)
|
||||
{
|
||||
MetaDBusRemoteDesktopSession *skeleton =
|
||||
META_DBUS_REMOTE_DESKTOP_SESSION (session);
|
||||
META_DBUS_REMOTE_DESKTOP_SESSION (session);
|
||||
GRand *rand;
|
||||
static unsigned int global_session_number = 0;
|
||||
|
||||
@ -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);
|
||||
|
@ -46,7 +46,7 @@ G_DEFINE_TYPE (MetaRendererView, meta_renderer_view,
|
||||
CLUTTER_TYPE_STAGE_VIEW_COGL)
|
||||
|
||||
MetaLogicalMonitor *
|
||||
meta_renderer_view_get_logical_monitor (MetaRendererView *view)
|
||||
meta_renderer_view_get_logical_monitor (MetaRendererView * view)
|
||||
{
|
||||
return view->logical_monitor;
|
||||
}
|
||||
@ -113,14 +113,15 @@ meta_renderer_view_setup_offscreen_blit_pipeline (ClutterStageView *view,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_renderer_view_set_transform (MetaRendererView *view,
|
||||
MetaMonitorTransform transform)
|
||||
meta_renderer_view_set_transform (MetaRendererView *view,
|
||||
MetaMonitorTransform transform)
|
||||
{
|
||||
if (view->transform == transform)
|
||||
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
|
||||
|
@ -38,7 +38,7 @@ typedef struct _MetaRendererPrivate
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaRenderer, meta_renderer, G_TYPE_OBJECT)
|
||||
|
||||
CoglRenderer *
|
||||
meta_renderer_create_cogl_renderer (MetaRenderer *renderer)
|
||||
meta_renderer_create_cogl_renderer (MetaRenderer * renderer)
|
||||
{
|
||||
return META_RENDERER_GET_CLASS (renderer)->create_cogl_renderer (renderer);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ G_DEFINE_TYPE (MetaScreenCastMonitorStreamSrc,
|
||||
META_TYPE_SCREEN_CAST_STREAM_SRC)
|
||||
|
||||
static ClutterStage *
|
||||
get_stage (MetaScreenCastMonitorStreamSrc *monitor_src)
|
||||
get_stage (MetaScreenCastMonitorStreamSrc * monitor_src)
|
||||
{
|
||||
MetaScreenCastStreamSrc *src;
|
||||
MetaScreenCastStream *stream;
|
||||
@ -146,8 +146,9 @@ meta_screen_cast_monitor_stream_src_record_frame (MetaScreenCastStreamSrc *src,
|
||||
}
|
||||
|
||||
MetaScreenCastMonitorStreamSrc *
|
||||
meta_screen_cast_monitor_stream_src_new (MetaScreenCastMonitorStream *monitor_stream,
|
||||
GError **error)
|
||||
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,
|
||||
"stream", monitor_stream,
|
||||
@ -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);
|
||||
|
@ -93,23 +93,25 @@ 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;
|
||||
}
|
||||
|
||||
MetaScreenCastMonitorStream *
|
||||
meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
|
||||
MetaMonitorManager *monitor_manager,
|
||||
MetaMonitor *monitor,
|
||||
ClutterStage *stage,
|
||||
GError **error)
|
||||
meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
|
||||
MetaMonitorManager *monitor_manager,
|
||||
MetaMonitor *monitor,
|
||||
ClutterStage *stage,
|
||||
GError **error)
|
||||
{
|
||||
MetaScreenCastMonitorStream *monitor_stream;
|
||||
|
||||
@ -138,8 +140,8 @@ meta_screen_cast_monitor_stream_new (GDBusConnection *connection,
|
||||
}
|
||||
|
||||
static MetaScreenCastStreamSrc *
|
||||
meta_screen_cast_monitor_stream_create_src (MetaScreenCastStream *stream,
|
||||
GError **error)
|
||||
meta_screen_cast_monitor_stream_create_src (MetaScreenCastStream *stream,
|
||||
GError **error)
|
||||
{
|
||||
MetaScreenCastMonitorStream *monitor_stream =
|
||||
META_SCREEN_CAST_MONITOR_STREAM (stream);
|
||||
@ -177,11 +179,12 @@ meta_screen_cast_monitor_stream_set_parameters (MetaScreenCastStream *stream,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_screen_cast_monitor_stream_transform_position (MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
double *x,
|
||||
double *y)
|
||||
meta_screen_cast_monitor_stream_transform_position (
|
||||
MetaScreenCastStream *stream,
|
||||
double stream_x,
|
||||
double stream_y,
|
||||
double *x,
|
||||
double *y)
|
||||
{
|
||||
MetaScreenCastMonitorStream *monitor_stream =
|
||||
META_SCREEN_CAST_MONITOR_STREAM (stream);
|
||||
@ -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,
|
||||
|
@ -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,8 +56,9 @@ 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,
|
||||
meta_screen_cast_session_init_iface)
|
||||
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))
|
||||
|
||||
@ -72,7 +74,7 @@ G_DEFINE_TYPE (MetaScreenCastSessionHandle,
|
||||
META_TYPE_REMOTE_ACCESS_HANDLE)
|
||||
|
||||
static MetaScreenCastSessionHandle *
|
||||
meta_screen_cast_session_handle_new (MetaScreenCastSession *session);
|
||||
meta_screen_cast_session_handle_new (MetaScreenCastSession * session);
|
||||
|
||||
static void
|
||||
init_remote_access_handle (MetaScreenCastSession *session)
|
||||
@ -83,15 +85,16 @@ 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);
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_screen_cast_session_start (MetaScreenCastSession *session,
|
||||
GError **error)
|
||||
meta_screen_cast_session_start (MetaScreenCastSession *session,
|
||||
GError **error)
|
||||
{
|
||||
GList *l;
|
||||
|
||||
@ -370,10 +373,10 @@ meta_dbus_session_init_iface (MetaDbusSessionInterface *iface)
|
||||
}
|
||||
|
||||
MetaScreenCastSession *
|
||||
meta_screen_cast_session_new (MetaScreenCast *screen_cast,
|
||||
MetaScreenCastSessionType session_type,
|
||||
const char *peer_name,
|
||||
GError **error)
|
||||
meta_screen_cast_session_new (MetaScreenCast *screen_cast,
|
||||
MetaScreenCastSessionType session_type,
|
||||
const char *peer_name,
|
||||
GError **error)
|
||||
{
|
||||
GDBusInterfaceSkeleton *interface_skeleton;
|
||||
MetaScreenCastSession *session;
|
||||
@ -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);
|
||||
|
@ -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)
|
||||
@ -230,10 +232,10 @@ meta_screen_cast_stream_src_notify_closed (MetaScreenCastStreamSrc *src)
|
||||
}
|
||||
|
||||
static void
|
||||
on_stream_state_changed (void *data,
|
||||
enum pw_stream_state old,
|
||||
enum pw_stream_state state,
|
||||
const char *error_message)
|
||||
on_stream_state_changed (void *data,
|
||||
enum pw_stream_state old,
|
||||
enum pw_stream_state state,
|
||||
const char *error_message)
|
||||
{
|
||||
MetaScreenCastStreamSrc *src = data;
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
@ -307,15 +309,16 @@ 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,
|
||||
};
|
||||
|
||||
static struct pw_stream *
|
||||
create_pipewire_stream (MetaScreenCastStreamSrc *src,
|
||||
GError **error)
|
||||
create_pipewire_stream (MetaScreenCastStreamSrc *src,
|
||||
GError **error)
|
||||
{
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
meta_screen_cast_stream_src_get_instance_private (src);
|
||||
@ -360,8 +363,8 @@ create_pipewire_stream (MetaScreenCastStreamSrc *src,
|
||||
":", spa_type->format_video.size, "R", &SPA_RECTANGLE (width, height),
|
||||
":", spa_type->format_video.framerate, "F", &SPA_FRACTION (0, 1),
|
||||
":", spa_type->format_video.max_framerate, "Fru", &max_framerate,
|
||||
PROP_RANGE (&min_framerate,
|
||||
&max_framerate));
|
||||
PROP_RANGE (&min_framerate,
|
||||
&max_framerate));
|
||||
|
||||
pw_stream_add_listener (pipewire_stream,
|
||||
&priv->pipewire_stream_listener,
|
||||
@ -385,10 +388,10 @@ create_pipewire_stream (MetaScreenCastStreamSrc *src,
|
||||
}
|
||||
|
||||
static void
|
||||
on_state_changed (void *data,
|
||||
enum pw_remote_state old,
|
||||
enum pw_remote_state state,
|
||||
const char *error_message)
|
||||
on_state_changed (void *data,
|
||||
enum pw_remote_state old,
|
||||
enum pw_remote_state state,
|
||||
const char *error_message)
|
||||
{
|
||||
MetaScreenCastStreamSrc *src = data;
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
@ -430,9 +433,9 @@ pipewire_loop_source_prepare (GSource *base,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
pipewire_loop_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
pipewire_loop_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaPipeWireSource *pipewire_source = (MetaPipeWireSource *) source;
|
||||
int result;
|
||||
@ -496,15 +499,16 @@ 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,
|
||||
};
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_stream_src_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
meta_screen_cast_stream_src_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (initable);
|
||||
MetaScreenCastStreamSrcPrivate *priv =
|
||||
@ -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);
|
||||
}
|
||||
|
@ -61,8 +61,8 @@ G_DEFINE_TYPE_WITH_CODE (MetaScreenCastStream,
|
||||
G_ADD_PRIVATE (MetaScreenCastStream))
|
||||
|
||||
static MetaScreenCastStreamSrc *
|
||||
meta_screen_cast_stream_create_src (MetaScreenCastStream *stream,
|
||||
GError **error)
|
||||
meta_screen_cast_stream_create_src (MetaScreenCastStream * stream,
|
||||
GError * *error)
|
||||
{
|
||||
return META_SCREEN_CAST_STREAM_GET_CLASS (stream)->create_src (stream,
|
||||
error);
|
||||
@ -98,8 +98,8 @@ on_stream_src_ready (MetaScreenCastStreamSrc *src,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_screen_cast_stream_start (MetaScreenCastStream *stream,
|
||||
GError **error)
|
||||
meta_screen_cast_stream_start (MetaScreenCastStream *stream,
|
||||
GError **error)
|
||||
{
|
||||
MetaScreenCastStreamPrivate *priv =
|
||||
meta_screen_cast_stream_get_instance_private (stream);
|
||||
@ -206,9 +206,9 @@ meta_screen_cast_stream_finalize (GObject *object)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_screen_cast_stream_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
meta_screen_cast_stream_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
MetaScreenCastStream *stream = META_SCREEN_CAST_STREAM (initable);
|
||||
MetaDBusScreenCastStream *skeleton = META_DBUS_SCREEN_CAST_STREAM (stream);
|
||||
|
@ -54,7 +54,7 @@ G_DEFINE_TYPE_WITH_CODE (MetaScreenCast, meta_screen_cast,
|
||||
meta_screen_cast_init_iface))
|
||||
|
||||
GDBusConnection *
|
||||
meta_screen_cast_get_connection (MetaScreenCast *screen_cast)
|
||||
meta_screen_cast_get_connection (MetaScreenCast * screen_cast)
|
||||
{
|
||||
GDBusInterfaceSkeleton *interface_skeleton =
|
||||
G_DBUS_INTERFACE_SKELETON (screen_cast);
|
||||
@ -63,9 +63,9 @@ meta_screen_cast_get_connection (MetaScreenCast *screen_cast)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
register_remote_desktop_screen_cast_session (MetaScreenCastSession *session,
|
||||
const char *remote_desktop_session_id,
|
||||
GError **error)
|
||||
register_remote_desktop_screen_cast_session (MetaScreenCastSession *session,
|
||||
const char *remote_desktop_session_id,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaRemoteDesktop *remote_desktop = meta_backend_get_remote_desktop (backend);
|
||||
|
@ -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);
|
||||
@ -393,16 +392,16 @@ wayland_settings_changed (GSettings *wayland_settings,
|
||||
}
|
||||
|
||||
void
|
||||
meta_settings_get_xwayland_grab_patterns (MetaSettings *settings,
|
||||
GPtrArray **whitelist_patterns,
|
||||
GPtrArray **blacklist_patterns)
|
||||
meta_settings_get_xwayland_grab_patterns (MetaSettings *settings,
|
||||
GPtrArray **whitelist_patterns,
|
||||
GPtrArray **blacklist_patterns)
|
||||
{
|
||||
*whitelist_patterns = settings->xwayland_grab_whitelist_patterns;
|
||||
*blacklist_patterns = settings->xwayland_grab_blacklist_patterns;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_settings_are_xwayland_grabs_allowed (MetaSettings *settings)
|
||||
meta_settings_are_xwayland_grabs_allowed (MetaSettings *settings)
|
||||
{
|
||||
return (settings->xwayland_allow_grabs);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -82,7 +82,7 @@ escape_dbus_component (const gchar *name)
|
||||
g_string_append_len (op, first_ok, ptr - first_ok);
|
||||
}
|
||||
/* escape the unsafe character */
|
||||
g_string_append_printf (op, "_%02x", (unsigned char)(*ptr));
|
||||
g_string_append_printf (op, "_%02x", (unsigned char) (*ptr));
|
||||
/* restart after it */
|
||||
first_ok = ptr + 1;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
@ -216,24 +218,40 @@ relative_motion_across_outputs (MetaMonitorManager *monitor_manager,
|
||||
MetaVector2 intersection;
|
||||
|
||||
motion = (MetaLine2) {
|
||||
.a = { x, y },
|
||||
.b = { x + (dx * cur->scale), y + (dy * cur->scale) }
|
||||
.a = { x, y },
|
||||
.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,17 +302,20 @@ relative_motion_filter (ClutterInputDevice *device,
|
||||
if (meta_is_stage_views_scaled ())
|
||||
return;
|
||||
|
||||
logical_monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager,
|
||||
x, y);
|
||||
logical_monitor = meta_monitor_manager_get_logical_monitor_at (
|
||||
monitor_manager,
|
||||
x, y);
|
||||
if (!logical_monitor)
|
||||
return;
|
||||
|
||||
new_dx = (*dx) * logical_monitor->scale;
|
||||
new_dy = (*dy) * logical_monitor->scale;
|
||||
|
||||
dest_logical_monitor = meta_monitor_manager_get_logical_monitor_at (monitor_manager,
|
||||
x + new_dx,
|
||||
y + new_dy);
|
||||
dest_logical_monitor = meta_monitor_manager_get_logical_monitor_at (
|
||||
monitor_manager,
|
||||
x + new_dx,
|
||||
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);
|
||||
@ -466,12 +491,12 @@ meta_backend_native_set_numlock (MetaBackend *backend,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_backend_native_get_relative_motion_deltas (MetaBackend *backend,
|
||||
const ClutterEvent *event,
|
||||
double *dx,
|
||||
double *dy,
|
||||
double *dx_unaccel,
|
||||
double *dy_unaccel)
|
||||
meta_backend_native_get_relative_motion_deltas (MetaBackend *backend,
|
||||
const ClutterEvent *event,
|
||||
double *dx,
|
||||
double *dy,
|
||||
double *dx_unaccel,
|
||||
double *dy_unaccel)
|
||||
{
|
||||
return clutter_evdev_event_get_relative_motion (event,
|
||||
dx, dy,
|
||||
@ -493,9 +518,9 @@ meta_backend_native_update_screen_size (MetaBackend *backend,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_backend_native_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
meta_backend_native_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
if (!meta_is_stage_views_enabled ())
|
||||
{
|
||||
@ -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))
|
||||
{
|
||||
|
@ -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,
|
||||
|
||||
@ -67,14 +68,14 @@ typedef enum {
|
||||
|
||||
struct _MetaBarrierImplNativePrivate
|
||||
{
|
||||
MetaBarrier *barrier;
|
||||
MetaBarrier *barrier;
|
||||
MetaBarrierManagerNative *manager;
|
||||
|
||||
gboolean is_active;
|
||||
MetaBarrierState state;
|
||||
int trigger_serial;
|
||||
guint32 last_event_time;
|
||||
MetaBarrierDirection blocked_dir;
|
||||
gboolean is_active;
|
||||
MetaBarrierState state;
|
||||
int trigger_serial;
|
||||
guint32 last_event_time;
|
||||
MetaBarrierDirection blocked_dir;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaBarrierImplNative, meta_barrier_impl_native,
|
||||
@ -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,
|
||||
},
|
||||
@ -233,14 +237,14 @@ typedef struct _MetaClosestBarrierData
|
||||
{
|
||||
struct
|
||||
{
|
||||
MetaLine2 motion;
|
||||
MetaBarrierDirection directions;
|
||||
MetaLine2 motion;
|
||||
MetaBarrierDirection directions;
|
||||
} in;
|
||||
|
||||
struct
|
||||
{
|
||||
float closest_distance_2;
|
||||
MetaBarrierImplNative *barrier_impl;
|
||||
float closest_distance_2;
|
||||
MetaBarrierImplNative *barrier_impl;
|
||||
} out;
|
||||
} MetaClosestBarrierData;
|
||||
|
||||
@ -282,7 +286,7 @@ update_closest_barrier (gpointer key,
|
||||
* barrier. */
|
||||
dx = intersection.x - data->in.motion.a.x;
|
||||
dy = intersection.y - data->in.motion.a.y;
|
||||
distance_2 = dx*dx + dy*dy;
|
||||
distance_2 = dx * dx + dy * dy;
|
||||
if (data->out.barrier_impl == NULL ||
|
||||
distance_2 < data->out.closest_distance_2)
|
||||
{
|
||||
@ -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,
|
||||
},
|
||||
@ -335,13 +343,13 @@ get_closest_barrier (MetaBarrierManagerNative *manager,
|
||||
|
||||
typedef struct _MetaBarrierEventData
|
||||
{
|
||||
guint32 time;
|
||||
float prev_x;
|
||||
float prev_y;
|
||||
float x;
|
||||
float y;
|
||||
float dx;
|
||||
float dy;
|
||||
guint32 time;
|
||||
float prev_x;
|
||||
float prev_y;
|
||||
float x;
|
||||
float y;
|
||||
float dx;
|
||||
float dy;
|
||||
} MetaBarrierEventData;
|
||||
|
||||
static void
|
||||
@ -372,7 +380,7 @@ emit_barrier_event (MetaBarrierImplNative *self,
|
||||
case META_BARRIER_STATE_LEFT:
|
||||
priv->state = META_BARRIER_STATE_ACTIVE;
|
||||
|
||||
/* Intentional fall-through. */
|
||||
/* Intentional fall-through. */
|
||||
case META_BARRIER_STATE_HELD:
|
||||
event->dt = time - priv->last_event_time;
|
||||
|
||||
@ -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:
|
||||
@ -433,9 +442,9 @@ maybe_emit_barrier_event (gpointer key, gpointer value, gpointer user_data)
|
||||
/* Clamp (x, y) to the barrier and remove clamped direction from motion_dir. */
|
||||
static void
|
||||
clamp_to_barrier (MetaBarrierImplNative *self,
|
||||
MetaBarrierDirection *motion_dir,
|
||||
float *x,
|
||||
float *y)
|
||||
MetaBarrierDirection *motion_dir,
|
||||
float *x,
|
||||
float *y)
|
||||
{
|
||||
MetaBarrierImplNativePrivate *priv =
|
||||
meta_barrier_impl_native_get_instance_private (self);
|
||||
|
@ -46,7 +46,7 @@ G_DEFINE_TYPE (MetaClutterBackendNative, meta_clutter_backend_native,
|
||||
CLUTTER_TYPE_BACKEND_EGL_NATIVE)
|
||||
|
||||
MetaStageNative *
|
||||
meta_clutter_backend_native_get_stage_native (ClutterBackend *backend)
|
||||
meta_clutter_backend_native_get_stage_native (ClutterBackend * backend)
|
||||
{
|
||||
MetaClutterBackendNative *clutter_backend_native =
|
||||
META_CLUTTER_BACKEND_NATIVE (backend);
|
||||
@ -55,8 +55,8 @@ meta_clutter_backend_native_get_stage_native (ClutterBackend *backend)
|
||||
}
|
||||
|
||||
static CoglRenderer *
|
||||
meta_clutter_backend_native_get_renderer (ClutterBackend *clutter_backend,
|
||||
GError **error)
|
||||
meta_clutter_backend_native_get_renderer (ClutterBackend *clutter_backend,
|
||||
GError **error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
@ -65,9 +65,9 @@ meta_clutter_backend_native_get_renderer (ClutterBackend *clutter_backend,
|
||||
}
|
||||
|
||||
static ClutterStageWindow *
|
||||
meta_clutter_backend_native_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
meta_clutter_backend_native_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
{
|
||||
MetaClutterBackendNative *clutter_backend_native =
|
||||
META_CLUTTER_BACKEND_NATIVE (backend);
|
||||
@ -82,7 +82,7 @@ meta_clutter_backend_native_create_stage (ClutterBackend *backend,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_clutter_backend_native_bell_notify (ClutterBackend *backend)
|
||||
meta_clutter_backend_native_bell_notify (ClutterBackend *backend)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ typedef struct _MetaCrtcKms
|
||||
} MetaCrtcKms;
|
||||
|
||||
gboolean
|
||||
meta_crtc_kms_is_transform_handled (MetaCrtc *crtc,
|
||||
MetaMonitorTransform transform)
|
||||
meta_crtc_kms_is_transform_handled (MetaCrtc *crtc,
|
||||
MetaMonitorTransform transform)
|
||||
{
|
||||
MetaCrtcKms *crtc_kms = crtc->driver_private;
|
||||
|
||||
@ -132,7 +132,6 @@ meta_crtc_kms_set_underscan (MetaCrtc *crtc,
|
||||
DRM_MODE_OBJECT_CRTC,
|
||||
crtc_kms->underscan_vborder_prop_id, value);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -143,10 +142,10 @@ meta_crtc_kms_set_underscan (MetaCrtc *crtc,
|
||||
}
|
||||
|
||||
static int
|
||||
find_property_index (MetaGpu *gpu,
|
||||
drmModeObjectPropertiesPtr props,
|
||||
const char *prop_name,
|
||||
drmModePropertyPtr *out_prop)
|
||||
find_property_index (MetaGpu *gpu,
|
||||
drmModeObjectPropertiesPtr props,
|
||||
const char *prop_name,
|
||||
drmModePropertyPtr *out_prop)
|
||||
{
|
||||
MetaGpuKms *gpu_kms = META_GPU_KMS (gpu);
|
||||
int kms_fd;
|
||||
@ -429,9 +428,9 @@ meta_crtc_destroy_notify (MetaCrtc *crtc)
|
||||
}
|
||||
|
||||
MetaCrtc *
|
||||
meta_create_kms_crtc (MetaGpuKms *gpu_kms,
|
||||
drmModeCrtc *drm_crtc,
|
||||
unsigned int crtc_index)
|
||||
meta_create_kms_crtc (MetaGpuKms *gpu_kms,
|
||||
drmModeCrtc *drm_crtc,
|
||||
unsigned int crtc_index)
|
||||
{
|
||||
MetaGpu *gpu = META_GPU (gpu_kms);
|
||||
MetaCrtc *crtc;
|
||||
@ -448,7 +447,7 @@ meta_create_kms_crtc (MetaGpuKms *gpu_kms,
|
||||
crtc->is_dirty = FALSE;
|
||||
crtc->transform = META_MONITOR_TRANSFORM_NORMAL;
|
||||
crtc->all_transforms = meta_is_stage_views_enabled () ?
|
||||
ALL_TRANSFORMS_MASK : META_MONITOR_TRANSFORM_NORMAL;
|
||||
ALL_TRANSFORMS_MASK : META_MONITOR_TRANSFORM_NORMAL;
|
||||
|
||||
if (drm_crtc->mode_valid)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
@ -544,7 +553,7 @@ can_draw_cursor_unscaled (MetaCursorRenderer *renderer,
|
||||
gboolean has_visible_crtc_sprite = FALSE;
|
||||
|
||||
if (!meta_is_stage_views_scaled ())
|
||||
return meta_cursor_sprite_get_texture_scale (cursor_sprite) == 1.0;
|
||||
return meta_cursor_sprite_get_texture_scale (cursor_sprite) == 1.0;
|
||||
|
||||
logical_monitors =
|
||||
meta_monitor_manager_get_logical_monitors (monitor_manager);
|
||||
@ -856,7 +865,7 @@ load_cursor_sprite_gbm_buffer_for_gpu (MetaCursorRendererNative *native,
|
||||
if (width > cursor_width || height > cursor_height)
|
||||
{
|
||||
meta_warning ("Invalid theme cursor size (must be at most %ux%u)\n",
|
||||
(unsigned int)cursor_width, (unsigned int)cursor_height);
|
||||
(unsigned int) cursor_width, (unsigned int) cursor_height);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -876,7 +885,7 @@ load_cursor_sprite_gbm_buffer_for_gpu (MetaCursorRendererNative *native,
|
||||
return;
|
||||
}
|
||||
|
||||
memset (buf, 0, sizeof(buf));
|
||||
memset (buf, 0, sizeof (buf));
|
||||
for (i = 0; i < height; i++)
|
||||
memcpy (buf + i * 4 * cursor_width, pixels + i * rowstride, width * 4);
|
||||
if (gbm_bo_write (bo, buf, cursor_width * cursor_height * 4) != 0)
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -85,9 +85,9 @@ kms_event_check (GSource *source)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
kms_event_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
kms_event_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
MetaKmsSource *kms_source = (MetaKmsSource *) source;
|
||||
|
||||
@ -96,17 +96,18 @@ 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
|
||||
};
|
||||
|
||||
static void
|
||||
get_crtc_drm_connectors (MetaGpu *gpu,
|
||||
MetaCrtc *crtc,
|
||||
uint32_t **connectors,
|
||||
unsigned int *n_connectors)
|
||||
get_crtc_drm_connectors (MetaGpu *gpu,
|
||||
MetaCrtc *crtc,
|
||||
uint32_t **connectors,
|
||||
unsigned int *n_connectors)
|
||||
{
|
||||
GArray *connectors_array = g_array_new (FALSE, FALSE, sizeof (uint32_t));
|
||||
GList *l;
|
||||
@ -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);
|
||||
}
|
||||
@ -301,11 +304,11 @@ meta_gpu_kms_flip_crtc (MetaGpuKms *gpu_kms,
|
||||
}
|
||||
|
||||
static void
|
||||
page_flip_handler (int fd,
|
||||
unsigned int frame,
|
||||
unsigned int sec,
|
||||
unsigned int usec,
|
||||
void *user_data)
|
||||
page_flip_handler (int fd,
|
||||
unsigned int frame,
|
||||
unsigned int sec,
|
||||
unsigned int usec,
|
||||
void *user_data)
|
||||
{
|
||||
MetaGpuKmsFlipClosureContainer *closure_container = user_data;
|
||||
GClosure *flip_closure = closure_container->flip_closure;
|
||||
@ -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;
|
||||
@ -733,9 +737,9 @@ init_outputs (MetaGpuKms *gpu_kms,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_kms_resources_init (MetaKmsResources *resources,
|
||||
int fd,
|
||||
GError **error)
|
||||
meta_kms_resources_init (MetaKmsResources *resources,
|
||||
int fd,
|
||||
GError **error)
|
||||
|
||||
{
|
||||
drmModeRes *drm_resources;
|
||||
@ -775,8 +779,8 @@ meta_kms_resources_release (MetaKmsResources *resources)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_gpu_kms_read_current (MetaGpu *gpu,
|
||||
GError **error)
|
||||
meta_gpu_kms_read_current (MetaGpu *gpu,
|
||||
GError **error)
|
||||
{
|
||||
MetaGpuKms *gpu_kms = META_GPU_KMS (gpu);
|
||||
MetaMonitorManager *monitor_manager =
|
||||
@ -788,8 +792,9 @@ 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",
|
||||
local_error->message);
|
||||
g_warning (
|
||||
"meta_kms_resources_init failed: %s, assuming we have no outputs",
|
||||
local_error->message);
|
||||
gpu_kms->resources_init_failed_before = TRUE;
|
||||
}
|
||||
return 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);
|
||||
@ -823,9 +828,9 @@ meta_gpu_kms_can_have_outputs (MetaGpuKms *gpu_kms)
|
||||
}
|
||||
|
||||
MetaGpuKms *
|
||||
meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
|
||||
const char *kms_file_path,
|
||||
GError **error)
|
||||
meta_gpu_kms_new (MetaMonitorManagerKms *monitor_manager_kms,
|
||||
const char *kms_file_path,
|
||||
GError **error)
|
||||
{
|
||||
MetaMonitorManager *monitor_manager =
|
||||
META_MONITOR_MANAGER (monitor_manager_kms);
|
||||
|
@ -31,12 +31,13 @@
|
||||
#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,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopDeviceSendEvents mode)
|
||||
meta_input_settings_native_set_send_events (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopDeviceSendEvents mode)
|
||||
{
|
||||
enum libinput_config_send_events_mode libinput_mode;
|
||||
struct libinput_device *libinput_device;
|
||||
@ -122,9 +123,10 @@ meta_input_settings_native_set_tap_enabled (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_tap_and_drag_enabled (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean enabled)
|
||||
meta_input_settings_native_set_tap_and_drag_enabled (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean enabled)
|
||||
{
|
||||
struct libinput_device *libinput_device;
|
||||
|
||||
@ -140,9 +142,10 @@ meta_input_settings_native_set_tap_and_drag_enabled (MetaInputSettings *setting
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_disable_while_typing (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean enabled)
|
||||
meta_input_settings_native_set_disable_while_typing (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean enabled)
|
||||
{
|
||||
struct libinput_device *libinput_device;
|
||||
|
||||
@ -175,8 +178,8 @@ meta_input_settings_native_set_invert_scroll (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
device_set_scroll_method (struct libinput_device *libinput_device,
|
||||
enum libinput_config_scroll_method method)
|
||||
device_set_scroll_method (struct libinput_device *libinput_device,
|
||||
enum libinput_config_scroll_method method)
|
||||
{
|
||||
enum libinput_config_status status =
|
||||
libinput_device_config_scroll_set_method (libinput_device, method);
|
||||
@ -184,8 +187,8 @@ device_set_scroll_method (struct libinput_device *libinput_device,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
device_set_click_method (struct libinput_device *libinput_device,
|
||||
enum libinput_config_click_method method)
|
||||
device_set_click_method (struct libinput_device *libinput_device,
|
||||
enum libinput_config_click_method method)
|
||||
{
|
||||
enum libinput_config_status status =
|
||||
libinput_device_config_click_set_method (libinput_device, method);
|
||||
@ -193,16 +196,18 @@ device_set_click_method (struct libinput_device *libinput_device,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_edge_scroll (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean edge_scrolling_enabled)
|
||||
meta_input_settings_native_set_edge_scroll (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean edge_scrolling_enabled)
|
||||
{
|
||||
struct libinput_device *libinput_device;
|
||||
enum libinput_config_scroll_method current, method;
|
||||
|
||||
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;
|
||||
|
||||
@ -210,16 +215,18 @@ meta_input_settings_native_set_edge_scroll (MetaInputSettings *settin
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_two_finger_scroll (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean two_finger_scroll_enabled)
|
||||
meta_input_settings_native_set_two_finger_scroll (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean two_finger_scroll_enabled)
|
||||
{
|
||||
struct libinput_device *libinput_device;
|
||||
enum libinput_config_scroll_method current, method;
|
||||
|
||||
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,9 +283,10 @@ meta_input_settings_native_set_scroll_button (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_click_method (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTouchpadClickMethod mode)
|
||||
meta_input_settings_native_set_click_method (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTouchpadClickMethod mode)
|
||||
{
|
||||
enum libinput_config_click_method click_method = 0;
|
||||
struct libinput_device *libinput_device;
|
||||
@ -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;
|
||||
@ -303,7 +313,7 @@ meta_input_settings_native_set_click_method (MetaInputSettings *settin
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
device_set_click_method (libinput_device, click_method);
|
||||
}
|
||||
@ -405,9 +415,10 @@ meta_input_settings_native_is_trackball_device (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_mouse_accel_profile (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
meta_input_settings_native_set_mouse_accel_profile (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
{
|
||||
if (!is_mouse_device (device))
|
||||
return;
|
||||
@ -416,9 +427,10 @@ meta_input_settings_native_set_mouse_accel_profile (MetaInputSettings *
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_trackball_accel_profile (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
meta_input_settings_native_set_trackball_accel_profile (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
{
|
||||
if (!meta_input_settings_native_is_trackball_device (settings, device))
|
||||
return;
|
||||
@ -427,9 +439,9 @@ meta_input_settings_native_set_trackball_accel_profile (MetaInputSettings
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_tablet_mapping (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTabletMapping mapping)
|
||||
meta_input_settings_native_set_tablet_mapping (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTabletMapping mapping)
|
||||
{
|
||||
ClutterInputDeviceMapping dev_mapping;
|
||||
|
||||
@ -467,9 +479,9 @@ meta_input_settings_native_set_tablet_keep_aspect (MetaInputSettings *settings,
|
||||
|
||||
backend = meta_get_backend ();
|
||||
monitor_manager = meta_backend_get_monitor_manager (backend);
|
||||
meta_monitor_manager_get_screen_size (monitor_manager,
|
||||
&width,
|
||||
&height);
|
||||
meta_monitor_manager_get_screen_size (monitor_manager,
|
||||
&width,
|
||||
&height);
|
||||
}
|
||||
|
||||
aspect_ratio = (double) width / height;
|
||||
@ -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,10 +524,11 @@ meta_input_settings_native_set_tablet_area (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_stylus_pressure (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool,
|
||||
const gint curve[4])
|
||||
meta_input_settings_native_set_stylus_pressure (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool,
|
||||
const gint curve[4])
|
||||
{
|
||||
gdouble pressure_curve[4];
|
||||
|
||||
@ -544,16 +560,18 @@ action_to_evcode (GDesktopStylusButtonAction action)
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_native_set_stylus_button_map (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool,
|
||||
GDesktopStylusButtonAction primary,
|
||||
GDesktopStylusButtonAction secondary,
|
||||
GDesktopStylusButtonAction tertiary)
|
||||
meta_input_settings_native_set_stylus_button_map (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool,
|
||||
GDesktopStylusButtonAction primary,
|
||||
GDesktopStylusButtonAction secondary,
|
||||
GDesktopStylusButtonAction tertiary)
|
||||
{
|
||||
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
|
||||
|
@ -60,10 +60,13 @@ meta_launcher_get_seat_id (MetaLauncher *launcher)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
find_systemd_session (gchar **session_id,
|
||||
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;
|
||||
@ -116,43 +119,43 @@ find_systemd_session (gchar **session_id,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (n_sessions == 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"User %d has no sessions",
|
||||
getuid ());
|
||||
return FALSE;
|
||||
}
|
||||
if (n_sessions == 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"User %d has no sessions",
|
||||
getuid ());
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
for (int i = 0; i < n_sessions; ++i)
|
||||
{
|
||||
saved_errno = sd_session_get_class (sessions[i], &class);
|
||||
if (saved_errno < 0)
|
||||
{
|
||||
g_warning ("Couldn't get class for session '%d': %s",
|
||||
i,
|
||||
g_strerror (-saved_errno));
|
||||
continue;
|
||||
}
|
||||
for (int i = 0; i < n_sessions; ++i)
|
||||
{
|
||||
saved_errno = sd_session_get_class (sessions[i], &class);
|
||||
if (saved_errno < 0)
|
||||
{
|
||||
g_warning ("Couldn't get class for session '%d': %s",
|
||||
i,
|
||||
g_strerror (-saved_errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (g_strcmp0 (class, "greeter") == 0)
|
||||
{
|
||||
local_session_id = g_strdup (sessions[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (g_strcmp0 (class, "greeter") == 0)
|
||||
{
|
||||
local_session_id = g_strdup (sessions[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!local_session_id)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"Couldn't find a session or a greeter session for user %d",
|
||||
getuid ());
|
||||
return FALSE;
|
||||
}
|
||||
if (!local_session_id)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"Couldn't find a session or a greeter session for user %d",
|
||||
getuid ());
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -191,29 +194,29 @@ find_systemd_session (gchar **session_id,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* and display sessions can be 'closing' if they are logged out but
|
||||
* some processes are lingering; we shouldn't consider these */
|
||||
saved_errno = sd_session_get_state (local_session_id, &state);
|
||||
if (saved_errno < 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"Couldn't get state for session '%s': %s",
|
||||
local_session_id,
|
||||
g_strerror (-saved_errno));
|
||||
return FALSE;
|
||||
}
|
||||
/* and display sessions can be 'closing' if they are logged out but
|
||||
* some processes are lingering; we shouldn't consider these */
|
||||
saved_errno = sd_session_get_state (local_session_id, &state);
|
||||
if (saved_errno < 0)
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"Couldn't get state for session '%s': %s",
|
||||
local_session_id,
|
||||
g_strerror (-saved_errno));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!g_strv_contains (active_states, state))
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"Session '%s' is not active",
|
||||
local_session_id);
|
||||
return FALSE;
|
||||
}
|
||||
if (!g_strv_contains (active_states, state))
|
||||
{
|
||||
g_set_error (error,
|
||||
G_IO_ERROR,
|
||||
G_IO_ERROR_NOT_FOUND,
|
||||
"Session '%s' is not active",
|
||||
local_session_id);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*session_id = g_steal_pointer (&local_session_id);
|
||||
|
||||
@ -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,
|
||||
@ -243,7 +248,7 @@ get_session_proxy (GCancellable *cancellable,
|
||||
proxy_path,
|
||||
cancellable, error);
|
||||
if (!session_proxy)
|
||||
g_prefix_error(error, "Could not get session proxy: ");
|
||||
g_prefix_error (error, "Could not get session proxy: ");
|
||||
|
||||
return session_proxy;
|
||||
}
|
||||
@ -258,7 +263,7 @@ get_seat_proxy (GCancellable *cancellable,
|
||||
"/org/freedesktop/login1/seat/self",
|
||||
cancellable, error);
|
||||
if (!seat)
|
||||
g_prefix_error(error, "Could not get seat proxy: ");
|
||||
g_prefix_error (error, "Could not get seat proxy: ");
|
||||
|
||||
return seat;
|
||||
}
|
||||
@ -377,10 +382,10 @@ out:
|
||||
}
|
||||
|
||||
static int
|
||||
on_evdev_device_open (const char *path,
|
||||
int flags,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
on_evdev_device_open (const char *path,
|
||||
int flags,
|
||||
gpointer user_data,
|
||||
GError **error)
|
||||
{
|
||||
MetaLauncher *self = user_data;
|
||||
|
||||
@ -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,11 +532,12 @@ 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;
|
||||
|
||||
fail:
|
||||
fail:
|
||||
if (have_control)
|
||||
login1_session_call_release_control_sync (session_proxy, NULL, NULL);
|
||||
return NULL;
|
||||
@ -545,8 +554,8 @@ meta_launcher_free (MetaLauncher *self)
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_launcher_activate_session (MetaLauncher *launcher,
|
||||
GError **error)
|
||||
meta_launcher_activate_session (MetaLauncher *launcher,
|
||||
GError **error)
|
||||
{
|
||||
if (!login1_session_call_activate_sync (launcher->session_proxy, NULL, error))
|
||||
return FALSE;
|
||||
@ -556,9 +565,10 @@ meta_launcher_activate_session (MetaLauncher *launcher,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_launcher_activate_vt (MetaLauncher *launcher,
|
||||
signed char vt,
|
||||
GError **error)
|
||||
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);
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ G_DEFINE_TYPE_WITH_CODE (MetaMonitorManagerKms, meta_monitor_manager_kms,
|
||||
initable_iface_init))
|
||||
|
||||
static GBytes *
|
||||
meta_monitor_manager_kms_read_edid (MetaMonitorManager *manager,
|
||||
MetaOutput *output)
|
||||
meta_monitor_manager_kms_read_edid (MetaMonitorManager * manager,
|
||||
MetaOutput * output)
|
||||
{
|
||||
return meta_output_kms_read_edid (output);
|
||||
}
|
||||
@ -95,22 +95,23 @@ meta_monitor_manager_kms_set_power_save_mode (MetaMonitorManager *manager,
|
||||
uint64_t state;
|
||||
GList *l;
|
||||
|
||||
switch (mode) {
|
||||
case META_POWER_SAVE_ON:
|
||||
state = DRM_MODE_DPMS_ON;
|
||||
break;
|
||||
case META_POWER_SAVE_STANDBY:
|
||||
state = DRM_MODE_DPMS_STANDBY;
|
||||
break;
|
||||
case META_POWER_SAVE_SUSPEND:
|
||||
state = DRM_MODE_DPMS_SUSPEND;
|
||||
break;
|
||||
case META_POWER_SAVE_OFF:
|
||||
state = DRM_MODE_DPMS_OFF;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
switch (mode)
|
||||
{
|
||||
case META_POWER_SAVE_ON:
|
||||
state = DRM_MODE_DPMS_ON;
|
||||
break;
|
||||
case META_POWER_SAVE_STANDBY:
|
||||
state = DRM_MODE_DPMS_STANDBY;
|
||||
break;
|
||||
case META_POWER_SAVE_SUSPEND:
|
||||
state = DRM_MODE_DPMS_SUSPEND;
|
||||
break;
|
||||
case META_POWER_SAVE_OFF:
|
||||
state = DRM_MODE_DPMS_OFF;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
for (l = manager->gpus; l; l = l->next)
|
||||
{
|
||||
@ -132,10 +133,10 @@ meta_monitor_manager_kms_ensure_initial_config (MetaMonitorManager *manager)
|
||||
|
||||
static void
|
||||
apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
MetaCrtcInfo **crtcs,
|
||||
unsigned int n_crtcs,
|
||||
MetaOutputInfo **outputs,
|
||||
unsigned int n_outputs)
|
||||
MetaCrtcInfo **crtcs,
|
||||
unsigned int n_crtcs,
|
||||
MetaOutputInfo **outputs,
|
||||
unsigned int n_outputs)
|
||||
{
|
||||
unsigned i;
|
||||
GList *l;
|
||||
@ -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,10 +284,11 @@ update_screen_size (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config,
|
||||
MetaMonitorsConfigMethod method,
|
||||
GError **error)
|
||||
meta_monitor_manager_kms_apply_monitors_config (
|
||||
MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config,
|
||||
MetaMonitorsConfigMethod method,
|
||||
GError **error)
|
||||
{
|
||||
GPtrArray *crtc_infos;
|
||||
GPtrArray *output_infos;
|
||||
@ -327,12 +329,12 @@ meta_monitor_manager_kms_apply_monitors_config (MetaMonitorManager *manager
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager,
|
||||
MetaCrtc *crtc,
|
||||
gsize *size,
|
||||
unsigned short **red,
|
||||
unsigned short **green,
|
||||
unsigned short **blue)
|
||||
meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager,
|
||||
MetaCrtc *crtc,
|
||||
gsize *size,
|
||||
unsigned short **red,
|
||||
unsigned short **green,
|
||||
unsigned short **blue)
|
||||
{
|
||||
MetaGpu *gpu = meta_crtc_get_gpu (crtc);
|
||||
int kms_fd = meta_gpu_kms_get_fd (META_GPU_KMS (gpu));
|
||||
@ -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,19 +431,21 @@ meta_monitor_manager_kms_is_transform_handled (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
static float
|
||||
meta_monitor_manager_kms_calculate_monitor_mode_scale (MetaMonitorManager *manager,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode)
|
||||
meta_monitor_manager_kms_calculate_monitor_mode_scale (
|
||||
MetaMonitorManager *manager,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode)
|
||||
{
|
||||
return meta_monitor_calculate_mode_scale (monitor, monitor_mode);
|
||||
}
|
||||
|
||||
static float *
|
||||
meta_monitor_manager_kms_calculate_supported_scales (MetaMonitorManager *manager,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
int *n_supported_scales)
|
||||
meta_monitor_manager_kms_calculate_supported_scales (
|
||||
MetaMonitorManager *manager,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
int *n_supported_scales)
|
||||
{
|
||||
MetaMonitorScalesConstraint constraints =
|
||||
META_MONITOR_SCALES_CONSTRAINT_NONE;
|
||||
@ -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;
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ output_get_tile_info (MetaGpuKms *gpu_kms,
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = sscanf ((char *)tile_blob->data, "%d:%d:%d:%d:%d:%d:%d:%d",
|
||||
ret = sscanf ((char *) tile_blob->data, "%d:%d:%d:%d:%d:%d:%d:%d",
|
||||
&output->tile_info.group_id,
|
||||
&output->tile_info.flags,
|
||||
&output->tile_info.max_h_tiles,
|
||||
@ -259,8 +259,8 @@ handle_panel_orientation (MetaOutput *output,
|
||||
}
|
||||
|
||||
static void
|
||||
find_connector_properties (MetaGpuKms *gpu_kms,
|
||||
MetaOutput *output)
|
||||
find_connector_properties (MetaGpuKms *gpu_kms,
|
||||
MetaOutput *output)
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
drmModeConnector *connector = output_kms->connector;
|
||||
@ -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",
|
||||
@ -442,9 +443,9 @@ compare_modes (const void *one,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
init_output_modes (MetaOutput *output,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
init_output_modes (MetaOutput *output,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
MetaOutputKms *output_kms = output->driver_private;
|
||||
unsigned int i;
|
||||
@ -488,11 +489,11 @@ init_output_modes (MetaOutput *output,
|
||||
}
|
||||
|
||||
MetaOutput *
|
||||
meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
drmModeConnector *connector,
|
||||
MetaKmsResources *resources,
|
||||
MetaOutput *old_output,
|
||||
GError **error)
|
||||
meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
drmModeConnector *connector,
|
||||
MetaKmsResources *resources,
|
||||
MetaOutput *old_output,
|
||||
GError **error)
|
||||
{
|
||||
MetaGpu *gpu = META_GPU (gpu_kms);
|
||||
MetaOutput *output;
|
||||
@ -570,17 +571,17 @@ 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;
|
||||
|
||||
if (output_kms->encoders[i]->encoder_id == connector->encoder_id)
|
||||
output_kms->current_encoder = output_kms->encoders[i];
|
||||
}
|
||||
|
||||
crtcs = g_array_new (FALSE, FALSE, sizeof (MetaCrtc*));
|
||||
crtcs = g_array_new (FALSE, FALSE, sizeof (MetaCrtc *));
|
||||
|
||||
for (l = meta_gpu_get_crtcs (gpu), i = 0; l; l = l->next, i++)
|
||||
{
|
||||
@ -593,7 +594,7 @@ meta_create_kms_output (MetaGpuKms *gpu_kms,
|
||||
}
|
||||
|
||||
output->n_possible_crtcs = crtcs->len;
|
||||
output->possible_crtcs = (void*)g_array_free (crtcs, FALSE);
|
||||
output->possible_crtcs = (void *) g_array_free (crtcs, FALSE);
|
||||
|
||||
if (output_kms->current_encoder && output_kms->current_encoder->crtc_id != 0)
|
||||
{
|
||||
@ -654,14 +655,16 @@ 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;
|
||||
output->backlight = -1;
|
||||
|
@ -46,18 +46,18 @@
|
||||
#endif
|
||||
|
||||
static EGLImageKHR
|
||||
create_egl_image (MetaEgl *egl,
|
||||
EGLDisplay egl_display,
|
||||
EGLContext egl_context,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
uint32_t n_planes,
|
||||
uint32_t *strides,
|
||||
uint32_t *offsets,
|
||||
uint64_t *modifiers,
|
||||
uint32_t format,
|
||||
int fd,
|
||||
GError **error)
|
||||
create_egl_image (MetaEgl *egl,
|
||||
EGLDisplay egl_display,
|
||||
EGLContext egl_context,
|
||||
unsigned int width,
|
||||
unsigned int height,
|
||||
uint32_t n_planes,
|
||||
uint32_t *strides,
|
||||
uint32_t *offsets,
|
||||
uint64_t *modifiers,
|
||||
uint32_t format,
|
||||
int fd,
|
||||
GError **error)
|
||||
{
|
||||
EGLint attribs[37];
|
||||
int atti = 0;
|
||||
@ -141,10 +141,10 @@ create_egl_image (MetaEgl *egl,
|
||||
}
|
||||
|
||||
static void
|
||||
paint_egl_image (MetaGles3 *gles3,
|
||||
EGLImageKHR egl_image,
|
||||
int width,
|
||||
int height)
|
||||
paint_egl_image (MetaGles3 *gles3,
|
||||
EGLImageKHR egl_image,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
GLuint texture;
|
||||
GLuint framebuffer;
|
||||
@ -169,8 +169,9 @@ 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,
|
||||
GL_TEXTURE_2D, texture, 0));
|
||||
GLBAS (gles3, glFramebufferTexture2D,
|
||||
(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
|
||||
GL_TEXTURE_2D, texture, 0));
|
||||
|
||||
GLBAS (gles3, glBindFramebuffer, (GL_READ_FRAMEBUFFER, framebuffer));
|
||||
GLBAS (gles3, glBlitFramebuffer, (0, height, width, 0,
|
||||
@ -180,13 +181,13 @@ paint_egl_image (MetaGles3 *gles3,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_renderer_native_gles3_blit_shared_bo (MetaEgl *egl,
|
||||
MetaGles3 *gles3,
|
||||
EGLDisplay egl_display,
|
||||
EGLContext egl_context,
|
||||
EGLSurface egl_surface,
|
||||
struct gbm_bo *shared_bo,
|
||||
GError **error)
|
||||
meta_renderer_native_gles3_blit_shared_bo (MetaEgl *egl,
|
||||
MetaGles3 *gles3,
|
||||
EGLDisplay egl_display,
|
||||
EGLContext egl_context,
|
||||
EGLSurface egl_surface,
|
||||
struct gbm_bo *shared_bo,
|
||||
GError **error)
|
||||
{
|
||||
int shared_bo_fd;
|
||||
unsigned int width;
|
||||
|
@ -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,11 +564,12 @@ get_supported_modifiers (CoglOnscreen *onscreen,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
init_secondary_gpu_state_gpu_copy_mode (MetaRendererNative *renderer_native,
|
||||
CoglOnscreen *onscreen,
|
||||
MetaRendererNativeGpuData *renderer_gpu_data,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
init_secondary_gpu_state_gpu_copy_mode (
|
||||
MetaRendererNative *renderer_native,
|
||||
CoglOnscreen *onscreen,
|
||||
MetaRendererNativeGpuData *renderer_gpu_data,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
@ -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,11 +658,12 @@ secondary_gpu_state_free (MetaOnscreenNativeSecondaryGpuState *secondary_gpu_sta
|
||||
}
|
||||
|
||||
static gboolean
|
||||
init_secondary_gpu_state_cpu_copy_mode (MetaRendererNative *renderer_native,
|
||||
CoglOnscreen *onscreen,
|
||||
MetaRendererNativeGpuData *renderer_gpu_data,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
init_secondary_gpu_state_cpu_copy_mode (
|
||||
MetaRendererNative *renderer_native,
|
||||
CoglOnscreen *onscreen,
|
||||
MetaRendererNativeGpuData *renderer_gpu_data,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
CoglFramebuffer *framebuffer = COGL_FRAMEBUFFER (onscreen);
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
@ -691,10 +702,10 @@ init_secondary_gpu_state_cpu_copy_mode (MetaRendererNative *renderer_nat
|
||||
}
|
||||
|
||||
static gboolean
|
||||
init_secondary_gpu_state (MetaRendererNative *renderer_native,
|
||||
CoglOnscreen *onscreen,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
init_secondary_gpu_state (MetaRendererNative *renderer_native,
|
||||
CoglOnscreen *onscreen,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
MetaRendererNativeGpuData *renderer_gpu_data;
|
||||
|
||||
@ -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);
|
||||
@ -846,7 +858,7 @@ free_current_bo (CoglOnscreen *onscreen)
|
||||
static void
|
||||
meta_onscreen_native_queue_swap_notify (CoglOnscreen *onscreen)
|
||||
{
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||
MetaRendererNative *renderer_native = onscreen_native->renderer_native;
|
||||
|
||||
@ -913,9 +925,10 @@ fail:
|
||||
}
|
||||
|
||||
static int
|
||||
meta_renderer_native_add_egl_config_attributes (CoglDisplay *cogl_display,
|
||||
CoglFramebufferConfig *config,
|
||||
EGLint *attributes)
|
||||
meta_renderer_native_add_egl_config_attributes (
|
||||
CoglDisplay *cogl_display,
|
||||
CoglFramebufferConfig *config,
|
||||
EGLint *attributes)
|
||||
{
|
||||
CoglRendererEGL *cogl_renderer_egl = cogl_display->renderer->winsys;
|
||||
MetaRendererNativeGpuData *renderer_gpu_data = cogl_renderer_egl->platform;
|
||||
@ -939,12 +952,12 @@ meta_renderer_native_add_egl_config_attributes (CoglDisplay *cogl_disp
|
||||
}
|
||||
|
||||
static gboolean
|
||||
choose_egl_config_from_gbm_format (MetaEgl *egl,
|
||||
EGLDisplay egl_display,
|
||||
const EGLint *attributes,
|
||||
uint32_t gbm_format,
|
||||
EGLConfig *out_config,
|
||||
GError **error)
|
||||
choose_egl_config_from_gbm_format (MetaEgl *egl,
|
||||
EGLDisplay egl_display,
|
||||
const EGLint *attributes,
|
||||
uint32_t gbm_format,
|
||||
EGLConfig *out_config,
|
||||
GError **error)
|
||||
{
|
||||
EGLConfig *egl_configs;
|
||||
EGLint n_configs;
|
||||
@ -986,10 +999,10 @@ choose_egl_config_from_gbm_format (MetaEgl *egl,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_renderer_native_choose_egl_config (CoglDisplay *cogl_display,
|
||||
EGLint *attributes,
|
||||
EGLConfig *out_config,
|
||||
GError **error)
|
||||
meta_renderer_native_choose_egl_config (CoglDisplay *cogl_display,
|
||||
EGLint *attributes,
|
||||
EGLConfig *out_config,
|
||||
GError **error)
|
||||
{
|
||||
CoglRenderer *cogl_renderer = cogl_display->renderer;
|
||||
CoglRendererEGL *cogl_renderer_egl = cogl_renderer->winsys;
|
||||
@ -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
|
||||
@ -1098,8 +1113,8 @@ meta_renderer_native_egl_context_created (CoglDisplay *cogl_display,
|
||||
cogl_display_egl->egl_context))
|
||||
{
|
||||
_cogl_set_error (error, COGL_WINSYS_ERROR,
|
||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||
"Failed to make context current");
|
||||
COGL_WINSYS_ERROR_CREATE_CONTEXT,
|
||||
"Failed to make context current");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1140,7 +1155,7 @@ swap_secondary_drm_fb (MetaGpuKms *gpu_kms,
|
||||
static void
|
||||
meta_onscreen_native_swap_drm_fb (CoglOnscreen *onscreen)
|
||||
{
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||
|
||||
free_current_bo (onscreen);
|
||||
@ -1165,7 +1180,7 @@ on_crtc_flipped (GClosure *closure,
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_stage_view_get_onscreen (stage_view);
|
||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||
MetaRendererNative *renderer_native = onscreen_native->renderer_native;
|
||||
MetaGpuKms *render_gpu = onscreen_native->render_gpu;
|
||||
@ -1237,7 +1252,7 @@ flip_closure_destroyed (MetaRendererView *view)
|
||||
CoglFramebuffer *framebuffer =
|
||||
clutter_stage_view_get_onscreen (stage_view);
|
||||
CoglOnscreen *onscreen = COGL_ONSCREEN (framebuffer);
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
CoglOnscreenEGL *onscreen_egl = onscreen->winsys;
|
||||
MetaOnscreenNative *onscreen_native = onscreen_egl->platform;
|
||||
MetaRendererNative *renderer_native = onscreen_native->renderer_native;
|
||||
MetaGpuKms *render_gpu = onscreen_native->render_gpu;
|
||||
@ -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,8 +2033,9 @@ 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,
|
||||
gpu_kms))
|
||||
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
|
||||
@ -2210,12 +2233,12 @@ meta_renderer_native_create_surface_egl_device (CoglOnscreen *onscreen,
|
||||
#endif /* HAVE_EGL_DEVICE */
|
||||
|
||||
static gboolean
|
||||
init_dumb_fb (MetaDumbBuffer *dumb_fb,
|
||||
MetaGpuKms *gpu_kms,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t format,
|
||||
GError **error)
|
||||
init_dumb_fb (MetaDumbBuffer *dumb_fb,
|
||||
MetaGpuKms *gpu_kms,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t format,
|
||||
GError **error)
|
||||
{
|
||||
struct drm_mode_create_dumb create_arg;
|
||||
struct drm_mode_destroy_dumb destroy_arg;
|
||||
@ -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,
|
||||
@ -2589,14 +2613,14 @@ meta_renderer_native_queue_modes_reset (MetaRendererNative *renderer_native)
|
||||
}
|
||||
|
||||
static CoglOnscreen *
|
||||
meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *render_gpu,
|
||||
MetaLogicalMonitor *logical_monitor,
|
||||
CoglContext *context,
|
||||
MetaMonitorTransform transform,
|
||||
gint view_width,
|
||||
gint view_height,
|
||||
GError **error)
|
||||
meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *render_gpu,
|
||||
MetaLogicalMonitor *logical_monitor,
|
||||
CoglContext *context,
|
||||
MetaMonitorTransform transform,
|
||||
gint view_width,
|
||||
gint view_height,
|
||||
GError **error)
|
||||
{
|
||||
CoglOnscreen *onscreen;
|
||||
CoglOnscreenEGL *onscreen_egl;
|
||||
@ -2657,12 +2681,12 @@ meta_renderer_native_create_onscreen (MetaRendererNative *renderer_native,
|
||||
}
|
||||
|
||||
static CoglOffscreen *
|
||||
meta_renderer_native_create_offscreen (MetaRendererNative *renderer,
|
||||
CoglContext *context,
|
||||
MetaMonitorTransform transform,
|
||||
gint view_width,
|
||||
gint view_height,
|
||||
GError **error)
|
||||
meta_renderer_native_create_offscreen (MetaRendererNative *renderer,
|
||||
CoglContext *context,
|
||||
MetaMonitorTransform transform,
|
||||
gint view_width,
|
||||
gint view_height,
|
||||
GError **error)
|
||||
{
|
||||
CoglOffscreen *fb;
|
||||
CoglTexture2D *tex;
|
||||
@ -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,17 +3123,18 @@ 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",
|
||||
error->message);
|
||||
g_warning (
|
||||
"Failed to initialize accelerated iGPU/dGPU framebuffer sharing: %s",
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
|
||||
init_secondary_gpu_data_cpu (renderer_gpu_data);
|
||||
}
|
||||
|
||||
static MetaRendererNativeGpuData *
|
||||
create_renderer_gpu_data_gbm (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
create_renderer_gpu_data_gbm (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
MetaMonitorManagerKms *monitor_manager_kms;
|
||||
MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
|
||||
@ -3187,9 +3217,9 @@ get_drm_device_file (MetaEgl *egl,
|
||||
}
|
||||
|
||||
static EGLDeviceEXT
|
||||
find_egl_device (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
find_egl_device (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
MetaEgl *egl = meta_renderer_native_get_egl (renderer_native);
|
||||
char **missing_extensions;
|
||||
@ -3262,14 +3292,15 @@ find_egl_device (MetaRendererNative *renderer_native,
|
||||
}
|
||||
|
||||
static EGLDisplay
|
||||
get_egl_device_display (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
EGLDeviceEXT egl_device,
|
||||
GError **error)
|
||||
get_egl_device_display (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
EGLDeviceEXT egl_device,
|
||||
GError **error)
|
||||
{
|
||||
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
|
||||
};
|
||||
@ -3281,9 +3312,9 @@ get_egl_device_display (MetaRendererNative *renderer_native,
|
||||
}
|
||||
|
||||
static MetaRendererNativeGpuData *
|
||||
create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
MetaMonitorManagerKms *monitor_manager_kms =
|
||||
renderer_native->monitor_manager_kms;
|
||||
@ -3294,7 +3325,7 @@ create_renderer_gpu_data_egl_device (MetaRendererNative *renderer_native,
|
||||
EGLDisplay egl_display;
|
||||
MetaRendererNativeGpuData *renderer_gpu_data;
|
||||
|
||||
if (!meta_is_stage_views_enabled())
|
||||
if (!meta_is_stage_views_enabled ())
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR,
|
||||
G_IO_ERROR_FAILED,
|
||||
@ -3358,9 +3389,10 @@ 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,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
meta_renderer_native_create_renderer_gpu_data (
|
||||
MetaRendererNative *renderer_native,
|
||||
MetaGpuKms *gpu_kms,
|
||||
GError **error)
|
||||
{
|
||||
MetaRendererNativeGpuData *renderer_gpu_data;
|
||||
GError *gbm_error = NULL;
|
||||
@ -3403,7 +3435,7 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
||||
#ifdef HAVE_EGL_DEVICE
|
||||
, egl_device_error->message
|
||||
#endif
|
||||
);
|
||||
);
|
||||
|
||||
g_error_free (gbm_error);
|
||||
#ifdef HAVE_EGL_DEVICE
|
||||
@ -3414,9 +3446,9 @@ meta_renderer_native_create_renderer_gpu_data (MetaRendererNative *renderer_nat
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_renderer_native_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
meta_renderer_native_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
MetaRendererNative *renderer_native = META_RENDERER_NATIVE (initable);
|
||||
MetaMonitorManagerKms *monitor_manager_kms =
|
||||
@ -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] =
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include "meta/meta-monitor-manager.h"
|
||||
#include "meta/util.h"
|
||||
|
||||
static GQuark quark_view_frame_closure = 0;
|
||||
static GQuark quark_view_frame_closure = 0;
|
||||
|
||||
struct _MetaStageNative
|
||||
{
|
||||
|
@ -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);
|
||||
@ -154,12 +157,12 @@ meta_backend_x11_cm_select_stage_events (MetaBackend *backend)
|
||||
}
|
||||
|
||||
static void
|
||||
get_xkbrf_var_defs (Display *xdisplay,
|
||||
const char *layouts,
|
||||
const char *variants,
|
||||
const char *options,
|
||||
char **rules_p,
|
||||
XkbRF_VarDefsRec *var_defs)
|
||||
get_xkbrf_var_defs (Display *xdisplay,
|
||||
const char *layouts,
|
||||
const char *variants,
|
||||
const char *options,
|
||||
char **rules_p,
|
||||
XkbRF_VarDefsRec *var_defs)
|
||||
{
|
||||
char *rules = NULL;
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ meta_cursor_sprite_xfixes_set_property (GObject *object,
|
||||
}
|
||||
|
||||
MetaCursorSpriteXfixes *
|
||||
meta_cursor_sprite_xfixes_new (MetaDisplay *display,
|
||||
GError **error)
|
||||
meta_cursor_sprite_xfixes_new (MetaDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
return g_initable_new (META_TYPE_CURSOR_SPRITE_XFIXES,
|
||||
NULL, error,
|
||||
@ -112,9 +112,9 @@ meta_cursor_sprite_xfixes_new (MetaDisplay *display,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_cursor_sprite_xfixes_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
meta_cursor_sprite_xfixes_initable_init (GInitable *initable,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
MetaCursorSpriteXfixes *sprite_xfixes =
|
||||
META_CURSOR_SPRITE_XFIXES (initable);
|
||||
@ -172,12 +172,12 @@ meta_cursor_sprite_xfixes_initable_init (GInitable *initable,
|
||||
clutter_backend = clutter_get_default_backend ();
|
||||
cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
texture = cogl_texture_2d_new_from_data (cogl_context,
|
||||
cursor_image->width,
|
||||
cursor_image->height,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
cursor_image->width * 4, /* stride */
|
||||
cursor_data,
|
||||
error);
|
||||
cursor_image->width,
|
||||
cursor_image->height,
|
||||
CLUTTER_CAIRO_FORMAT_ARGB32,
|
||||
cursor_image->width * 4, /* stride */
|
||||
cursor_data,
|
||||
error);
|
||||
|
||||
if (free_cursor_data)
|
||||
g_free (cursor_data);
|
||||
|
@ -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;
|
||||
@ -415,9 +417,9 @@ x_event_source_check (GSource *source)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
x_event_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
x_event_source_dispatch (GSource *source,
|
||||
GSourceFunc callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
XEventSource *x_source = (XEventSource *) source;
|
||||
MetaBackend *backend = x_source->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,8 +523,9 @@ 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",
|
||||
XKB_X11_MIN_MAJOR_XKB_VERSION, XKB_X11_MIN_MINOR_XKB_VERSION);
|
||||
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);
|
||||
}
|
||||
@ -663,7 +672,7 @@ meta_backend_x11_set_numlock (MetaBackend *backend,
|
||||
|
||||
void
|
||||
meta_backend_x11_handle_event (MetaBackendX11 *x11,
|
||||
XEvent *xevent)
|
||||
XEvent *xevent)
|
||||
{
|
||||
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -780,7 +792,7 @@ meta_backend_x11_init (MetaBackendX11 *x11)
|
||||
* in Cogl - see meta_renderer_x11_create_cogl_renderer(). We call it here
|
||||
* to hopefully call it before any other use of XLib.
|
||||
*/
|
||||
XInitThreads();
|
||||
XInitThreads ();
|
||||
|
||||
/* We do X11 event retrieval ourselves */
|
||||
clutter_x11_disable_event_retrieval ();
|
||||
|
@ -44,8 +44,8 @@ G_DEFINE_TYPE (MetaClutterBackendX11, meta_clutter_backend_x11,
|
||||
CLUTTER_TYPE_BACKEND_X11)
|
||||
|
||||
static CoglRenderer *
|
||||
meta_clutter_backend_x11_get_renderer (ClutterBackend *clutter_backend,
|
||||
GError **error)
|
||||
meta_clutter_backend_x11_get_renderer (ClutterBackend * clutter_backend,
|
||||
GError * *error)
|
||||
{
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
MetaRenderer *renderer = meta_backend_get_renderer (backend);
|
||||
@ -54,9 +54,9 @@ meta_clutter_backend_x11_get_renderer (ClutterBackend *clutter_backend,
|
||||
}
|
||||
|
||||
static ClutterStageWindow *
|
||||
meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
|
||||
ClutterStage *wrapper,
|
||||
GError **error)
|
||||
{
|
||||
ClutterEventTranslator *translator;
|
||||
ClutterStageWindow *stage;
|
||||
@ -65,12 +65,12 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
|
||||
if (meta_is_wayland_compositor ())
|
||||
stage_type = META_TYPE_STAGE_X11_NESTED;
|
||||
else
|
||||
stage_type = CLUTTER_TYPE_STAGE_X11;
|
||||
stage_type = CLUTTER_TYPE_STAGE_X11;
|
||||
|
||||
stage = g_object_new (stage_type,
|
||||
"backend", backend,
|
||||
"wrapper", wrapper,
|
||||
NULL);
|
||||
"backend", backend,
|
||||
"wrapper", wrapper,
|
||||
NULL);
|
||||
|
||||
/* the X11 stage does event translation */
|
||||
translator = CLUTTER_EVENT_TRANSLATOR (stage);
|
||||
@ -80,7 +80,7 @@ meta_clutter_backend_x11_create_stage (ClutterBackend *backend,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_clutter_backend_x11_bell_notify (ClutterBackend *backend)
|
||||
meta_clutter_backend_x11_bell_notify (ClutterBackend *backend)
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -49,7 +49,7 @@ struct _MetaGpuXrandr
|
||||
G_DEFINE_TYPE (MetaGpuXrandr, meta_gpu_xrandr, META_TYPE_GPU)
|
||||
|
||||
XRRScreenResources *
|
||||
meta_gpu_xrandr_get_resources (MetaGpuXrandr *gpu_xrandr)
|
||||
meta_gpu_xrandr_get_resources (MetaGpuXrandr * gpu_xrandr)
|
||||
{
|
||||
return gpu_xrandr->resources;
|
||||
}
|
||||
@ -82,8 +82,8 @@ get_xmode_name (XRRModeInfo *xmode)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
||||
GError **error)
|
||||
meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
||||
GError **error)
|
||||
{
|
||||
MetaGpuXrandr *gpu_xrandr = META_GPU_XRANDR (gpu);
|
||||
MetaMonitorManager *monitor_manager = meta_gpu_get_monitor_manager (gpu);
|
||||
@ -163,7 +163,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
||||
modes = NULL;
|
||||
crtcs = NULL;
|
||||
|
||||
for (i = 0; i < (unsigned)resources->nmode; i++)
|
||||
for (i = 0; i < (unsigned) resources->nmode; i++)
|
||||
{
|
||||
XRRModeInfo *xmode = &resources->modes[i];
|
||||
MetaCrtcMode *mode;
|
||||
@ -174,7 +174,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
||||
mode->width = xmode->width;
|
||||
mode->height = xmode->height;
|
||||
mode->refresh_rate = (xmode->dotClock /
|
||||
((float)xmode->hTotal * xmode->vTotal));
|
||||
((float) xmode->hTotal * xmode->vTotal));
|
||||
mode->flags = xmode->modeFlags;
|
||||
mode->name = get_xmode_name (xmode);
|
||||
|
||||
@ -182,7 +182,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
||||
}
|
||||
meta_gpu_take_modes (gpu, modes);
|
||||
|
||||
for (i = 0; i < (unsigned)resources->ncrtc; i++)
|
||||
for (i = 0; i < (unsigned) resources->ncrtc; i++)
|
||||
{
|
||||
XRRCrtcInfo *xrandr_crtc;
|
||||
RRCrtc crtc_id;
|
||||
@ -203,7 +203,7 @@ meta_gpu_xrandr_read_current (MetaGpu *gpu,
|
||||
primary_output = XRRGetOutputPrimary (xdisplay,
|
||||
DefaultRootWindow (xdisplay));
|
||||
|
||||
for (i = 0; i < (unsigned)resources->noutput; i++)
|
||||
for (i = 0; i < (unsigned) resources->noutput; i++)
|
||||
{
|
||||
RROutput output_id;
|
||||
XRROutputInfo *xrandr_output;
|
||||
|
@ -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;
|
||||
@ -162,9 +170,9 @@ change_property (ClutterInputDevice *device,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopDeviceSendEvents mode)
|
||||
meta_input_settings_x11_set_send_events (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopDeviceSendEvents mode)
|
||||
{
|
||||
guchar values[2] = { 0 }; /* disabled, disabled-on-external-mouse */
|
||||
guchar *available;
|
||||
@ -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],
|
||||
matrix[3], matrix[4], matrix[5],
|
||||
0, 0, 1 };
|
||||
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
|
||||
};
|
||||
|
||||
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",
|
||||
@ -297,11 +310,12 @@ meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean edge_scroll_enabled)
|
||||
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;
|
||||
|
||||
@ -320,17 +334,18 @@ meta_input_settings_x11_set_edge_scroll (MetaInputSettings *settings,
|
||||
values[SCROLL_METHOD_FIELD_EDGE] = !!edge_scroll_enabled;
|
||||
change_property (device, "libinput Scroll Method Enabled",
|
||||
XA_INTEGER, 8, &values, SCROLL_METHOD_NUM_FIELDS);
|
||||
out:
|
||||
out:
|
||||
meta_XFree (current);
|
||||
meta_XFree (available);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
gboolean two_finger_scroll_enabled)
|
||||
meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *settings,
|
||||
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;
|
||||
|
||||
@ -349,7 +364,7 @@ meta_input_settings_x11_set_two_finger_scroll (MetaInputSettings *set
|
||||
values[SCROLL_METHOD_FIELD_2FG] = !!two_finger_scroll_enabled;
|
||||
change_property (device, "libinput Scroll Method Enabled",
|
||||
XA_INTEGER, 8, &values, SCROLL_METHOD_NUM_FIELDS);
|
||||
out:
|
||||
out:
|
||||
meta_XFree (current);
|
||||
meta_XFree (available);
|
||||
}
|
||||
@ -380,9 +395,9 @@ meta_input_settings_x11_set_scroll_button (MetaInputSettings *settings,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_x11_set_click_method (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTouchpadClickMethod mode)
|
||||
meta_input_settings_x11_set_click_method (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTouchpadClickMethod mode)
|
||||
{
|
||||
guchar values[2] = { 0 }; /* buttonareas, clickfinger */
|
||||
guchar *defaults, *available;
|
||||
@ -413,7 +428,7 @@ meta_input_settings_x11_set_click_method (MetaInputSettings *settings,
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((values[0] && !available[0]) || (values[1] && !available[1]))
|
||||
g_warning ("Device '%s' does not support click method %d\n",
|
||||
@ -422,7 +437,7 @@ meta_input_settings_x11_set_click_method (MetaInputSettings *settings,
|
||||
change_property (device, "libinput Click Method Enabled",
|
||||
XA_INTEGER, 8, &values, 2);
|
||||
|
||||
meta_XFree(available);
|
||||
meta_XFree (available);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -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)
|
||||
{
|
||||
@ -521,7 +537,7 @@ set_device_accel_profile (ClutterInputDevice *device,
|
||||
return;
|
||||
|
||||
available = get_property (device, "libinput Accel Profiles Available",
|
||||
XA_INTEGER, 8, 2);
|
||||
XA_INTEGER, 8, 2);
|
||||
if (!available)
|
||||
goto err_available;
|
||||
|
||||
@ -553,9 +569,10 @@ err_available:
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_x11_set_mouse_accel_profile (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
meta_input_settings_x11_set_mouse_accel_profile (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
{
|
||||
if (!is_mouse (settings, device))
|
||||
return;
|
||||
@ -564,9 +581,10 @@ meta_input_settings_x11_set_mouse_accel_profile (MetaInputSettings *set
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
meta_input_settings_x11_set_trackball_accel_profile (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopPointerAccelProfile profile)
|
||||
{
|
||||
if (!meta_input_settings_x11_is_trackball_device (settings, device))
|
||||
return;
|
||||
@ -575,13 +593,14 @@ meta_input_settings_x11_set_trackball_accel_profile (MetaInputSettings
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTabletMapping mapping)
|
||||
meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
GDesktopTabletMapping mapping)
|
||||
{
|
||||
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)
|
||||
@ -607,8 +626,8 @@ meta_input_settings_x11_set_tablet_mapping (MetaInputSettings *settings,
|
||||
ClutterInputDeviceMapping dev_mapping;
|
||||
|
||||
dev_mapping = (mapping == G_DESKTOP_TABLET_MAPPING_ABSOLUTE) ?
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE :
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE;
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE :
|
||||
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE;
|
||||
clutter_input_device_set_mapping_mode (device, dev_mapping);
|
||||
}
|
||||
}
|
||||
@ -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,16 +788,18 @@ action_to_button (GDesktopStylusButtonAction action,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_input_settings_x11_set_stylus_button_map (MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool,
|
||||
GDesktopStylusButtonAction primary,
|
||||
GDesktopStylusButtonAction secondary,
|
||||
GDesktopStylusButtonAction tertiary)
|
||||
meta_input_settings_x11_set_stylus_button_map (
|
||||
MetaInputSettings *settings,
|
||||
ClutterInputDevice *device,
|
||||
ClutterInputDeviceTool *tool,
|
||||
GDesktopStylusButtonAction primary,
|
||||
GDesktopStylusButtonAction secondary,
|
||||
GDesktopStylusButtonAction tertiary)
|
||||
{
|
||||
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
|
||||
|
@ -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;
|
||||
}
|
||||
@ -111,27 +114,29 @@ meta_monitor_manager_xrandr_read_edid (MetaMonitorManager *manager,
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_set_power_save_mode (MetaMonitorManager *manager,
|
||||
MetaPowerSave mode)
|
||||
MetaPowerSave mode)
|
||||
{
|
||||
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (manager);
|
||||
MetaMonitorManagerXrandr *manager_xrandr = META_MONITOR_MANAGER_XRANDR (
|
||||
manager);
|
||||
CARD16 state;
|
||||
|
||||
switch (mode) {
|
||||
case META_POWER_SAVE_ON:
|
||||
state = DPMSModeOn;
|
||||
break;
|
||||
case META_POWER_SAVE_STANDBY:
|
||||
state = DPMSModeStandby;
|
||||
break;
|
||||
case META_POWER_SAVE_SUSPEND:
|
||||
state = DPMSModeSuspend;
|
||||
break;
|
||||
case META_POWER_SAVE_OFF:
|
||||
state = DPMSModeOff;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
switch (mode)
|
||||
{
|
||||
case META_POWER_SAVE_ON:
|
||||
state = DPMSModeOn;
|
||||
break;
|
||||
case META_POWER_SAVE_STANDBY:
|
||||
state = DPMSModeStandby;
|
||||
break;
|
||||
case META_POWER_SAVE_SUSPEND:
|
||||
state = DPMSModeSuspend;
|
||||
break;
|
||||
case META_POWER_SAVE_OFF:
|
||||
state = DPMSModeOff;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
DPMSForceLevel (manager_xrandr->xdisplay, state);
|
||||
DPMSSetTimeouts (manager_xrandr->xdisplay, 0, 0, 0);
|
||||
@ -219,7 +224,7 @@ is_crtc_assignment_changed (MetaCrtc *crtc,
|
||||
|
||||
for (j = 0; j < crtc_info->outputs->len; j++)
|
||||
{
|
||||
MetaOutput *output = ((MetaOutput**) crtc_info->outputs->pdata)[j];
|
||||
MetaOutput *output = ((MetaOutput **) crtc_info->outputs->pdata)[j];
|
||||
MetaCrtc *assigned_crtc;
|
||||
|
||||
assigned_crtc = meta_output_get_assigned_crtc (output);
|
||||
@ -276,7 +281,7 @@ is_output_assignment_changed (MetaOutput *output,
|
||||
for (j = 0; j < crtc_info->outputs->len; j++)
|
||||
{
|
||||
MetaOutput *crtc_info_output =
|
||||
((MetaOutput**) crtc_info->outputs->pdata)[j];
|
||||
((MetaOutput **) crtc_info->outputs->pdata)[j];
|
||||
|
||||
if (crtc_info_output == output &&
|
||||
crtc_info->crtc == assigned_crtc)
|
||||
@ -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,10 +367,10 @@ 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++)
|
||||
{
|
||||
MetaCrtcInfo *crtc_info = 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++)
|
||||
@ -452,7 +460,7 @@ apply_crtc_assignments (MetaMonitorManager *manager,
|
||||
{
|
||||
MetaOutput *output;
|
||||
|
||||
output = ((MetaOutput**)crtc_info->outputs->pdata)[j];
|
||||
output = ((MetaOutput **) crtc_info->outputs->pdata)[j];
|
||||
|
||||
output->is_dirty = TRUE;
|
||||
meta_output_assign_crtc (output, crtc);
|
||||
@ -471,10 +479,12 @@ 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),
|
||||
mode->width, mode->height, (float)mode->refresh_rate,
|
||||
crtc_info->x, crtc_info->y, crtc_info->transform);
|
||||
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,10 +571,11 @@ meta_monitor_manager_xrandr_rebuild_derived (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config,
|
||||
MetaMonitorsConfigMethod method,
|
||||
GError **error)
|
||||
meta_monitor_manager_xrandr_apply_monitors_config (
|
||||
MetaMonitorManager *manager,
|
||||
MetaMonitorsConfig *config,
|
||||
MetaMonitorsConfigMethod method,
|
||||
GError **error)
|
||||
{
|
||||
GPtrArray *crtc_infos;
|
||||
GPtrArray *output_infos;
|
||||
@ -617,24 +628,25 @@ meta_monitor_manager_xrandr_apply_monitors_config (MetaMonitorManager *mana
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_change_backlight (MetaMonitorManager *manager,
|
||||
MetaOutput *output,
|
||||
gint value)
|
||||
MetaOutput *output,
|
||||
gint value)
|
||||
{
|
||||
meta_output_xrandr_change_backlight (output, value);
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager,
|
||||
MetaCrtc *crtc,
|
||||
gsize *size,
|
||||
unsigned short **red,
|
||||
unsigned short **green,
|
||||
unsigned short **blue)
|
||||
meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager,
|
||||
MetaCrtc *crtc,
|
||||
gsize *size,
|
||||
unsigned short **red,
|
||||
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);
|
||||
gamma = XRRGetCrtcGamma (manager_xrandr->xdisplay, (XID) crtc->crtc_id);
|
||||
|
||||
*size = gamma->size;
|
||||
*red = g_memdup (gamma->red, sizeof (unsigned short) * gamma->size);
|
||||
@ -646,13 +658,14 @@ meta_monitor_manager_xrandr_get_crtc_gamma (MetaMonitorManager *manager,
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_set_crtc_gamma (MetaMonitorManager *manager,
|
||||
MetaCrtc *crtc,
|
||||
gsize size,
|
||||
unsigned short *red,
|
||||
unsigned short *green,
|
||||
unsigned short *blue)
|
||||
MetaCrtc *crtc,
|
||||
gsize size,
|
||||
unsigned short *red,
|
||||
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);
|
||||
@ -660,7 +673,7 @@ meta_monitor_manager_xrandr_set_crtc_gamma (MetaMonitorManager *manager,
|
||||
memcpy (gamma->green, green, sizeof (unsigned short) * size);
|
||||
memcpy (gamma->blue, blue, sizeof (unsigned short) * size);
|
||||
|
||||
XRRSetCrtcGamma (manager_xrandr->xdisplay, (XID)crtc->crtc_id, gamma);
|
||||
XRRSetCrtcGamma (manager_xrandr->xdisplay, (XID) crtc->crtc_id, gamma);
|
||||
|
||||
XRRFreeGamma (gamma);
|
||||
}
|
||||
@ -685,8 +698,9 @@ meta_monitor_xrandr_data_from_monitor (MetaMonitor *monitor)
|
||||
}
|
||||
|
||||
static void
|
||||
meta_monitor_manager_xrandr_increase_monitor_count (MetaMonitorManagerXrandr *manager_xrandr,
|
||||
Atom name_atom)
|
||||
meta_monitor_manager_xrandr_increase_monitor_count (
|
||||
MetaMonitorManagerXrandr *manager_xrandr,
|
||||
Atom name_atom)
|
||||
{
|
||||
int count;
|
||||
|
||||
@ -701,8 +715,9 @@ meta_monitor_manager_xrandr_increase_monitor_count (MetaMonitorManagerXrandr *ma
|
||||
}
|
||||
|
||||
static int
|
||||
meta_monitor_manager_xrandr_decrease_monitor_count (MetaMonitorManagerXrandr *manager_xrandr,
|
||||
Atom name_atom)
|
||||
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,9 +855,10 @@ meta_monitor_manager_xrandr_is_transform_handled (MetaMonitorManager *manager,
|
||||
}
|
||||
|
||||
static float
|
||||
meta_monitor_manager_xrandr_calculate_monitor_mode_scale (MetaMonitorManager *manager,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode)
|
||||
meta_monitor_manager_xrandr_calculate_monitor_mode_scale (
|
||||
MetaMonitorManager *manager,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode)
|
||||
{
|
||||
return meta_monitor_calculate_mode_scale (monitor, monitor_mode);
|
||||
}
|
||||
@ -916,11 +935,12 @@ ensure_supported_monitor_scales (MetaMonitorManager *manager)
|
||||
}
|
||||
|
||||
static float *
|
||||
meta_monitor_manager_xrandr_calculate_supported_scales (MetaMonitorManager *manager,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
int *n_supported_scales)
|
||||
meta_monitor_manager_xrandr_calculate_supported_scales (
|
||||
MetaMonitorManager *manager,
|
||||
MetaLogicalMonitorLayoutMode layout_mode,
|
||||
MetaMonitor *monitor,
|
||||
MetaMonitorMode *monitor_mode,
|
||||
int *n_supported_scales)
|
||||
{
|
||||
MetaMonitorManagerXrandr *manager_xrandr =
|
||||
META_MONITOR_MANAGER_XRANDR (manager);
|
||||
@ -974,8 +994,8 @@ meta_monitor_manager_xrandr_constructed (GObject *object)
|
||||
meta_monitor_manager_add_gpu (manager, manager_xrandr->gpu);
|
||||
|
||||
if (!XRRQueryExtension (manager_xrandr->xdisplay,
|
||||
&manager_xrandr->rr_event_base,
|
||||
&manager_xrandr->rr_error_base))
|
||||
&manager_xrandr->rr_event_base,
|
||||
&manager_xrandr->rr_error_base))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -983,12 +1003,12 @@ 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
|
||||
| RRCrtcChangeNotifyMask
|
||||
| RROutputPropertyNotifyMask);
|
||||
DefaultRootWindow (manager_xrandr->xdisplay),
|
||||
RRScreenChangeNotifyMask
|
||||
| RRCrtcChangeNotifyMask
|
||||
| RROutputPropertyNotifyMask);
|
||||
|
||||
manager_xrandr->has_randr15 = FALSE;
|
||||
XRRQueryVersion (manager_xrandr->xdisplay, &major_version,
|
||||
@ -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,28 +1054,41 @@ 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,
|
||||
XEvent *event)
|
||||
meta_monitor_manager_xrandr_handle_xevent (
|
||||
MetaMonitorManagerXrandr *manager_xrandr,
|
||||
XEvent *event)
|
||||
{
|
||||
MetaMonitorManager *manager = META_MONITOR_MANAGER (manager_xrandr);
|
||||
MetaGpuXrandr *gpu_xrandr;
|
||||
|
@ -143,7 +143,7 @@ static int
|
||||
normalize_backlight (MetaOutput *output,
|
||||
int hw_value)
|
||||
{
|
||||
return round ((double)(hw_value - output->backlight_min) /
|
||||
return round ((double) (hw_value - output->backlight_min) /
|
||||
(output->backlight_max - output->backlight_min) * 100.0);
|
||||
}
|
||||
|
||||
@ -161,12 +161,13 @@ meta_output_xrandr_change_backlight (MetaOutput *output,
|
||||
atom = XInternAtom (xdisplay, "Backlight", False);
|
||||
|
||||
xcb_randr_change_output_property (XGetXCBConnection (xdisplay),
|
||||
(XID)output->winsys_id,
|
||||
(XID) output->winsys_id,
|
||||
atom, XCB_ATOM_INTEGER, 32,
|
||||
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);
|
||||
}
|
||||
|
||||
@ -184,7 +185,7 @@ output_get_integer_property (MetaOutput *output,
|
||||
|
||||
atom = XInternAtom (xdisplay, propname, False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) output->winsys_id,
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_INTEGER,
|
||||
&actual_type, &actual_format,
|
||||
@ -193,7 +194,7 @@ output_get_integer_property (MetaOutput *output,
|
||||
exists = (actual_type == XA_INTEGER && actual_format == 32 && nitems == 1);
|
||||
|
||||
if (exists && value != NULL)
|
||||
*value = ((int*)buffer)[0];
|
||||
*value = ((int *) buffer)[0];
|
||||
|
||||
XFree (buffer);
|
||||
return exists;
|
||||
@ -212,7 +213,7 @@ output_get_property_exists (MetaOutput *output,
|
||||
|
||||
atom = XInternAtom (xdisplay, propname, False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) output->winsys_id,
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, AnyPropertyType,
|
||||
&actual_type, &actual_format,
|
||||
@ -236,7 +237,7 @@ output_get_boolean_property (MetaOutput *output,
|
||||
|
||||
atom = XInternAtom (xdisplay, propname, False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) output->winsys_id,
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_CARDINAL,
|
||||
&actual_type, &actual_format,
|
||||
@ -245,7 +246,7 @@ output_get_boolean_property (MetaOutput *output,
|
||||
if (actual_type != XA_CARDINAL || actual_format != 32 || nitems < 1)
|
||||
return FALSE;
|
||||
|
||||
return ((int*)buffer)[0];
|
||||
return ((int *) buffer)[0];
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -266,7 +267,7 @@ output_get_underscanning_xrandr (MetaOutput *output)
|
||||
|
||||
atom = XInternAtom (xdisplay, "underscan", False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) output->winsys_id,
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_ATOM,
|
||||
&actual_type, &actual_format,
|
||||
@ -275,7 +276,7 @@ output_get_underscanning_xrandr (MetaOutput *output)
|
||||
if (actual_type != XA_ATOM || actual_format != 32 || nitems < 1)
|
||||
return FALSE;
|
||||
|
||||
str = XGetAtomName (xdisplay, *(Atom *)buffer);
|
||||
str = XGetAtomName (xdisplay, *(Atom *) buffer);
|
||||
return (strcmp (str, "on") == 0);
|
||||
}
|
||||
|
||||
@ -293,7 +294,7 @@ output_get_supports_underscanning_xrandr (MetaOutput *output)
|
||||
|
||||
atom = XInternAtom (xdisplay, "underscan", False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) output->winsys_id,
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_ATOM,
|
||||
&actual_type, &actual_format,
|
||||
@ -336,7 +337,7 @@ output_get_backlight_xrandr (MetaOutput *output)
|
||||
|
||||
atom = XInternAtom (xdisplay, "Backlight", False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) output->winsys_id,
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_INTEGER,
|
||||
&actual_type, &actual_format,
|
||||
@ -345,7 +346,7 @@ output_get_backlight_xrandr (MetaOutput *output)
|
||||
if (actual_type != XA_INTEGER || actual_format != 32 || nitems < 1)
|
||||
return FALSE;
|
||||
|
||||
value = ((int*)buffer)[0];
|
||||
value = ((int *) buffer)[0];
|
||||
if (value > 0)
|
||||
return normalize_backlight (output, value);
|
||||
else
|
||||
@ -387,10 +388,10 @@ output_get_backlight_limits_xrandr (MetaOutput *output)
|
||||
}
|
||||
|
||||
static guint8 *
|
||||
get_edid_property (Display *xdisplay,
|
||||
RROutput output,
|
||||
Atom atom,
|
||||
gsize *len)
|
||||
get_edid_property (Display *xdisplay,
|
||||
RROutput output,
|
||||
Atom atom,
|
||||
gsize *len)
|
||||
{
|
||||
unsigned char *prop;
|
||||
int actual_format;
|
||||
@ -522,7 +523,7 @@ output_get_connector_type_from_prop (MetaOutput *output)
|
||||
|
||||
atom = XInternAtom (xdisplay, "ConnectorType", False);
|
||||
XRRGetOutputProperty (xdisplay,
|
||||
(XID)output->winsys_id,
|
||||
(XID) output->winsys_id,
|
||||
atom,
|
||||
0, G_MAXLONG, False, False, XA_ATOM,
|
||||
&actual_type, &actual_format,
|
||||
@ -618,7 +619,7 @@ output_get_panel_orientation_transform (MetaOutput *output)
|
||||
g_autofree char *str = NULL;
|
||||
|
||||
atom = XInternAtom (xdisplay, "panel orientation", False);
|
||||
XRRGetOutputProperty (xdisplay, (XID)output->winsys_id, atom,
|
||||
XRRGetOutputProperty (xdisplay, (XID) output->winsys_id, atom,
|
||||
0, G_MAXLONG, False, False, XA_ATOM,
|
||||
&actual_type, &actual_format,
|
||||
&nitems, &bytes_after, &buffer);
|
||||
@ -626,7 +627,7 @@ output_get_panel_orientation_transform (MetaOutput *output)
|
||||
if (actual_type != XA_ATOM || actual_format != 32 || nitems < 1)
|
||||
return META_MONITOR_TRANSFORM_NORMAL;
|
||||
|
||||
str = XGetAtomName (xdisplay, *(Atom *)buffer);
|
||||
str = XGetAtomName (xdisplay, *(Atom *) buffer);
|
||||
if (strcmp (str, "Upside Down") == 0)
|
||||
return META_MONITOR_TRANSFORM_180;
|
||||
|
||||
@ -666,7 +667,7 @@ output_get_tile_info (MetaOutput *output)
|
||||
|
||||
if (actual_type == XA_INTEGER && actual_format == 32 && nitems == 8)
|
||||
{
|
||||
long *values = (long *)prop;
|
||||
long *values = (long *) prop;
|
||||
output->tile_info.group_id = values[0];
|
||||
output->tile_info.flags = values[1];
|
||||
output->tile_info.max_h_tiles = values[2];
|
||||
@ -781,7 +782,7 @@ meta_create_xrandr_output (MetaGpuXrandr *gpu_xrandr,
|
||||
output_get_panel_orientation_transform (output);
|
||||
|
||||
if (meta_monitor_transform_is_rotated (
|
||||
output->panel_orientation_transform))
|
||||
output->panel_orientation_transform))
|
||||
{
|
||||
output->width_mm = xrandr_output->mm_height;
|
||||
output->height_mm = xrandr_output->mm_width;
|
||||
|
@ -43,7 +43,7 @@
|
||||
G_DEFINE_TYPE (MetaRendererX11, meta_renderer_x11, META_TYPE_RENDERER)
|
||||
|
||||
static const CoglWinsysVtable *
|
||||
get_x11_cogl_winsys_vtable (CoglRenderer *renderer)
|
||||
get_x11_cogl_winsys_vtable (CoglRenderer * renderer)
|
||||
{
|
||||
#ifdef COGL_HAS_EGL_PLATFORM_XLIB_SUPPORT
|
||||
if (meta_is_wayland_compositor ())
|
||||
|
@ -229,11 +229,11 @@ draw_logical_monitor (MetaStageX11Nested *stage_nested,
|
||||
meta_monitor_mode_foreach_crtc (monitor, current_mode,
|
||||
draw_crtc,
|
||||
&(DrawCrtcData) {
|
||||
.stage_nested = stage_nested,
|
||||
.texture = texture,
|
||||
.view = view,
|
||||
.logical_monitor = logical_monitor
|
||||
},
|
||||
.stage_nested = stage_nested,
|
||||
.texture = texture,
|
||||
.view = view,
|
||||
.logical_monitor = logical_monitor
|
||||
},
|
||||
NULL);
|
||||
}
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -316,7 +318,7 @@ meta_stage_x11_nested_unrealize (ClutterStageWindow *stage_window)
|
||||
* 1x1 one if we're unrealizing the current one, so Cogl doesn't
|
||||
* keep any reference to the foreign window.
|
||||
*/
|
||||
for (l = meta_renderer_get_views (renderer); l ;l = l->next)
|
||||
for (l = meta_renderer_get_views (renderer); l; l = l->next)
|
||||
{
|
||||
ClutterStageView *view = l->data;
|
||||
CoglFramebuffer *framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||
|
@ -32,8 +32,8 @@ G_DEFINE_TYPE (MetaBackendX11Nested, meta_backend_x11_nested,
|
||||
META_TYPE_BACKEND_X11)
|
||||
|
||||
static MetaRenderer *
|
||||
meta_backend_x11_nested_create_renderer (MetaBackend *backend,
|
||||
GError **error)
|
||||
meta_backend_x11_nested_create_renderer (MetaBackend * backend,
|
||||
GError * *error)
|
||||
{
|
||||
return g_object_new (META_TYPE_RENDERER_X11_NESTED, NULL);
|
||||
}
|
||||
@ -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);
|
||||
@ -112,9 +113,9 @@ meta_backend_x11_nested_select_stage_events (MetaBackend *backend)
|
||||
*/
|
||||
XWindowAttributes xwa;
|
||||
|
||||
XGetWindowAttributes(xdisplay, xwin, &xwa);
|
||||
XSelectInput(xdisplay, xwin,
|
||||
xwa.your_event_mask | FocusChangeMask | KeymapStateMask);
|
||||
XGetWindowAttributes (xdisplay, xwin, &xwa);
|
||||
XSelectInput (xdisplay, xwin,
|
||||
xwa.your_event_mask | FocusChangeMask | KeymapStateMask);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -103,14 +103,16 @@ create_offscreen (CoglContext *cogl_context,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11_nested,
|
||||
int width,
|
||||
int height)
|
||||
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;
|
||||
@ -124,8 +126,8 @@ meta_renderer_x11_nested_resize_legacy_view (MetaRendererX11Nested *renderer_x11
|
||||
return;
|
||||
|
||||
view_layout = (cairo_rectangle_int_t) {
|
||||
.width = width,
|
||||
.height = height
|
||||
.width = width,
|
||||
.height = height
|
||||
};
|
||||
|
||||
fake_onscreen = create_offscreen (cogl_context, width, height);
|
||||
@ -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,
|
||||
int width,
|
||||
int height)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -146,10 +155,10 @@ meta_actor_is_untransformed (ClutterActor *actor,
|
||||
* transform.
|
||||
*/
|
||||
gboolean
|
||||
meta_actor_painting_untransformed (int paint_width,
|
||||
int paint_height,
|
||||
int *x_origin,
|
||||
int *y_origin)
|
||||
meta_actor_painting_untransformed (int paint_width,
|
||||
int paint_height,
|
||||
int *x_origin,
|
||||
int *y_origin)
|
||||
{
|
||||
CoglMatrix modelview, projection, modelview_projection;
|
||||
ClutterVertex vertices[4];
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
@ -304,8 +313,8 @@ meta_stage_is_focused (MetaDisplay *display)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
grab_devices (MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
grab_devices (MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaBackend *backend = META_BACKEND (meta_get_backend ());
|
||||
gboolean pointer_grabbed = FALSE;
|
||||
@ -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;
|
||||
@ -329,23 +340,27 @@ grab_devices (MetaModalOptions options,
|
||||
|
||||
return TRUE;
|
||||
|
||||
fail:
|
||||
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;
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_begin_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
meta_begin_modal_for_plugin (MetaCompositor *compositor,
|
||||
MetaPlugin *plugin,
|
||||
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);
|
||||
@ -598,13 +621,14 @@ meta_compositor_unmanage (MetaCompositor *compositor)
|
||||
*/
|
||||
static void
|
||||
meta_shape_cow_for_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaDisplay *display = compositor->display;
|
||||
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,14 +678,16 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_add_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
meta_compositor_add_window (MetaCompositor *compositor,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaDisplay *display = compositor->display;
|
||||
|
||||
@ -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,16 +822,18 @@ 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
|
||||
meta_compositor_show_window (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaWindow *window,
|
||||
MetaCompEffect effect)
|
||||
{
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (window));
|
||||
meta_window_actor_show (window_actor, effect);
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (meta_window_get_compositor_private (
|
||||
window));
|
||||
meta_window_actor_show (window_actor, effect);
|
||||
}
|
||||
|
||||
void
|
||||
@ -801,20 +841,23 @@ 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);
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_size_change_window (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaSizeChange which_change,
|
||||
MetaRectangle *old_frame_rect,
|
||||
MetaRectangle *old_buffer_rect)
|
||||
meta_compositor_size_change_window (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaSizeChange which_change,
|
||||
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
|
||||
@ -825,7 +868,7 @@ meta_compositor_switch_workspace (MetaCompositor *compositor,
|
||||
{
|
||||
gint to_indx, from_indx;
|
||||
|
||||
to_indx = meta_workspace_index (to);
|
||||
to_indx = meta_workspace_index (to);
|
||||
from_indx = meta_workspace_index (from);
|
||||
|
||||
compositor->switch_workspace_in_progress++;
|
||||
@ -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;
|
||||
@ -976,8 +1020,8 @@ on_top_window_actor_destroyed (MetaWindowActor *window_actor,
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_sync_stack (MetaCompositor *compositor,
|
||||
GList *stack)
|
||||
meta_compositor_sync_stack (MetaCompositor *compositor,
|
||||
GList *stack)
|
||||
{
|
||||
GList *old_stack;
|
||||
|
||||
@ -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
|
||||
@ -1077,10 +1124,11 @@ meta_compositor_sync_stack (MetaCompositor *compositor,
|
||||
|
||||
void
|
||||
meta_compositor_sync_window_geometry (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
gboolean did_placement)
|
||||
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,10 +1474,13 @@ 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;
|
||||
gint64 server_time_usec = (gint64) server_time * 1000;
|
||||
gint64 current_monotonic_time = g_get_monotonic_time ();
|
||||
compositor->server_time_query_time = current_monotonic_time;
|
||||
|
||||
@ -1435,11 +1490,12 @@ meta_compositor_monotonic_time_to_server_time (MetaDisplay *display,
|
||||
* is under load and our processing of the server response is
|
||||
* delayed.
|
||||
*/
|
||||
if (server_time_usec > current_monotonic_time - 1000*1000 &&
|
||||
server_time_usec < current_monotonic_time + 1000*1000)
|
||||
if (server_time_usec > current_monotonic_time - 1000 * 1000 &&
|
||||
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
|
||||
@ -1465,22 +1522,24 @@ meta_compositor_hide_tile_preview (MetaCompositor *compositor)
|
||||
}
|
||||
|
||||
void
|
||||
meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y)
|
||||
meta_compositor_show_window_menu (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
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
|
||||
meta_compositor_show_window_menu_for_rect (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
MetaRectangle *rect)
|
||||
meta_compositor_show_window_menu_for_rect (MetaCompositor *compositor,
|
||||
MetaWindow *window,
|
||||
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,
|
||||
window);
|
||||
return meta_plugin_manager_create_inhibit_shortcuts_dialog (
|
||||
compositor->plugin_mgr,
|
||||
window);
|
||||
}
|
||||
|
@ -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,
|
||||
@ -106,44 +107,45 @@ typedef enum {
|
||||
} ChangedFlags;
|
||||
|
||||
#define GRADIENT_VERTEX_SHADER_DECLARATIONS \
|
||||
"uniform vec2 scale;\n" \
|
||||
"varying vec2 position;\n" \
|
||||
"uniform vec2 scale;\n" \
|
||||
"varying vec2 position;\n" \
|
||||
|
||||
#define GRADIENT_VERTEX_SHADER_CODE \
|
||||
"position = cogl_tex_coord0_in.xy * scale;\n" \
|
||||
"position = cogl_tex_coord0_in.xy * scale;\n" \
|
||||
|
||||
#define GRADIENT_FRAGMENT_SHADER_DECLARATIONS \
|
||||
"uniform float gradient_height_perc;\n" \
|
||||
"uniform float gradient_max_darkness;\n" \
|
||||
"varying vec2 position;\n" \
|
||||
"uniform float gradient_height_perc;\n" \
|
||||
"uniform float gradient_max_darkness;\n" \
|
||||
"varying vec2 position;\n" \
|
||||
|
||||
#define GRADIENT_FRAGMENT_SHADER_CODE \
|
||||
"float min_brightness = 1.0 - gradient_max_darkness;\n" \
|
||||
"float gradient_y_pos = min(position.y, gradient_height_perc) / gradient_height_perc;\n" \
|
||||
"float pixel_brightness = (1.0 - min_brightness) * gradient_y_pos + min_brightness;\n" \
|
||||
"cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
|
||||
"float min_brightness = 1.0 - gradient_max_darkness;\n" \
|
||||
"float gradient_y_pos = min(position.y, gradient_height_perc) / gradient_height_perc;\n" \
|
||||
"float pixel_brightness = (1.0 - min_brightness) * gradient_y_pos + min_brightness;\n" \
|
||||
"cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
|
||||
|
||||
#define VIGNETTE_VERTEX_SHADER_DECLARATIONS \
|
||||
"uniform vec2 scale;\n" \
|
||||
"uniform vec2 offset;\n" \
|
||||
"varying vec2 position;\n" \
|
||||
"uniform vec2 scale;\n" \
|
||||
"uniform vec2 offset;\n" \
|
||||
"varying vec2 position;\n" \
|
||||
|
||||
#define VIGNETTE_VERTEX_SHADER_CODE \
|
||||
"position = cogl_tex_coord0_in.xy * scale + offset;\n" \
|
||||
"position = cogl_tex_coord0_in.xy * scale + offset;\n" \
|
||||
|
||||
#define VIGNETTE_FRAGMENT_SHADER_DECLARATIONS \
|
||||
"uniform float vignette_sharpness;\n" \
|
||||
"varying vec2 position;\n" \
|
||||
"uniform float vignette_sharpness;\n" \
|
||||
"varying vec2 position;\n" \
|
||||
|
||||
#define VIGNETTE_FRAGMENT_SHADER_CODE \
|
||||
"float t = 2.0 * length(position);\n" \
|
||||
"t = min(t, 1.0);\n" \
|
||||
"float pixel_brightness = 1.0 - t * vignette_sharpness;\n" \
|
||||
"cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
|
||||
"float t = 2.0 * length(position);\n" \
|
||||
"t = min(t, 1.0);\n" \
|
||||
"float pixel_brightness = 1.0 - t * vignette_sharpness;\n" \
|
||||
"cogl_color_out.rgb = cogl_color_out.rgb * pixel_brightness;\n" \
|
||||
|
||||
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,16 +284,18 @@ 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_SHADER_DECLARATIONS,
|
||||
VIGNETTE_VERTEX_SHADER_CODE);
|
||||
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_SHADER_DECLARATIONS,
|
||||
VIGNETTE_FRAGMENT_SHADER_CODE);
|
||||
vignette_fragment_snippet = cogl_snippet_new (
|
||||
COGL_SNIPPET_HOOK_FRAGMENT,
|
||||
VIGNETTE_FRAGMENT_SHADER_DECLARATIONS,
|
||||
VIGNETTE_FRAGMENT_SHADER_CODE);
|
||||
|
||||
cogl_pipeline_add_snippet (*templatep, vignette_fragment_snippet);
|
||||
}
|
||||
@ -300,16 +306,18 @@ 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_SHADER_DECLARATIONS,
|
||||
GRADIENT_VERTEX_SHADER_CODE);
|
||||
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_SHADER_DECLARATIONS,
|
||||
GRADIENT_FRAGMENT_SHADER_CODE);
|
||||
gradient_fragment_snippet = cogl_snippet_new (
|
||||
COGL_SNIPPET_HOOK_FRAGMENT,
|
||||
GRADIENT_FRAGMENT_SHADER_DECLARATIONS,
|
||||
GRADIENT_FRAGMENT_SHADER_CODE);
|
||||
|
||||
cogl_pipeline_add_snippet (*templatep, gradient_fragment_snippet);
|
||||
}
|
||||
@ -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;
|
||||
@ -442,18 +460,20 @@ set_glsl_parameters (MetaBackgroundActor *self,
|
||||
/* Compute a scale and offset for transforming texture coordinates to the
|
||||
* coordinate system from [-0.5 to 0.5] across the area of the actor
|
||||
*/
|
||||
scale[0] = priv->texture_area.width / (float)actor_pixel_rect->width;
|
||||
scale[1] = priv->texture_area.height / (float)actor_pixel_rect->height;
|
||||
offset[0] = priv->texture_area.x / (float)actor_pixel_rect->width - 0.5;
|
||||
offset[1] = priv->texture_area.y / (float)actor_pixel_rect->height - 0.5;
|
||||
scale[0] = priv->texture_area.width / (float) actor_pixel_rect->width;
|
||||
scale[1] = priv->texture_area.height / (float) actor_pixel_rect->height;
|
||||
offset[0] = priv->texture_area.x / (float) actor_pixel_rect->width - 0.5;
|
||||
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);
|
||||
}
|
||||
@ -524,22 +544,24 @@ meta_background_actor_paint (ClutterActor *actor)
|
||||
int n_rects = cairo_region_num_rectangles (priv->clip_region);
|
||||
if (n_rects <= MAX_RECTS)
|
||||
{
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
cairo_region_get_rectangle (priv->clip_region, i, &rect);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_rectangle_int_t rect;
|
||||
cairo_region_get_rectangle (priv->clip_region, i, &rect);
|
||||
|
||||
if (!gdk_rectangle_intersect (&actor_pixel_rect, &rect, &rect))
|
||||
continue;
|
||||
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;
|
||||
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
|
||||
@ -605,10 +627,10 @@ meta_background_actor_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_background_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
meta_background_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaBackgroundActorPrivate *priv = META_BACKGROUND_ACTOR (object)->priv;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -716,8 +739,8 @@ meta_background_actor_class_init (MetaBackgroundActorClass *klass)
|
||||
param_spec = g_param_spec_double ("gradient-max-darkness",
|
||||
"Gradient Max Darkness",
|
||||
"How dark is the gradient initially",
|
||||
0.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE);
|
||||
0.0, 1.0, 0.0,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_GRADIENT_MAX_DARKNESS,
|
||||
@ -866,7 +889,7 @@ meta_background_actor_set_background (MetaBackgroundActor *self,
|
||||
if (priv->background)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (priv->background,
|
||||
(gpointer)on_background_changed,
|
||||
(gpointer) on_background_changed,
|
||||
self);
|
||||
g_object_unref (priv->background);
|
||||
priv->background = NULL;
|
||||
@ -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;
|
||||
@ -929,12 +953,13 @@ meta_background_actor_set_monitor (MetaBackgroundActor *self,
|
||||
MetaDisplay *display = priv->display;
|
||||
|
||||
if(priv->monitor == monitor)
|
||||
return;
|
||||
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);
|
||||
invalidate_pipeline (self, CHANGED_GRADIENT_PARAMETERS);
|
||||
|
||||
priv->monitor = monitor;
|
||||
}
|
||||
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -53,10 +53,10 @@ struct _MetaBackgroundPrivate
|
||||
MetaBackgroundMonitor *monitors;
|
||||
int n_monitors;
|
||||
|
||||
GDesktopBackgroundStyle style;
|
||||
GDesktopBackgroundStyle style;
|
||||
GDesktopBackgroundShading shading_direction;
|
||||
ClutterColor color;
|
||||
ClutterColor second_color;
|
||||
ClutterColor color;
|
||||
ClutterColor second_color;
|
||||
|
||||
GFile *file1;
|
||||
MetaBackgroundImage *background_image1;
|
||||
@ -189,10 +189,10 @@ meta_background_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_background_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
meta_background_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaBackgroundPrivate *priv = META_BACKGROUND (object)->priv;
|
||||
|
||||
@ -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;
|
||||
@ -271,7 +275,7 @@ set_file (MetaBackground *self,
|
||||
if (*imagep)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (*imagep,
|
||||
(gpointer)on_background_loaded,
|
||||
(gpointer) on_background_loaded,
|
||||
self);
|
||||
g_object_unref (*imagep);
|
||||
*imagep = NULL;
|
||||
@ -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);
|
||||
@ -292,7 +297,7 @@ set_file (MetaBackground *self,
|
||||
static void
|
||||
meta_background_dispose (GObject *object)
|
||||
{
|
||||
MetaBackground *self = META_BACKGROUND (object);
|
||||
MetaBackground *self = META_BACKGROUND (object);
|
||||
MetaBackgroundPrivate *priv = self->priv;
|
||||
|
||||
free_color_texture (self);
|
||||
@ -317,14 +322,15 @@ meta_background_finalize (GObject *object)
|
||||
static void
|
||||
meta_background_constructed (GObject *object)
|
||||
{
|
||||
MetaBackground *self = META_BACKGROUND (object);
|
||||
MetaBackground *self = META_BACKGROUND (object);
|
||||
MetaBackgroundPrivate *priv = self->priv;
|
||||
MetaMonitorManager *monitor_manager = meta_monitor_manager_get ();
|
||||
|
||||
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
|
||||
@ -383,10 +388,10 @@ set_texture_area_from_monitor_area (cairo_rectangle_int_t *monitor_area,
|
||||
}
|
||||
|
||||
static void
|
||||
get_texture_area (MetaBackground *self,
|
||||
cairo_rectangle_int_t *monitor_rect,
|
||||
CoglTexture *texture,
|
||||
cairo_rectangle_int_t *texture_area)
|
||||
get_texture_area (MetaBackground *self,
|
||||
cairo_rectangle_int_t *monitor_rect,
|
||||
CoglTexture *texture,
|
||||
cairo_rectangle_int_t *texture_area)
|
||||
{
|
||||
MetaBackgroundPrivate *priv = self->priv;
|
||||
cairo_rectangle_int_t image_area;
|
||||
@ -472,23 +477,23 @@ get_texture_area (MetaBackground *self,
|
||||
break;
|
||||
|
||||
case G_DESKTOP_BACKGROUND_STYLE_SPANNED:
|
||||
{
|
||||
/* paint region is the union of all monitors, with the origin
|
||||
* of the region set to align with monitor associated with the background.
|
||||
*/
|
||||
meta_display_get_size (priv->display, &screen_width, &screen_height);
|
||||
{
|
||||
/* paint region is the union of all monitors, with the origin
|
||||
* of the region set to align with monitor associated with the background.
|
||||
*/
|
||||
meta_display_get_size (priv->display, &screen_width, &screen_height);
|
||||
|
||||
/* unclipped texture area is whole screen */
|
||||
image_area.width = screen_width;
|
||||
image_area.height = screen_height;
|
||||
/* unclipped texture area is whole screen */
|
||||
image_area.width = screen_width;
|
||||
image_area.height = screen_height;
|
||||
|
||||
/* But make (0,0) line up with the appropriate monitor */
|
||||
image_area.x = -monitor_rect->x;
|
||||
image_area.y = -monitor_rect->y;
|
||||
/* But make (0,0) line up with the appropriate monitor */
|
||||
image_area.x = -monitor_rect->x;
|
||||
image_area.y = -monitor_rect->y;
|
||||
|
||||
*texture_area = image_area;
|
||||
break;
|
||||
}
|
||||
*texture_area = image_area;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -518,10 +523,13 @@ draw_texture (MetaBackground *self,
|
||||
0,
|
||||
monitor_area->width,
|
||||
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);
|
||||
-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);
|
||||
|
||||
bare_region_visible = texture_has_alpha (texture);
|
||||
|
||||
@ -535,13 +543,14 @@ 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;
|
||||
break;
|
||||
default:
|
||||
g_return_val_if_reached(FALSE);
|
||||
g_return_val_if_reached (FALSE);
|
||||
}
|
||||
|
||||
return bare_region_visible;
|
||||
@ -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,
|
||||
COGL_PIXEL_FORMAT_RGB_888,
|
||||
width * 3,
|
||||
pixels,
|
||||
&error));
|
||||
priv->color_texture =
|
||||
COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, width, height,
|
||||
COGL_PIXEL_FORMAT_RGB_888,
|
||||
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);
|
||||
|
||||
@ -719,24 +736,24 @@ get_wrap_mode (GDesktopBackgroundStyle style)
|
||||
{
|
||||
switch (style)
|
||||
{
|
||||
case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
|
||||
return COGL_PIPELINE_WRAP_MODE_REPEAT;
|
||||
case G_DESKTOP_BACKGROUND_STYLE_NONE:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_STRETCHED:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_CENTERED:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_SCALED:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_ZOOM:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_SPANNED:
|
||||
default:
|
||||
return COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE;
|
||||
case G_DESKTOP_BACKGROUND_STYLE_WALLPAPER:
|
||||
return COGL_PIPELINE_WRAP_MODE_REPEAT;
|
||||
case G_DESKTOP_BACKGROUND_STYLE_NONE:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_STRETCHED:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_CENTERED:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_SCALED:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_ZOOM:
|
||||
case G_DESKTOP_BACKGROUND_STYLE_SPANNED:
|
||||
default:
|
||||
return COGL_PIPELINE_WRAP_MODE_CLAMP_TO_EDGE;
|
||||
}
|
||||
}
|
||||
|
||||
CoglTexture *
|
||||
meta_background_get_texture (MetaBackground *self,
|
||||
int monitor_index,
|
||||
cairo_rectangle_int_t *texture_area,
|
||||
CoglPipelineWrapMode *wrap_mode)
|
||||
meta_background_get_texture (MetaBackground *self,
|
||||
int monitor_index,
|
||||
cairo_rectangle_int_t *texture_area,
|
||||
CoglPipelineWrapMode *wrap_mode)
|
||||
{
|
||||
MetaBackgroundPrivate *priv;
|
||||
MetaBackgroundMonitor *monitor;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -901,10 +929,10 @@ meta_background_set_color (MetaBackground *self,
|
||||
}
|
||||
|
||||
void
|
||||
meta_background_set_gradient (MetaBackground *self,
|
||||
GDesktopBackgroundShading shading_direction,
|
||||
ClutterColor *color,
|
||||
ClutterColor *second_color)
|
||||
meta_background_set_gradient (MetaBackground *self,
|
||||
GDesktopBackgroundShading shading_direction,
|
||||
ClutterColor *color,
|
||||
ClutterColor *second_color)
|
||||
{
|
||||
MetaBackgroundPrivate *priv;
|
||||
|
||||
@ -924,9 +952,9 @@ meta_background_set_gradient (MetaBackground *self,
|
||||
}
|
||||
|
||||
void
|
||||
meta_background_set_file (MetaBackground *self,
|
||||
GFile *file,
|
||||
GDesktopBackgroundStyle style)
|
||||
meta_background_set_file (MetaBackground *self,
|
||||
GFile *file,
|
||||
GDesktopBackgroundStyle style)
|
||||
{
|
||||
g_return_if_fail (META_IS_BACKGROUND (self));
|
||||
|
||||
@ -934,11 +962,11 @@ meta_background_set_file (MetaBackground *self,
|
||||
}
|
||||
|
||||
void
|
||||
meta_background_set_blend (MetaBackground *self,
|
||||
GFile *file1,
|
||||
GFile *file2,
|
||||
double blend_factor,
|
||||
GDesktopBackgroundStyle style)
|
||||
meta_background_set_blend (MetaBackground *self,
|
||||
GFile *file1,
|
||||
GFile *file2,
|
||||
double blend_factor,
|
||||
GDesktopBackgroundStyle style)
|
||||
{
|
||||
MetaBackgroundPrivate *priv;
|
||||
|
||||
|
@ -108,10 +108,11 @@ meta_cullable_cull_out_children (MetaCullable *cullable,
|
||||
clutter_actor_get_position (child, &x, &y);
|
||||
|
||||
/* Temporarily move to the coordinate system of the actor */
|
||||
cairo_region_translate (unobscured_region, - x, - y);
|
||||
cairo_region_translate (clip_region, - x, - y);
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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,
|
||||
@ -77,10 +79,10 @@ meta_dnd_actor_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_dnd_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
meta_dnd_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaDnDActor *self = META_DND_ACTOR (object);
|
||||
MetaDnDActorPrivate *priv = meta_dnd_actor_get_instance_private (self);
|
||||
|
@ -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
|
||||
};
|
||||
@ -117,8 +118,8 @@ meta_dnd_notify_dnd_enter (MetaDnd *dnd)
|
||||
|
||||
static void
|
||||
meta_dnd_notify_dnd_position_change (MetaDnd *dnd,
|
||||
int x,
|
||||
int y)
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
g_signal_emit (dnd, signals[POSITION_CHANGE], 0, x, y);
|
||||
}
|
||||
@ -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))
|
||||
@ -158,39 +160,43 @@ meta_dnd_handle_xdnd_event (MetaBackend *backend,
|
||||
XEvent xevent;
|
||||
Window src = xev->xclient.data.l[0];
|
||||
|
||||
memset (&xevent, 0, sizeof(xevent));
|
||||
memset (&xevent, 0, sizeof (xevent));
|
||||
xevent.xany.type = ClientMessage;
|
||||
xevent.xany.display = xdisplay;
|
||||
xevent.xclient.window = src;
|
||||
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;
|
||||
|
||||
XSendEvent (xdisplay, src, False, 0, &xevent);
|
||||
|
||||
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] >> 16),
|
||||
(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);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WAYLAND
|
||||
@ -206,9 +212,10 @@ meta_dnd_wayland_on_motion_event (ClutterActor *actor,
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
clutter_event_get_coords (event, &event_x, &event_y);
|
||||
meta_dnd_notify_dnd_position_change (dnd, (int)event_x, (int)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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
@ -93,13 +97,14 @@ meta_feedback_actor_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_feedback_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
meta_feedback_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
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)
|
||||
{
|
||||
@ -220,9 +225,9 @@ meta_feedback_actor_get_anchor (MetaFeedbackActor *self,
|
||||
}
|
||||
|
||||
void
|
||||
meta_feedback_actor_set_position (MetaFeedbackActor *self,
|
||||
int x,
|
||||
int y)
|
||||
meta_feedback_actor_set_position (MetaFeedbackActor *self,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
MetaFeedbackActorPrivate *priv;
|
||||
|
||||
|
@ -36,22 +36,22 @@ enum
|
||||
|
||||
struct _MetaModulePrivate
|
||||
{
|
||||
GModule *lib;
|
||||
gchar *path;
|
||||
GType plugin_type;
|
||||
GModule *lib;
|
||||
gchar *path;
|
||||
GType plugin_type;
|
||||
};
|
||||
|
||||
#define META_MODULE_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_MODULE, MetaModulePrivate))
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_MODULE, MetaModulePrivate))
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaModule, meta_module, G_TYPE_TYPE_MODULE);
|
||||
|
||||
static gboolean
|
||||
meta_module_load (GTypeModule *gmodule)
|
||||
{
|
||||
MetaModulePrivate *priv = META_MODULE (gmodule)->priv;
|
||||
MetaPluginVersion *info = NULL;
|
||||
GType (*register_type) (GTypeModule *) = NULL;
|
||||
MetaModulePrivate *priv = META_MODULE (gmodule)->priv;
|
||||
MetaPluginVersion *info = NULL;
|
||||
GType (*register_type) (GTypeModule *) = NULL;
|
||||
|
||||
if (priv->lib && priv->plugin_type)
|
||||
return TRUE;
|
||||
@ -67,13 +67,13 @@ meta_module_load (GTypeModule *gmodule)
|
||||
}
|
||||
|
||||
if (g_module_symbol (priv->lib, "meta_plugin_version",
|
||||
(gpointer *)(void *)&info) &&
|
||||
(gpointer *) (void *) &info) &&
|
||||
g_module_symbol (priv->lib, "meta_plugin_register_type",
|
||||
(gpointer *)(void *)®ister_type) &&
|
||||
(gpointer *) (void *) ®ister_type) &&
|
||||
info && register_type)
|
||||
{
|
||||
if (info->version_api != META_PLUGIN_API_VERSION)
|
||||
g_warning ("Plugin API mismatch for [%s]", priv->path);
|
||||
g_warning ("Plugin API mismatch for [%s]", priv->path);
|
||||
else
|
||||
{
|
||||
GType plugin_type;
|
||||
@ -86,7 +86,7 @@ meta_module_load (GTypeModule *gmodule)
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->plugin_type = plugin_type;
|
||||
priv->plugin_type = plugin_type;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
@ -168,25 +168,25 @@ meta_module_get_property (GObject *object,
|
||||
static void
|
||||
meta_module_class_init (MetaModuleClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GTypeModuleClass *gmodule_class = G_TYPE_MODULE_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = meta_module_finalize;
|
||||
gobject_class->dispose = meta_module_dispose;
|
||||
gobject_class->finalize = meta_module_finalize;
|
||||
gobject_class->dispose = meta_module_dispose;
|
||||
gobject_class->set_property = meta_module_set_property;
|
||||
gobject_class->get_property = meta_module_get_property;
|
||||
|
||||
gmodule_class->load = meta_module_load;
|
||||
gmodule_class->unload = meta_module_unload;
|
||||
gmodule_class->load = meta_module_load;
|
||||
gmodule_class->unload = meta_module_unload;
|
||||
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PATH,
|
||||
g_param_spec_string ("path",
|
||||
"Path",
|
||||
"Load path",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
PROP_PATH,
|
||||
g_param_spec_string ("path",
|
||||
"Path",
|
||||
"Load path",
|
||||
NULL,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -202,4 +202,3 @@ meta_module_get_plugin_type (MetaModule *module)
|
||||
|
||||
return priv->plugin_type;
|
||||
}
|
||||
|
||||
|
@ -57,11 +57,11 @@ meta_plugin_manager_set_plugin_type (GType gtype)
|
||||
* Loads the given plugin.
|
||||
*/
|
||||
void
|
||||
meta_plugin_manager_load (const gchar *plugin_name)
|
||||
meta_plugin_manager_load (const gchar *plugin_name)
|
||||
{
|
||||
const gchar *dpath = MUTTER_PLUGIN_DIR "/";
|
||||
gchar *path;
|
||||
MetaModule *module;
|
||||
gchar *path;
|
||||
MetaModule *module;
|
||||
|
||||
if (g_path_is_absolute (plugin_name))
|
||||
path = g_strdup (plugin_name);
|
||||
@ -76,7 +76,7 @@ meta_plugin_manager_load (const gchar *plugin_name)
|
||||
* our untimely exit.
|
||||
*/
|
||||
g_printerr ("Unable to load plugin module [%s]: %s",
|
||||
path, g_module_error());
|
||||
path, g_module_error ());
|
||||
exit (1);
|
||||
}
|
||||
|
||||
@ -123,8 +123,8 @@ static void
|
||||
meta_plugin_manager_kill_window_effects (MetaPluginManager *plugin_mgr,
|
||||
MetaWindowActor *actor)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
|
||||
if (klass->kill_window_effects)
|
||||
klass->kill_window_effects (plugin, actor);
|
||||
@ -133,8 +133,8 @@ meta_plugin_manager_kill_window_effects (MetaPluginManager *plugin_mgr,
|
||||
static void
|
||||
meta_plugin_manager_kill_switch_workspace (MetaPluginManager *plugin_mgr)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
|
||||
if (klass->kill_switch_workspace)
|
||||
klass->kill_switch_workspace (plugin);
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -247,10 +248,10 @@ meta_plugin_manager_event_size_change (MetaPluginManager *plugin_mgr,
|
||||
* appropriate post-effect cleanup is carried out.
|
||||
*/
|
||||
gboolean
|
||||
meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr,
|
||||
gint from,
|
||||
gint to,
|
||||
MetaMotionDirection direction)
|
||||
meta_plugin_manager_switch_workspace (MetaPluginManager *plugin_mgr,
|
||||
gint from,
|
||||
gint to,
|
||||
MetaMotionDirection direction)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
@ -346,11 +347,11 @@ meta_plugin_manager_hide_tile_preview (MetaPluginManager *plugin_mgr)
|
||||
}
|
||||
|
||||
void
|
||||
meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y)
|
||||
meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
int x,
|
||||
int y)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
@ -364,10 +365,10 @@ meta_plugin_manager_show_window_menu (MetaPluginManager *plugin_mgr,
|
||||
}
|
||||
|
||||
void
|
||||
meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
MetaRectangle *rect)
|
||||
meta_plugin_manager_show_window_menu_for_rect (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window,
|
||||
MetaWindowMenuType menu,
|
||||
MetaRectangle *rect)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
@ -394,8 +395,9 @@ meta_plugin_manager_create_close_dialog (MetaPluginManager *plugin_mgr,
|
||||
}
|
||||
|
||||
MetaInhibitShortcutsDialog *
|
||||
meta_plugin_manager_create_inhibit_shortcuts_dialog (MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window)
|
||||
meta_plugin_manager_create_inhibit_shortcuts_dialog (
|
||||
MetaPluginManager *plugin_mgr,
|
||||
MetaWindow *window)
|
||||
{
|
||||
MetaPlugin *plugin = plugin_mgr->plugin;
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
|
@ -51,7 +51,7 @@ struct _MetaPluginPrivate
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (MetaPlugin, meta_plugin, G_TYPE_OBJECT);
|
||||
|
||||
#define META_PLUGIN_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate))
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), META_TYPE_PLUGIN, MetaPluginPrivate))
|
||||
|
||||
static void
|
||||
meta_plugin_class_init (MetaPluginClass *klass)
|
||||
@ -67,7 +67,7 @@ meta_plugin_init (MetaPlugin *self)
|
||||
const MetaPluginInfo *
|
||||
meta_plugin_get_info (MetaPlugin *plugin)
|
||||
{
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
MetaPluginClass *klass = META_PLUGIN_GET_CLASS (plugin);
|
||||
|
||||
if (klass && klass->plugin_info)
|
||||
return klass->plugin_info (plugin);
|
||||
@ -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
|
||||
@ -160,9 +161,9 @@ meta_plugin_destroy_completed (MetaPlugin *plugin,
|
||||
* mouse and made the plugin modal.
|
||||
*/
|
||||
gboolean
|
||||
meta_plugin_begin_modal (MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
meta_plugin_begin_modal (MetaPlugin *plugin,
|
||||
MetaModalOptions options,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaPluginPrivate *priv = META_PLUGIN (plugin)->priv;
|
||||
|
||||
|
@ -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"
|
||||
@ -52,7 +53,7 @@
|
||||
* - We approximate the 1D gaussian blur as 3 successive box filters.
|
||||
*/
|
||||
|
||||
typedef struct _MetaShadowCacheKey MetaShadowCacheKey;
|
||||
typedef struct _MetaShadowCacheKey MetaShadowCacheKey;
|
||||
typedef struct _MetaShadowClassInfo MetaShadowClassInfo;
|
||||
|
||||
struct _MetaShadowCacheKey
|
||||
@ -122,18 +123,19 @@ 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[] = {
|
||||
{ "normal", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
|
||||
{ "dialog", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
|
||||
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 } },
|
||||
{ "utility", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
|
||||
{ "border", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
|
||||
{ "menu", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
|
||||
{ "utility", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
|
||||
{ "border", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
|
||||
{ "menu", { 10, -1, 0, 3, 128 }, { 8, -1, 0, 2, 64 } },
|
||||
|
||||
{ "popup-menu", { 1, -1, 0, 0, 128 }, { 1, -1, 0, 0, 128 } },
|
||||
{ "popup-menu", { 1, -1, 0, 0, 128 }, { 1, -1, 0, 0, 128 } },
|
||||
{ "dropdown-menu", { 1, -1, 0, 0, 128 }, { 1, -1, 0, 0, 128 } },
|
||||
|
||||
{ "attached", { 0, -1, 0, 0, 0 }, { 0, -1, 0, 0, 0 } }
|
||||
{ "attached", { 0, -1, 0, 0, 0 }, { 0, -1, 0, 0, 0 } }
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (MetaShadowFactory, meta_shadow_factory, G_TYPE_OBJECT);
|
||||
@ -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,14 +400,16 @@ 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
|
||||
meta_shadow_class_info_free (MetaShadowClassInfo *class_info)
|
||||
{
|
||||
g_free ((char *)class_info->name);
|
||||
g_free ((char *) class_info->name);
|
||||
g_slice_free (MetaShadowClassInfo, class_info);
|
||||
}
|
||||
|
||||
@ -397,7 +424,7 @@ meta_shadow_factory_init (MetaShadowFactory *factory)
|
||||
factory->shadow_classes = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
NULL,
|
||||
(GDestroyNotify)meta_shadow_class_info_free);
|
||||
(GDestroyNotify) meta_shadow_class_info_free);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (default_shadow_classes); i++)
|
||||
{
|
||||
@ -407,7 +434,7 @@ meta_shadow_factory_init (MetaShadowFactory *factory)
|
||||
class_info->name = g_strdup (class_info->name);
|
||||
|
||||
g_hash_table_insert (factory->shadow_classes,
|
||||
(char *)class_info->name, class_info);
|
||||
(char *) class_info->name, class_info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -487,7 +514,7 @@ meta_shadow_factory_get_default (void)
|
||||
static int
|
||||
get_box_filter_size (int radius)
|
||||
{
|
||||
return (int)(0.5 + radius * (0.75 * sqrt(2*M_PI)));
|
||||
return (int) (0.5 + radius * (0.75 * sqrt (2 * M_PI)));
|
||||
}
|
||||
|
||||
/* The "spread" of the filter is the number of pixels from an original
|
||||
@ -566,13 +593,13 @@ blur_xspan (guchar *row,
|
||||
}
|
||||
|
||||
static void
|
||||
blur_rows (cairo_region_t *convolve_region,
|
||||
int x_offset,
|
||||
int y_offset,
|
||||
guchar *buffer,
|
||||
int buffer_width,
|
||||
int buffer_height,
|
||||
int d)
|
||||
blur_rows (cairo_region_t *convolve_region,
|
||||
int x_offset,
|
||||
int y_offset,
|
||||
guchar *buffer,
|
||||
int buffer_width,
|
||||
int buffer_height,
|
||||
int d)
|
||||
{
|
||||
int i, j;
|
||||
int n_rectangles;
|
||||
@ -650,8 +677,8 @@ flip_buffer (guchar *buffer,
|
||||
for (j0 = 0; j0 < height; j0 += BLOCK_SIZE)
|
||||
for (i0 = 0; i0 <= j0; i0 += BLOCK_SIZE)
|
||||
{
|
||||
int max_j = MIN(j0 + BLOCK_SIZE, height);
|
||||
int max_i = MIN(i0 + BLOCK_SIZE, width);
|
||||
int max_j = MIN (j0 + BLOCK_SIZE, height);
|
||||
int max_i = MIN (i0 + BLOCK_SIZE, width);
|
||||
int i, j;
|
||||
|
||||
if (i0 == j0)
|
||||
@ -686,8 +713,8 @@ flip_buffer (guchar *buffer,
|
||||
for (i0 = 0; i0 < width; i0 += BLOCK_SIZE)
|
||||
for (j0 = 0; j0 < height; j0 += BLOCK_SIZE)
|
||||
{
|
||||
int max_j = MIN(j0 + BLOCK_SIZE, height);
|
||||
int max_i = MIN(i0 + BLOCK_SIZE, width);
|
||||
int max_j = MIN (j0 + BLOCK_SIZE, height);
|
||||
int max_i = MIN (i0 + BLOCK_SIZE, width);
|
||||
int i, j;
|
||||
|
||||
for (i = i0; i < max_i; i++)
|
||||
@ -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,8 +877,9 @@ get_shadow_params (MetaShadowFactory *factory,
|
||||
gboolean focused,
|
||||
gboolean create)
|
||||
{
|
||||
MetaShadowClassInfo *class_info = g_hash_table_lookup (factory->shadow_classes,
|
||||
class_name);
|
||||
MetaShadowClassInfo *class_info = g_hash_table_lookup (
|
||||
factory->shadow_classes,
|
||||
class_name);
|
||||
if (class_info == NULL)
|
||||
{
|
||||
if (create)
|
||||
@ -838,7 +889,7 @@ get_shadow_params (MetaShadowFactory *factory,
|
||||
class_info->name = g_strdup (class_info->name);
|
||||
|
||||
g_hash_table_insert (factory->shadow_classes,
|
||||
(char *)class_info->name, class_info);
|
||||
(char *) class_info->name, class_info);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -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
|
||||
|
@ -52,9 +52,9 @@
|
||||
*/
|
||||
#define MIN_FAST_UPDATES_BEFORE_UNMIPMAP 20
|
||||
|
||||
static void meta_shaped_texture_dispose (GObject *object);
|
||||
static void meta_shaped_texture_dispose (GObject *object);
|
||||
|
||||
static void meta_shaped_texture_paint (ClutterActor *actor);
|
||||
static void meta_shaped_texture_paint (ClutterActor *actor);
|
||||
|
||||
static void meta_shaped_texture_get_preferred_width (ClutterActor *self,
|
||||
gfloat for_height,
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -724,7 +731,7 @@ effective_unobscured_region (MetaShapedTexture *self)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_shaped_texture_get_paint_volume (ClutterActor *actor,
|
||||
meta_shaped_texture_get_paint_volume (ClutterActor *actor,
|
||||
ClutterPaintVolume *volume)
|
||||
{
|
||||
return clutter_paint_volume_set_from_allocation (volume, actor);
|
||||
@ -732,7 +739,7 @@ meta_shaped_texture_get_paint_volume (ClutterActor *actor,
|
||||
|
||||
void
|
||||
meta_shaped_texture_set_create_mipmaps (MetaShapedTexture *stex,
|
||||
gboolean create_mipmaps)
|
||||
gboolean create_mipmaps)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv;
|
||||
|
||||
@ -798,10 +805,10 @@ meta_shaped_texture_is_obscured (MetaShapedTexture *self)
|
||||
*/
|
||||
gboolean
|
||||
meta_shaped_texture_update_area (MetaShapedTexture *stex,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height)
|
||||
{
|
||||
MetaShapedTexturePrivate *priv;
|
||||
cairo_region_t *unobscured_region;
|
||||
@ -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),
|
||||
|
@ -91,9 +91,10 @@ meta_surface_actor_wayland_is_unredirected (MetaSurfaceActor *actor)
|
||||
|
||||
void
|
||||
meta_surface_actor_wayland_add_frame_callbacks (MetaSurfaceActorWayland *self,
|
||||
struct wl_list *frame_callbacks)
|
||||
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);
|
||||
}
|
||||
@ -128,7 +129,7 @@ meta_surface_actor_wayland_get_preferred_width (ClutterActor *actor,
|
||||
natural_width_p);
|
||||
|
||||
if (min_width_p)
|
||||
*min_width_p *= scale;
|
||||
*min_width_p *= scale;
|
||||
|
||||
if (natural_width_p)
|
||||
*natural_width_p *= scale;
|
||||
@ -152,7 +153,7 @@ meta_surface_actor_wayland_get_preferred_height (ClutterActor *actor,
|
||||
natural_height_p);
|
||||
|
||||
if (min_height_p)
|
||||
*min_height_p *= scale;
|
||||
*min_height_p *= scale;
|
||||
|
||||
if (natural_height_p)
|
||||
*natural_height_p *= scale;
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -195,7 +197,7 @@ meta_surface_actor_wayland_dispose (GObject *object)
|
||||
}
|
||||
|
||||
wl_list_for_each_safe (cb, next, &priv->frame_callback_list, link)
|
||||
wl_resource_destroy (cb->resource);
|
||||
wl_resource_destroy (cb->resource);
|
||||
|
||||
G_OBJECT_CLASS (meta_surface_actor_wayland_parent_class)->dispose (object);
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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++)
|
||||
|
@ -104,23 +104,23 @@ static MetaSyncRing meta_sync_ring = { 0 };
|
||||
static XSyncValue SYNC_VALUE_ZERO;
|
||||
static XSyncValue SYNC_VALUE_ONE;
|
||||
|
||||
static const char* (*meta_gl_get_string) (GLenum name);
|
||||
static void (*meta_gl_get_integerv) (GLenum pname,
|
||||
GLint *params);
|
||||
static const char* (*meta_gl_get_stringi) (GLenum name,
|
||||
GLuint index);
|
||||
static void (*meta_gl_delete_sync) (GLsync sync);
|
||||
static GLenum (*meta_gl_client_wait_sync) (GLsync sync,
|
||||
GLbitfield flags,
|
||||
GLuint64 timeout);
|
||||
static void (*meta_gl_wait_sync) (GLsync sync,
|
||||
GLbitfield flags,
|
||||
GLuint64 timeout);
|
||||
static GLsync (*meta_gl_import_sync) (GLenum external_sync_type,
|
||||
GLintptr external_sync,
|
||||
GLbitfield flags);
|
||||
static GLsync (*meta_gl_fence_sync) (GLenum condition,
|
||||
GLbitfield flags);
|
||||
static const char * (*meta_gl_get_string) (GLenum name);
|
||||
static void (*meta_gl_get_integerv) (GLenum pname,
|
||||
GLint *params);
|
||||
static const char * (*meta_gl_get_stringi) (GLenum name,
|
||||
GLuint index);
|
||||
static void (*meta_gl_delete_sync) (GLsync sync);
|
||||
static GLenum (*meta_gl_client_wait_sync) (GLsync sync,
|
||||
GLbitfield flags,
|
||||
GLuint64 timeout);
|
||||
static void (*meta_gl_wait_sync) (GLsync sync,
|
||||
GLbitfield flags,
|
||||
GLuint64 timeout);
|
||||
static GLsync (*meta_gl_import_sync) (GLenum external_sync_type,
|
||||
GLintptr external_sync,
|
||||
GLbitfield flags);
|
||||
static GLsync (*meta_gl_fence_sync) (GLenum condition,
|
||||
GLbitfield flags);
|
||||
|
||||
static MetaSyncRing *
|
||||
meta_sync_ring_get (void)
|
||||
@ -132,13 +132,14 @@ meta_sync_ring_get (void)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
load_gl_symbol (const char *name,
|
||||
void **func)
|
||||
load_gl_symbol (const char *name,
|
||||
void **func)
|
||||
{
|
||||
*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;
|
||||
@ -160,32 +161,32 @@ check_gl_extensions (void)
|
||||
switch (cogl_renderer_get_driver (cogl_renderer))
|
||||
{
|
||||
case COGL_DRIVER_GL3:
|
||||
{
|
||||
int num_extensions, i;
|
||||
gboolean arb_sync = FALSE;
|
||||
gboolean x11_sync_object = FALSE;
|
||||
{
|
||||
int num_extensions, i;
|
||||
gboolean arb_sync = FALSE;
|
||||
gboolean x11_sync_object = FALSE;
|
||||
|
||||
meta_gl_get_integerv (GL_NUM_EXTENSIONS, &num_extensions);
|
||||
meta_gl_get_integerv (GL_NUM_EXTENSIONS, &num_extensions);
|
||||
|
||||
for (i = 0; i < num_extensions; ++i)
|
||||
{
|
||||
const char *ext = meta_gl_get_stringi (GL_EXTENSIONS, i);
|
||||
for (i = 0; i < num_extensions; ++i)
|
||||
{
|
||||
const char *ext = meta_gl_get_stringi (GL_EXTENSIONS, i);
|
||||
|
||||
if (g_strcmp0 ("GL_ARB_sync", ext) == 0)
|
||||
arb_sync = TRUE;
|
||||
else if (g_strcmp0 ("GL_EXT_x11_sync_object", ext) == 0)
|
||||
x11_sync_object = TRUE;
|
||||
}
|
||||
if (g_strcmp0 ("GL_ARB_sync", ext) == 0)
|
||||
arb_sync = TRUE;
|
||||
else if (g_strcmp0 ("GL_EXT_x11_sync_object", ext) == 0)
|
||||
x11_sync_object = TRUE;
|
||||
}
|
||||
|
||||
return arb_sync && x11_sync_object;
|
||||
}
|
||||
return arb_sync && x11_sync_object;
|
||||
}
|
||||
case COGL_DRIVER_GL:
|
||||
{
|
||||
const char *extensions = meta_gl_get_string (GL_EXTENSIONS);
|
||||
return (extensions != NULL &&
|
||||
strstr (extensions, "GL_ARB_sync") != NULL &&
|
||||
strstr (extensions, "GL_EXT_x11_sync_object") != NULL);
|
||||
}
|
||||
{
|
||||
const char *extensions = meta_gl_get_string (GL_EXTENSIONS);
|
||||
return (extensions != NULL &&
|
||||
strstr (extensions, "GL_ARB_sync") != NULL &&
|
||||
strstr (extensions, "GL_EXT_x11_sync_object") != NULL);
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -231,7 +232,7 @@ load_required_symbols (void)
|
||||
goto out;
|
||||
|
||||
success = TRUE;
|
||||
out:
|
||||
out:
|
||||
return success;
|
||||
}
|
||||
|
||||
@ -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,13 +353,14 @@ 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
|
||||
alarm_event_predicate (Display *dpy,
|
||||
XEvent *event,
|
||||
XPointer data)
|
||||
alarm_event_predicate (Display *dpy,
|
||||
XEvent *event,
|
||||
XPointer data)
|
||||
{
|
||||
MetaSyncRing *ring = meta_sync_ring_get ();
|
||||
|
||||
@ -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;
|
||||
@ -389,12 +393,12 @@ meta_sync_free (MetaSync *self)
|
||||
/* nothing to do */
|
||||
break;
|
||||
case META_SYNC_STATE_RESET_PENDING:
|
||||
{
|
||||
XEvent event;
|
||||
XIfEvent (self->xdisplay, &event, alarm_event_predicate, (XPointer) self);
|
||||
meta_sync_handle_event (self, (XSyncAlarmNotifyEvent *) &event);
|
||||
}
|
||||
/* fall through */
|
||||
{
|
||||
XEvent event;
|
||||
XIfEvent (self->xdisplay, &event, alarm_event_predicate, (XPointer) self);
|
||||
meta_sync_handle_event (self, (XSyncAlarmNotifyEvent *) &event);
|
||||
}
|
||||
/* fall through */
|
||||
case META_SYNC_STATE_READY:
|
||||
XSyncTriggerFence (self->xdisplay, self->xfence);
|
||||
XFlush (self->xdisplay);
|
||||
@ -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;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ static void
|
||||
texture_rectangle_check_cb (CoglTexture *sub_texture,
|
||||
const float *sub_texture_coords,
|
||||
const float *meta_coords,
|
||||
void *user_data)
|
||||
void *user_data)
|
||||
{
|
||||
gboolean *result = user_data;
|
||||
|
||||
|
@ -154,8 +154,10 @@ 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 = MIN(tower->n_levels, MAX_TEXTURE_LEVELS);
|
||||
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,41 +292,42 @@ 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 */
|
||||
dxdu_ = 0.5 * viewport_width * (pm.xx - pm.wx * (xc/wc));
|
||||
dxdv_ = 0.5 * viewport_width * (pm.xy - pm.wy * (xc/wc));
|
||||
dydu_ = 0.5 * viewport_height * (pm.yx - pm.wx * (yc/wc));
|
||||
dydv_ = 0.5 * viewport_height * (pm.yy - pm.wy * (yc/wc));
|
||||
dxdu_ = 0.5 * viewport_width * (pm.xx - pm.wx * (xc / wc));
|
||||
dxdv_ = 0.5 * viewport_width * (pm.xy - pm.wy * (xc / wc));
|
||||
dydu_ = 0.5 * viewport_height * (pm.yx - pm.wx * (yc / wc));
|
||||
dydv_ = 0.5 * viewport_height * (pm.yy - pm.wy * (yc / wc));
|
||||
|
||||
/* det * wc^2 */
|
||||
det_ = dxdu_ * dydv_ - dxdv_ * dydu_;
|
||||
@ -337,13 +340,14 @@ 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.)
|
||||
return 0;
|
||||
else
|
||||
return (int)(0.5 + lambda);
|
||||
return (int) (0.5 + lambda);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -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);
|
||||
|
||||
@ -461,7 +469,7 @@ meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
|
||||
texture_width = cogl_texture_get_width (tower->textures[0]);
|
||||
texture_height = cogl_texture_get_height (tower->textures[0]);
|
||||
|
||||
level = get_paint_level(texture_width, texture_height);
|
||||
level = get_paint_level (texture_width, texture_height);
|
||||
if (level < 0) /* singular paint matrix, scaled to nothing */
|
||||
return NULL;
|
||||
level = MIN (level, tower->n_levels - 1);
|
||||
@ -473,22 +481,24 @@ meta_texture_tower_get_paint_texture (MetaTextureTower *tower)
|
||||
int i;
|
||||
|
||||
for (i = 1; i <= level; i++)
|
||||
{
|
||||
/* 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);
|
||||
{
|
||||
/* 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);
|
||||
}
|
||||
if (tower->textures[i] == NULL)
|
||||
texture_tower_create_texture (tower, i, texture_width,
|
||||
texture_height);
|
||||
}
|
||||
|
||||
for (i = 1; i <= level; i++)
|
||||
{
|
||||
if (tower->invalid[level].x2 != tower->invalid[level].x1 &&
|
||||
tower->invalid[level].y2 != tower->invalid[level].y1)
|
||||
texture_tower_revalidate (tower, i);
|
||||
}
|
||||
}
|
||||
{
|
||||
if (tower->invalid[level].x2 != tower->invalid[level].x1 &&
|
||||
tower->invalid[level].y2 != tower->invalid[level].y1)
|
||||
texture_tower_revalidate (tower, i);
|
||||
}
|
||||
}
|
||||
|
||||
return tower->textures[level];
|
||||
}
|
||||
|
@ -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
|
||||
@ -64,68 +66,70 @@ struct _MetaWindowActorPrivate
|
||||
* size-invariant window shape, we'll often find that the new shadow
|
||||
* is the same as the old shadow.
|
||||
*/
|
||||
MetaShadow *focused_shadow;
|
||||
MetaShadow *unfocused_shadow;
|
||||
MetaShadow *focused_shadow;
|
||||
MetaShadow *unfocused_shadow;
|
||||
|
||||
/* A region that matches the shape of the window, including frame bounds */
|
||||
cairo_region_t *shape_region;
|
||||
cairo_region_t *shape_region;
|
||||
/* The region we should clip to when painting the shadow */
|
||||
cairo_region_t *shadow_clip;
|
||||
cairo_region_t *shadow_clip;
|
||||
|
||||
/* Extracted size-invariant shape used for shadows */
|
||||
MetaWindowShape *shadow_shape;
|
||||
char * shadow_class;
|
||||
MetaWindowShape *shadow_shape;
|
||||
char *shadow_class;
|
||||
|
||||
MetaShadowMode shadow_mode;
|
||||
MetaShadowMode shadow_mode;
|
||||
|
||||
guint send_frame_messages_timer;
|
||||
gint64 frame_drawn_time;
|
||||
guint send_frame_messages_timer;
|
||||
gint64 frame_drawn_time;
|
||||
|
||||
guint repaint_scheduled_id;
|
||||
guint size_changed_id;
|
||||
guint repaint_scheduled_id;
|
||||
guint size_changed_id;
|
||||
|
||||
/*
|
||||
* These need to be counters rather than flags, since more plugins
|
||||
* can implement same effect; the practicality of stacking effects
|
||||
* might be dubious, but we have to at least handle it correctly.
|
||||
*/
|
||||
gint minimize_in_progress;
|
||||
gint unminimize_in_progress;
|
||||
gint size_change_in_progress;
|
||||
gint map_in_progress;
|
||||
gint destroy_in_progress;
|
||||
gint minimize_in_progress;
|
||||
gint unminimize_in_progress;
|
||||
gint size_change_in_progress;
|
||||
gint map_in_progress;
|
||||
gint destroy_in_progress;
|
||||
|
||||
/* List of FrameData for recent frames */
|
||||
GList *frames;
|
||||
guint freeze_count;
|
||||
GList *frames;
|
||||
guint freeze_count;
|
||||
|
||||
guint visible : 1;
|
||||
guint disposed : 1;
|
||||
guint visible : 1;
|
||||
guint disposed : 1;
|
||||
|
||||
/* If set, the client needs to be sent a _NET_WM_FRAME_DRAWN
|
||||
* client message for one or more messages in ->frames */
|
||||
guint needs_frame_drawn : 1;
|
||||
guint repaint_scheduled : 1;
|
||||
guint needs_frame_drawn : 1;
|
||||
guint repaint_scheduled : 1;
|
||||
|
||||
guint needs_reshape : 1;
|
||||
guint recompute_focused_shadow : 1;
|
||||
guint recompute_unfocused_shadow : 1;
|
||||
guint needs_reshape : 1;
|
||||
guint recompute_focused_shadow : 1;
|
||||
guint recompute_unfocused_shadow : 1;
|
||||
|
||||
guint needs_destroy : 1;
|
||||
guint needs_destroy : 1;
|
||||
|
||||
guint updates_frozen : 1;
|
||||
guint first_frame_state : 2; /* FirstFrameState */
|
||||
guint updates_frozen : 1;
|
||||
guint first_frame_state : 2; /* FirstFrameState */
|
||||
};
|
||||
|
||||
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.
|
||||
@ -154,17 +158,17 @@ enum
|
||||
PROP_SHADOW_CLASS
|
||||
};
|
||||
|
||||
static void meta_window_actor_dispose (GObject *object);
|
||||
static void meta_window_actor_finalize (GObject *object);
|
||||
static void meta_window_actor_dispose (GObject *object);
|
||||
static void meta_window_actor_finalize (GObject *object);
|
||||
static void meta_window_actor_constructed (GObject *object);
|
||||
static void meta_window_actor_set_property (GObject *object,
|
||||
static void meta_window_actor_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void meta_window_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void meta_window_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
static void meta_window_actor_paint (ClutterActor *actor);
|
||||
|
||||
@ -179,8 +183,8 @@ static void meta_window_actor_handle_updates (MetaWindowActor *self);
|
||||
static void check_needs_reshape (MetaWindowActor *self);
|
||||
|
||||
static void do_send_frame_drawn (MetaWindowActor *self, FrameData *frame);
|
||||
static void do_send_frame_timings (MetaWindowActor *self,
|
||||
FrameData *frame,
|
||||
static void do_send_frame_timings (MetaWindowActor *self,
|
||||
FrameData *frame,
|
||||
gint refresh_interval,
|
||||
gint64 presentation_time);
|
||||
|
||||
@ -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)
|
||||
@ -201,13 +206,13 @@ meta_window_actor_class_init (MetaWindowActorClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
GParamSpec *pspec;
|
||||
|
||||
object_class->dispose = meta_window_actor_dispose;
|
||||
object_class->finalize = meta_window_actor_finalize;
|
||||
object_class->dispose = meta_window_actor_dispose;
|
||||
object_class->finalize = meta_window_actor_finalize;
|
||||
object_class->set_property = meta_window_actor_set_property;
|
||||
object_class->get_property = meta_window_actor_get_property;
|
||||
object_class->constructed = meta_window_actor_constructed;
|
||||
object_class->constructed = meta_window_actor_constructed;
|
||||
|
||||
actor_class->paint = meta_window_actor_paint;
|
||||
actor_class->get_paint_volume = meta_window_actor_get_paint_volume;
|
||||
@ -290,8 +295,8 @@ meta_window_actor_init (MetaWindowActor *self)
|
||||
MetaWindowActorPrivate *priv;
|
||||
|
||||
priv = self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
|
||||
META_TYPE_WINDOW_ACTOR,
|
||||
MetaWindowActorPrivate);
|
||||
META_TYPE_WINDOW_ACTOR,
|
||||
MetaWindowActorPrivate);
|
||||
priv->shadow_class = NULL;
|
||||
}
|
||||
|
||||
@ -328,9 +333,9 @@ 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);
|
||||
else
|
||||
@ -362,7 +367,7 @@ meta_window_actor_freeze (MetaWindowActor *self)
|
||||
if (priv->freeze_count == 0 && priv->surface)
|
||||
meta_surface_actor_set_frozen (priv->surface, TRUE);
|
||||
|
||||
priv->freeze_count ++;
|
||||
priv->freeze_count++;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -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);
|
||||
|
||||
@ -514,7 +526,7 @@ meta_window_actor_dispose (GObject *object)
|
||||
static void
|
||||
meta_window_actor_finalize (GObject *object)
|
||||
{
|
||||
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
||||
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
|
||||
g_list_free_full (priv->frames, (GDestroyNotify) frame_data_free);
|
||||
@ -528,7 +540,7 @@ meta_window_actor_set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
||||
MetaWindowActor *self = META_WINDOW_ACTOR (object);
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
|
||||
switch (prop_id)
|
||||
@ -536,33 +548,34 @@ 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:
|
||||
{
|
||||
MetaShadowMode newv = g_value_get_enum (value);
|
||||
{
|
||||
MetaShadowMode newv = g_value_get_enum (value);
|
||||
|
||||
if (newv == priv->shadow_mode)
|
||||
return;
|
||||
if (newv == priv->shadow_mode)
|
||||
return;
|
||||
|
||||
priv->shadow_mode = newv;
|
||||
priv->shadow_mode = newv;
|
||||
|
||||
meta_window_actor_invalidate_shadow (self);
|
||||
}
|
||||
break;
|
||||
meta_window_actor_invalidate_shadow (self);
|
||||
}
|
||||
break;
|
||||
case PROP_SHADOW_CLASS:
|
||||
{
|
||||
const char *newv = g_value_get_string (value);
|
||||
{
|
||||
const char *newv = g_value_get_string (value);
|
||||
|
||||
if (g_strcmp0 (newv, priv->shadow_class) == 0)
|
||||
return;
|
||||
if (g_strcmp0 (newv, priv->shadow_class) == 0)
|
||||
return;
|
||||
|
||||
g_free (priv->shadow_class);
|
||||
priv->shadow_class = g_strdup (newv);
|
||||
g_free (priv->shadow_class);
|
||||
priv->shadow_class = g_strdup (newv);
|
||||
|
||||
meta_window_actor_invalidate_shadow (self);
|
||||
}
|
||||
break;
|
||||
meta_window_actor_invalidate_shadow (self);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -570,10 +583,10 @@ meta_window_actor_set_property (GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_window_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
meta_window_actor_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = META_WINDOW_ACTOR (object)->priv;
|
||||
|
||||
@ -613,10 +626,10 @@ meta_window_actor_get_shadow_class (MetaWindowActor *self)
|
||||
case META_WINDOW_POPUP_MENU:
|
||||
return "popup-menu";
|
||||
default:
|
||||
{
|
||||
MetaFrameType frame_type = meta_window_get_frame_type (priv->window);
|
||||
return meta_frame_type_to_string (frame_type);
|
||||
}
|
||||
{
|
||||
MetaFrameType frame_type = meta_window_get_frame_type (priv->window);
|
||||
return meta_frame_type_to_string (frame_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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,12 +726,13 @@ 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
|
||||
* the window now (for some other reason) cancel the timer
|
||||
* and send the completion events normally */
|
||||
/* This window got damage when obscured; we set up a timer
|
||||
* to send frame completion events, but since we're drawing
|
||||
* the window now (for some other reason) cancel the timer
|
||||
* and send the completion events normally */
|
||||
if (priv->send_frame_messages_timer != 0)
|
||||
{
|
||||
g_source_remove (priv->send_frame_messages_timer);
|
||||
@ -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;
|
||||
|
||||
@ -989,15 +1011,21 @@ queue_send_frame_messages_timeout (MetaWindowActor *self)
|
||||
current_time =
|
||||
meta_compositor_monotonic_time_to_server_time (display,
|
||||
g_get_monotonic_time ());
|
||||
interval = (int)(1000000 / refresh_rate) * 6;
|
||||
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
|
||||
* 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");
|
||||
/* 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");
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1062,28 +1091,28 @@ gboolean
|
||||
meta_window_actor_effect_in_progress (MetaWindowActor *self)
|
||||
{
|
||||
return (self->priv->minimize_in_progress ||
|
||||
self->priv->size_change_in_progress ||
|
||||
self->priv->map_in_progress ||
|
||||
self->priv->destroy_in_progress);
|
||||
self->priv->size_change_in_progress ||
|
||||
self->priv->map_in_progress ||
|
||||
self->priv->destroy_in_progress);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
is_freeze_thaw_effect (MetaPluginEffect event)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
case META_PLUGIN_DESTROY:
|
||||
case META_PLUGIN_SIZE_CHANGE:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
{
|
||||
case META_PLUGIN_DESTROY:
|
||||
case META_PLUGIN_SIZE_CHANGE:
|
||||
return TRUE;
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
start_simple_effect (MetaWindowActor *self,
|
||||
MetaPluginEffect event)
|
||||
start_simple_effect (MetaWindowActor *self,
|
||||
MetaPluginEffect event)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
@ -1093,26 +1122,26 @@ start_simple_effect (MetaWindowActor *self,
|
||||
g_assert (compositor->plugin_mgr != NULL);
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case META_PLUGIN_NONE:
|
||||
return FALSE;
|
||||
case META_PLUGIN_MINIMIZE:
|
||||
counter = &priv->minimize_in_progress;
|
||||
break;
|
||||
case META_PLUGIN_UNMINIMIZE:
|
||||
counter = &priv->unminimize_in_progress;
|
||||
break;
|
||||
case META_PLUGIN_MAP:
|
||||
counter = &priv->map_in_progress;
|
||||
break;
|
||||
case META_PLUGIN_DESTROY:
|
||||
counter = &priv->destroy_in_progress;
|
||||
break;
|
||||
case META_PLUGIN_SIZE_CHANGE:
|
||||
case META_PLUGIN_SWITCH_WORKSPACE:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
{
|
||||
case META_PLUGIN_NONE:
|
||||
return FALSE;
|
||||
case META_PLUGIN_MINIMIZE:
|
||||
counter = &priv->minimize_in_progress;
|
||||
break;
|
||||
case META_PLUGIN_UNMINIMIZE:
|
||||
counter = &priv->unminimize_in_progress;
|
||||
break;
|
||||
case META_PLUGIN_MAP:
|
||||
counter = &priv->map_in_progress;
|
||||
break;
|
||||
case META_PLUGIN_DESTROY:
|
||||
counter = &priv->destroy_in_progress;
|
||||
break;
|
||||
case META_PLUGIN_SIZE_CHANGE:
|
||||
case META_PLUGIN_SWITCH_WORKSPACE:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
g_assert (counter);
|
||||
|
||||
@ -1151,10 +1180,10 @@ meta_window_actor_after_effects (MetaWindowActor *self)
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_actor_effect_completed (MetaWindowActor *self,
|
||||
MetaPluginEffect event)
|
||||
meta_window_actor_effect_completed (MetaWindowActor *self,
|
||||
MetaPluginEffect event)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
gboolean inconsistent = FALSE;
|
||||
|
||||
/* NB: Keep in mind that when effects get completed it possible
|
||||
@ -1162,68 +1191,68 @@ meta_window_actor_effect_completed (MetaWindowActor *self,
|
||||
* In this case priv->window will == NULL */
|
||||
|
||||
switch (event)
|
||||
{
|
||||
case META_PLUGIN_NONE:
|
||||
break;
|
||||
case META_PLUGIN_MINIMIZE:
|
||||
{
|
||||
case META_PLUGIN_NONE:
|
||||
break;
|
||||
case META_PLUGIN_MINIMIZE:
|
||||
{
|
||||
priv->minimize_in_progress--;
|
||||
if (priv->minimize_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in minimize accounting.");
|
||||
priv->minimize_in_progress = 0;
|
||||
{
|
||||
g_warning ("Error in minimize accounting.");
|
||||
priv->minimize_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case META_PLUGIN_UNMINIMIZE:
|
||||
case META_PLUGIN_UNMINIMIZE:
|
||||
{
|
||||
priv->unminimize_in_progress--;
|
||||
if (priv->unminimize_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in unminimize accounting.");
|
||||
priv->unminimize_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
{
|
||||
g_warning ("Error in unminimize accounting.");
|
||||
priv->unminimize_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case META_PLUGIN_MAP:
|
||||
/*
|
||||
* Make sure that the actor is at the correct place in case
|
||||
* the plugin fscked.
|
||||
*/
|
||||
priv->map_in_progress--;
|
||||
case META_PLUGIN_MAP:
|
||||
/*
|
||||
* Make sure that the actor is at the correct place in case
|
||||
* the plugin fscked.
|
||||
*/
|
||||
priv->map_in_progress--;
|
||||
|
||||
if (priv->map_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in map accounting.");
|
||||
priv->map_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
break;
|
||||
case META_PLUGIN_DESTROY:
|
||||
priv->destroy_in_progress--;
|
||||
if (priv->map_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in map accounting.");
|
||||
priv->map_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
break;
|
||||
case META_PLUGIN_DESTROY:
|
||||
priv->destroy_in_progress--;
|
||||
|
||||
if (priv->destroy_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in destroy accounting.");
|
||||
priv->destroy_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
break;
|
||||
case META_PLUGIN_SIZE_CHANGE:
|
||||
priv->size_change_in_progress--;
|
||||
if (priv->size_change_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in size change accounting.");
|
||||
priv->size_change_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
break;
|
||||
case META_PLUGIN_SWITCH_WORKSPACE:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
if (priv->destroy_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in destroy accounting.");
|
||||
priv->destroy_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
break;
|
||||
case META_PLUGIN_SIZE_CHANGE:
|
||||
priv->size_change_in_progress--;
|
||||
if (priv->size_change_in_progress < 0)
|
||||
{
|
||||
g_warning ("Error in size change accounting.");
|
||||
priv->size_change_in_progress = 0;
|
||||
inconsistent = TRUE;
|
||||
}
|
||||
break;
|
||||
case META_PLUGIN_SWITCH_WORKSPACE:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
if (is_freeze_thaw_effect (event) && !inconsistent)
|
||||
meta_window_actor_thaw (self);
|
||||
@ -1248,7 +1277,7 @@ meta_window_actor_set_unredirected (MetaWindowActor *self,
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
|
||||
g_assert(priv->surface); /* because otherwise should_unredirect() is FALSE */
|
||||
g_assert (priv->surface); /* because otherwise should_unredirect() is FALSE */
|
||||
meta_surface_actor_set_unredirected (priv->surface, unredirected);
|
||||
}
|
||||
|
||||
@ -1323,8 +1352,8 @@ meta_window_actor_sync_actor_geometry (MetaWindowActor *self,
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_actor_show (MetaWindowActor *self,
|
||||
MetaCompEffect effect)
|
||||
meta_window_actor_show (MetaWindowActor *self,
|
||||
MetaCompEffect effect)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
@ -1346,7 +1375,7 @@ meta_window_actor_show (MetaWindowActor *self,
|
||||
event = META_PLUGIN_NONE;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
if (compositor->switch_workspace_in_progress ||
|
||||
@ -1387,7 +1416,7 @@ meta_window_actor_hide (MetaWindowActor *self,
|
||||
event = META_PLUGIN_NONE;
|
||||
break;
|
||||
default:
|
||||
g_assert_not_reached();
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
if (!start_simple_effect (self, event))
|
||||
@ -1395,10 +1424,10 @@ meta_window_actor_hide (MetaWindowActor *self,
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_actor_size_change (MetaWindowActor *self,
|
||||
MetaSizeChange which_change,
|
||||
MetaRectangle *old_frame_rect,
|
||||
MetaRectangle *old_buffer_rect)
|
||||
meta_window_actor_size_change (MetaWindowActor *self,
|
||||
MetaSizeChange which_change,
|
||||
MetaRectangle *old_frame_rect,
|
||||
MetaRectangle *old_buffer_rect)
|
||||
{
|
||||
MetaWindowActorPrivate *priv = self->priv;
|
||||
MetaCompositor *compositor = priv->compositor;
|
||||
@ -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);
|
||||
@ -1419,9 +1449,9 @@ meta_window_actor_new (MetaWindow *window)
|
||||
{
|
||||
MetaDisplay *display = meta_window_get_display (window);
|
||||
MetaCompositor *compositor = display->compositor;
|
||||
MetaWindowActor *self;
|
||||
MetaWindowActor *self;
|
||||
MetaWindowActorPrivate *priv;
|
||||
ClutterActor *window_group;
|
||||
ClutterActor *window_group;
|
||||
|
||||
self = g_object_new (META_TYPE_WINDOW_ACTOR,
|
||||
"meta-window", window,
|
||||
@ -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,
|
||||
COGL_PIXEL_FORMAT_A_8,
|
||||
stride, mask_data, &error));
|
||||
mask_texture =
|
||||
COGL_TEXTURE (cogl_texture_2d_new_from_data (ctx, tex_width, tex_height,
|
||||
COGL_PIXEL_FORMAT_A_8,
|
||||
stride,
|
||||
mask_data, &error));
|
||||
|
||||
if (error)
|
||||
{
|
||||
@ -1972,21 +2012,22 @@ do_send_frame_drawn (MetaWindowActor *self, FrameData *frame)
|
||||
|
||||
XClientMessageEvent ev = { 0, };
|
||||
|
||||
frame->frame_drawn_time = meta_compositor_monotonic_time_to_server_time (display,
|
||||
g_get_monotonic_time ());
|
||||
frame->frame_drawn_time = meta_compositor_monotonic_time_to_server_time (
|
||||
display,
|
||||
g_get_monotonic_time ());
|
||||
priv->frame_drawn_time = frame->frame_drawn_time;
|
||||
|
||||
ev.type = ClientMessage;
|
||||
ev.window = meta_window_get_xwindow (priv->window);
|
||||
ev.message_type = display->x11_display->atom__NET_WM_FRAME_DRAWN;
|
||||
ev.format = 32;
|
||||
ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT(0xffffffff);
|
||||
ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT (0xffffffff);
|
||||
ev.data.l[1] = frame->sync_request_serial >> 32;
|
||||
ev.data.l[2] = frame->frame_drawn_time & G_GUINT64_CONSTANT(0xffffffff);
|
||||
ev.data.l[2] = frame->frame_drawn_time & G_GUINT64_CONSTANT (0xffffffff);
|
||||
ev.data.l[3] = frame->frame_drawn_time >> 32;
|
||||
|
||||
meta_x11_error_trap_push (display->x11_display);
|
||||
XSendEvent (xdisplay, ev.window, False, 0, (XEvent*) &ev);
|
||||
XSendEvent (xdisplay, ev.window, False, 0, (XEvent *) &ev);
|
||||
XFlush (xdisplay);
|
||||
meta_x11_error_trap_pop (display->x11_display);
|
||||
}
|
||||
@ -2029,8 +2070,8 @@ meta_window_actor_post_paint (MetaWindowActor *self)
|
||||
}
|
||||
|
||||
static void
|
||||
do_send_frame_timings (MetaWindowActor *self,
|
||||
FrameData *frame,
|
||||
do_send_frame_timings (MetaWindowActor *self,
|
||||
FrameData *frame,
|
||||
gint refresh_interval,
|
||||
gint64 presentation_time)
|
||||
{
|
||||
@ -2044,18 +2085,20 @@ do_send_frame_timings (MetaWindowActor *self,
|
||||
ev.window = meta_window_get_xwindow (priv->window);
|
||||
ev.message_type = display->x11_display->atom__NET_WM_FRAME_TIMINGS;
|
||||
ev.format = 32;
|
||||
ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT(0xffffffff);
|
||||
ev.data.l[0] = frame->sync_request_serial & G_GUINT64_CONSTANT (0xffffffff);
|
||||
ev.data.l[1] = frame->sync_request_serial >> 32;
|
||||
|
||||
if (presentation_time != 0)
|
||||
{
|
||||
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_server =
|
||||
meta_compositor_monotonic_time_to_server_time (display,
|
||||
presentation_time);
|
||||
gint64 presentation_time_offset = presentation_time_server -
|
||||
frame->frame_drawn_time;
|
||||
if (presentation_time_offset == 0)
|
||||
presentation_time_offset = 1;
|
||||
|
||||
if ((gint32)presentation_time_offset == presentation_time_offset)
|
||||
if ((gint32) presentation_time_offset == presentation_time_offset)
|
||||
ev.data.l[2] = presentation_time_offset;
|
||||
}
|
||||
|
||||
@ -2063,7 +2106,7 @@ do_send_frame_timings (MetaWindowActor *self,
|
||||
ev.data.l[4] = 1000 * META_SYNC_DELAY;
|
||||
|
||||
meta_x11_error_trap_push (display->x11_display);
|
||||
XSendEvent (xdisplay, ev.window, False, 0, (XEvent*) &ev);
|
||||
XSendEvent (xdisplay, ev.window, False, 0, (XEvent *) &ev);
|
||||
XFlush (xdisplay);
|
||||
meta_x11_error_trap_pop (display->x11_display);
|
||||
}
|
||||
@ -2107,11 +2150,13 @@ 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",
|
||||
priv->window->desc);
|
||||
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,
|
||||
priv->window->desc, frame->frame_counter);
|
||||
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);
|
||||
send_frame_timings (self, frame, frame_info, presentation_time);
|
||||
@ -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 *
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -44,17 +44,26 @@
|
||||
#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;
|
||||
typedef struct _MetaDefaultPlugin MetaDefaultPlugin;
|
||||
typedef struct _MetaDefaultPluginClass MetaDefaultPluginClass;
|
||||
typedef struct _MetaDefaultPluginPrivate MetaDefaultPluginPrivate;
|
||||
|
||||
struct _MetaDefaultPlugin
|
||||
@ -72,32 +81,32 @@ struct _MetaDefaultPluginClass
|
||||
static GQuark actor_data_quark = 0;
|
||||
static GQuark display_tile_preview_data_quark = 0;
|
||||
|
||||
static void start (MetaPlugin *plugin);
|
||||
static void minimize (MetaPlugin *plugin,
|
||||
MetaWindowActor *actor);
|
||||
static void map (MetaPlugin *plugin,
|
||||
MetaWindowActor *actor);
|
||||
static void destroy (MetaPlugin *plugin,
|
||||
MetaWindowActor *actor);
|
||||
static void start (MetaPlugin *plugin);
|
||||
static void minimize (MetaPlugin *plugin,
|
||||
MetaWindowActor *actor);
|
||||
static void map (MetaPlugin *plugin,
|
||||
MetaWindowActor *actor);
|
||||
static void destroy (MetaPlugin *plugin,
|
||||
MetaWindowActor *actor);
|
||||
|
||||
static void switch_workspace (MetaPlugin *plugin,
|
||||
gint from,
|
||||
gint to,
|
||||
MetaMotionDirection direction);
|
||||
static void switch_workspace (MetaPlugin *plugin,
|
||||
gint from,
|
||||
gint to,
|
||||
MetaMotionDirection direction);
|
||||
|
||||
static void kill_window_effects (MetaPlugin *plugin,
|
||||
MetaWindowActor *actor);
|
||||
static void kill_switch_workspace (MetaPlugin *plugin);
|
||||
static void kill_window_effects (MetaPlugin *plugin,
|
||||
MetaWindowActor *actor);
|
||||
static void kill_switch_workspace (MetaPlugin *plugin);
|
||||
|
||||
static void show_tile_preview (MetaPlugin *plugin,
|
||||
MetaWindow *window,
|
||||
MetaRectangle *tile_rect,
|
||||
int tile_monitor_number);
|
||||
static void hide_tile_preview (MetaPlugin *plugin);
|
||||
static void show_tile_preview (MetaPlugin *plugin,
|
||||
MetaWindow *window,
|
||||
MetaRectangle *tile_rect,
|
||||
int tile_monitor_number);
|
||||
static void hide_tile_preview (MetaPlugin *plugin);
|
||||
|
||||
static void confirm_display_change (MetaPlugin *plugin);
|
||||
|
||||
static const MetaPluginInfo * plugin_info (MetaPlugin *plugin);
|
||||
static const MetaPluginInfo *plugin_info (MetaPlugin *plugin);
|
||||
|
||||
/*
|
||||
* Plugin private data that we store in the .plugin_private member.
|
||||
@ -105,14 +114,14 @@ static const MetaPluginInfo * plugin_info (MetaPlugin *plugin);
|
||||
struct _MetaDefaultPluginPrivate
|
||||
{
|
||||
/* Valid only when switch_workspace effect is in progress */
|
||||
ClutterTimeline *tml_switch_workspace1;
|
||||
ClutterTimeline *tml_switch_workspace2;
|
||||
ClutterActor *desktop1;
|
||||
ClutterActor *desktop2;
|
||||
ClutterTimeline *tml_switch_workspace1;
|
||||
ClutterTimeline *tml_switch_workspace2;
|
||||
ClutterActor *desktop1;
|
||||
ClutterActor *desktop2;
|
||||
|
||||
ClutterActor *background_group;
|
||||
ClutterActor *background_group;
|
||||
|
||||
MetaPluginInfo info;
|
||||
MetaPluginInfo info;
|
||||
};
|
||||
|
||||
META_PLUGIN_DECLARE_WITH_CODE (MetaDefaultPlugin, meta_default_plugin,
|
||||
@ -140,18 +149,18 @@ typedef struct
|
||||
|
||||
typedef struct _DisplayTilePreview
|
||||
{
|
||||
ClutterActor *actor;
|
||||
ClutterActor *actor;
|
||||
|
||||
GdkRGBA *preview_color;
|
||||
GdkRGBA *preview_color;
|
||||
|
||||
MetaRectangle tile_rect;
|
||||
MetaRectangle tile_rect;
|
||||
} DisplayTilePreview;
|
||||
|
||||
static void
|
||||
meta_default_plugin_dispose (GObject *object)
|
||||
{
|
||||
/* MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (object)->priv;
|
||||
*/
|
||||
*/
|
||||
G_OBJECT_CLASS (meta_default_plugin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@ -163,9 +172,9 @@ meta_default_plugin_finalize (GObject *object)
|
||||
|
||||
static void
|
||||
meta_default_plugin_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -177,9 +186,9 @@ meta_default_plugin_set_property (GObject *object,
|
||||
|
||||
static void
|
||||
meta_default_plugin_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -192,23 +201,23 @@ meta_default_plugin_get_property (GObject *object,
|
||||
static void
|
||||
meta_default_plugin_class_init (MetaDefaultPluginClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
MetaPluginClass *plugin_class = META_PLUGIN_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
MetaPluginClass *plugin_class = META_PLUGIN_CLASS (klass);
|
||||
|
||||
gobject_class->finalize = meta_default_plugin_finalize;
|
||||
gobject_class->dispose = meta_default_plugin_dispose;
|
||||
gobject_class->set_property = meta_default_plugin_set_property;
|
||||
gobject_class->get_property = meta_default_plugin_get_property;
|
||||
gobject_class->finalize = meta_default_plugin_finalize;
|
||||
gobject_class->dispose = meta_default_plugin_dispose;
|
||||
gobject_class->set_property = meta_default_plugin_set_property;
|
||||
gobject_class->get_property = meta_default_plugin_get_property;
|
||||
|
||||
plugin_class->start = start;
|
||||
plugin_class->map = map;
|
||||
plugin_class->minimize = minimize;
|
||||
plugin_class->destroy = destroy;
|
||||
plugin_class->start = start;
|
||||
plugin_class->map = map;
|
||||
plugin_class->minimize = minimize;
|
||||
plugin_class->destroy = destroy;
|
||||
plugin_class->switch_workspace = switch_workspace;
|
||||
plugin_class->show_tile_preview = show_tile_preview;
|
||||
plugin_class->hide_tile_preview = hide_tile_preview;
|
||||
plugin_class->plugin_info = plugin_info;
|
||||
plugin_class->kill_window_effects = kill_window_effects;
|
||||
plugin_class->plugin_info = plugin_info;
|
||||
plugin_class->kill_window_effects = kill_window_effects;
|
||||
plugin_class->kill_switch_workspace = kill_switch_workspace;
|
||||
plugin_class->confirm_display_change = confirm_display_change;
|
||||
}
|
||||
@ -220,10 +229,10 @@ meta_default_plugin_init (MetaDefaultPlugin *self)
|
||||
|
||||
self->priv = priv = META_DEFAULT_PLUGIN_GET_PRIVATE (self);
|
||||
|
||||
priv->info.name = "Default Effects";
|
||||
priv->info.version = "0.1";
|
||||
priv->info.author = "Intel Corp.";
|
||||
priv->info.license = "GPL";
|
||||
priv->info.name = "Default Effects";
|
||||
priv->info.version = "0.1";
|
||||
priv->info.author = "Intel Corp.";
|
||||
priv->info.license = "GPL";
|
||||
priv->info.description = "This is an example of a plugin implementation.";
|
||||
}
|
||||
|
||||
@ -258,10 +267,10 @@ get_actor_private (MetaWindowActor *actor)
|
||||
}
|
||||
|
||||
static ClutterTimeline *
|
||||
actor_animate (ClutterActor *actor,
|
||||
ClutterAnimationMode mode,
|
||||
guint duration,
|
||||
const gchar *first_property,
|
||||
actor_animate (ClutterActor *actor,
|
||||
ClutterAnimationMode mode,
|
||||
guint duration,
|
||||
const gchar *first_property,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
@ -285,7 +294,7 @@ actor_animate (ClutterActor *actor,
|
||||
static void
|
||||
on_switch_workspace_effect_complete (ClutterTimeline *timeline, gpointer data)
|
||||
{
|
||||
MetaPlugin *plugin = META_PLUGIN (data);
|
||||
MetaPlugin *plugin = META_PLUGIN (data);
|
||||
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
|
||||
MetaDisplay *display = meta_plugin_get_display (plugin);
|
||||
GList *l = meta_get_window_actors (display);
|
||||
@ -347,9 +356,9 @@ 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),
|
||||
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);
|
||||
@ -398,11 +409,11 @@ switch_workspace (MetaPlugin *plugin,
|
||||
{
|
||||
MetaDisplay *display;
|
||||
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
|
||||
GList *l;
|
||||
ClutterActor *workspace0 = clutter_actor_new ();
|
||||
ClutterActor *workspace1 = clutter_actor_new ();
|
||||
GList *l;
|
||||
ClutterActor *workspace0 = clutter_actor_new ();
|
||||
ClutterActor *workspace1 = clutter_actor_new ();
|
||||
ClutterActor *stage;
|
||||
int screen_width, screen_height;
|
||||
int screen_width, screen_height;
|
||||
|
||||
display = meta_plugin_get_display (plugin);
|
||||
stage = meta_get_stage_for_display (display);
|
||||
@ -432,12 +443,14 @@ switch_workspace (MetaPlugin *plugin,
|
||||
while (l)
|
||||
{
|
||||
MetaWindowActor *window_actor = l->data;
|
||||
ActorPrivate *apriv = get_actor_private (window_actor);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
|
||||
MetaWorkspace *workspace;
|
||||
gint win_workspace;
|
||||
ActorPrivate *apriv = get_actor_private (window_actor);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
|
||||
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
|
||||
@ -528,12 +542,12 @@ minimize (MetaPlugin *plugin, MetaWindowActor *window_actor)
|
||||
MetaWindowType type;
|
||||
MetaRectangle icon_geometry;
|
||||
MetaWindow *meta_window = meta_window_actor_get_meta_window (window_actor);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
|
||||
ClutterActor *actor = CLUTTER_ACTOR (window_actor);
|
||||
|
||||
|
||||
type = meta_window_get_window_type (meta_window);
|
||||
|
||||
if (!meta_window_get_icon_geometry(meta_window, &icon_geometry))
|
||||
if (!meta_window_get_icon_geometry (meta_window, &icon_geometry))
|
||||
{
|
||||
icon_geometry.x = 0;
|
||||
icon_geometry.y = 0;
|
||||
@ -549,15 +563,14 @@ minimize (MetaPlugin *plugin, MetaWindowActor *window_actor)
|
||||
MINIMIZE_TIMEOUT,
|
||||
"scale-x", 0.0,
|
||||
"scale-y", 0.0,
|
||||
"x", (double)icon_geometry.x,
|
||||
"y", (double)icon_geometry.y,
|
||||
"x", (double) icon_geometry.x,
|
||||
"y", (double) icon_geometry.y,
|
||||
NULL);
|
||||
data->plugin = plugin;
|
||||
data->actor = actor;
|
||||
g_signal_connect (apriv->tml_minimize, "completed",
|
||||
G_CALLBACK (on_minimize_effect_complete),
|
||||
data);
|
||||
|
||||
}
|
||||
else
|
||||
meta_plugin_minimize_completed (plugin, window_actor);
|
||||
@ -570,8 +583,8 @@ on_map_effect_complete (ClutterTimeline *timeline, EffectCompleteData *data)
|
||||
* Must reverse the effect of the effect.
|
||||
*/
|
||||
MetaPlugin *plugin = data->plugin;
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (data->actor);
|
||||
ActorPrivate *apriv = get_actor_private (window_actor);
|
||||
MetaWindowActor *window_actor = META_WINDOW_ACTOR (data->actor);
|
||||
ActorPrivate *apriv = get_actor_private (window_actor);
|
||||
|
||||
apriv->tml_map = NULL;
|
||||
|
||||
@ -679,19 +692,23 @@ free_display_tile_preview (gpointer data)
|
||||
{
|
||||
DisplayTilePreview *preview = data;
|
||||
|
||||
if (G_LIKELY (preview != NULL)) {
|
||||
clutter_actor_destroy (preview->actor);
|
||||
g_slice_free (DisplayTilePreview, preview);
|
||||
}
|
||||
if (G_LIKELY (preview != NULL))
|
||||
{
|
||||
clutter_actor_destroy (preview->actor);
|
||||
g_slice_free (DisplayTilePreview, preview);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@ -750,7 +769,7 @@ hide_tile_preview (MetaPlugin *plugin)
|
||||
}
|
||||
|
||||
static void
|
||||
kill_switch_workspace (MetaPlugin *plugin)
|
||||
kill_switch_workspace (MetaPlugin *plugin)
|
||||
{
|
||||
MetaDefaultPluginPrivate *priv = META_DEFAULT_PLUGIN (plugin)->priv;
|
||||
|
||||
|
@ -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
|
||||
|
||||
@ -112,7 +115,7 @@ meta_region_builder_finish (MetaRegionBuilder *builder)
|
||||
result = builder->levels[i];
|
||||
else
|
||||
{
|
||||
cairo_region_union(result, builder->levels[i]);
|
||||
cairo_region_union (result, builder->levels[i]);
|
||||
cairo_region_destroy (builder->levels[i]);
|
||||
}
|
||||
}
|
||||
@ -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
|
||||
@ -175,9 +179,9 @@ meta_region_iterator_next (MetaRegionIterator *iter)
|
||||
}
|
||||
|
||||
cairo_region_t *
|
||||
meta_region_scale_double (cairo_region_t *region,
|
||||
double scale,
|
||||
MetaRoundingStrategy rounding_strategy)
|
||||
meta_region_scale_double (cairo_region_t *region,
|
||||
double scale,
|
||||
MetaRoundingStrategy rounding_strategy)
|
||||
{
|
||||
int n_rects, i;
|
||||
cairo_rectangle_int_t *rects;
|
||||
@ -190,7 +194,7 @@ meta_region_scale_double (cairo_region_t *region,
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
|
||||
rects = g_malloc (sizeof(cairo_rectangle_int_t) * n_rects);
|
||||
rects = g_malloc (sizeof (cairo_rectangle_int_t) * n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (region, i, &rects[i]);
|
||||
@ -231,7 +235,7 @@ meta_region_scale (cairo_region_t *region, int scale)
|
||||
|
||||
n_rects = cairo_region_num_rectangles (region);
|
||||
|
||||
rects = g_malloc (sizeof(cairo_rectangle_int_t) * n_rects);
|
||||
rects = g_malloc (sizeof (cairo_rectangle_int_t) * n_rects);
|
||||
for (i = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (region, i, &rects[i]);
|
||||
@ -249,23 +253,25 @@ meta_region_scale (cairo_region_t *region, int scale)
|
||||
}
|
||||
|
||||
static void
|
||||
add_expanded_rect (MetaRegionBuilder *builder,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
int x_amount,
|
||||
int y_amount,
|
||||
gboolean flip)
|
||||
add_expanded_rect (MetaRegionBuilder *builder,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height,
|
||||
int x_amount,
|
||||
int y_amount,
|
||||
gboolean flip)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ bell_flash_window_frame (MetaWindow *window)
|
||||
* flashed state, no matter how loaded we are.
|
||||
*/
|
||||
id = g_timeout_add_full (META_PRIORITY_REDRAW, 100,
|
||||
bell_unflash_frame, window->frame, NULL);
|
||||
bell_unflash_frame, window->frame, NULL);
|
||||
g_source_set_name_by_id (id, "[mutter] bell_unflash_frame");
|
||||
}
|
||||
|
||||
@ -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);
|
||||
|
324
src/core/boxes.c
324
src/core/boxes.c
@ -59,13 +59,15 @@ 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"),
|
||||
(GBoxedCopyFunc) meta_rectangle_copy,
|
||||
(GBoxedFreeFunc) meta_rectangle_free);
|
||||
type_id =
|
||||
g_boxed_type_register_static (g_intern_static_string (
|
||||
"MetaRectangle"),
|
||||
(GBoxedCopyFunc) meta_rectangle_copy,
|
||||
(GBoxedFreeFunc) meta_rectangle_free);
|
||||
return type_id;
|
||||
}
|
||||
|
||||
char*
|
||||
char *
|
||||
meta_rectangle_to_string (const MetaRectangle *rect,
|
||||
char *output)
|
||||
{
|
||||
@ -79,7 +81,7 @@ meta_rectangle_to_string (const MetaRectangle *rect,
|
||||
return output;
|
||||
}
|
||||
|
||||
char*
|
||||
char *
|
||||
meta_rectangle_region_to_string (GList *region,
|
||||
const char *separator_string,
|
||||
char *output)
|
||||
@ -111,7 +113,7 @@ meta_rectangle_region_to_string (GList *region,
|
||||
return output;
|
||||
}
|
||||
|
||||
char*
|
||||
char *
|
||||
meta_rectangle_edge_to_string (const MetaEdge *edge,
|
||||
char *output)
|
||||
{
|
||||
@ -129,7 +131,7 @@ meta_rectangle_edge_to_string (const MetaEdge *edge,
|
||||
return output;
|
||||
}
|
||||
|
||||
char*
|
||||
char *
|
||||
meta_rectangle_edge_list_to_string (GList *edge_list,
|
||||
const char *separator_string,
|
||||
char *output)
|
||||
@ -152,7 +154,7 @@ meta_rectangle_edge_list_to_string (GList *edge_list,
|
||||
|
||||
while (tmp)
|
||||
{
|
||||
MetaEdge *edge = tmp->data;
|
||||
MetaEdge *edge = tmp->data;
|
||||
MetaRectangle *rect = &edge->rect;
|
||||
g_snprintf (rect_string, EDGE_LENGTH, "([%d,%d +%d,%d], %2d, %2d)",
|
||||
rect->x, rect->y, rect->width, rect->height,
|
||||
@ -172,7 +174,7 @@ meta_rect (int x, int y, int width, int height)
|
||||
MetaRectangle temporary;
|
||||
temporary.x = x;
|
||||
temporary.y = y;
|
||||
temporary.width = width;
|
||||
temporary.width = width;
|
||||
temporary.height = height;
|
||||
|
||||
return temporary;
|
||||
@ -197,8 +199,8 @@ meta_rectangle_area (const MetaRectangle *rect)
|
||||
*/
|
||||
gboolean
|
||||
meta_rectangle_intersect (const MetaRectangle *src1,
|
||||
const MetaRectangle *src2,
|
||||
MetaRectangle *dest)
|
||||
const MetaRectangle *src2,
|
||||
MetaRectangle *dest)
|
||||
{
|
||||
int dest_x, dest_y;
|
||||
int dest_w, dest_h;
|
||||
@ -290,8 +292,8 @@ meta_rectangle_overlap (const MetaRectangle *rect1,
|
||||
g_return_val_if_fail (rect1 != NULL, FALSE);
|
||||
g_return_val_if_fail (rect2 != NULL, FALSE);
|
||||
|
||||
return !((rect1->x + rect1->width <= rect2->x) ||
|
||||
(rect2->x + rect2->width <= rect1->x) ||
|
||||
return !((rect1->x + rect1->width <= rect2->x) ||
|
||||
(rect2->x + rect2->width <= rect1->x) ||
|
||||
(rect1->y + rect1->height <= rect2->y) ||
|
||||
(rect2->y + rect2->height <= rect1->y));
|
||||
}
|
||||
@ -316,7 +318,7 @@ gboolean
|
||||
meta_rectangle_could_fit_rect (const MetaRectangle *outer_rect,
|
||||
const MetaRectangle *inner_rect)
|
||||
{
|
||||
return (outer_rect->width >= inner_rect->width &&
|
||||
return (outer_rect->width >= inner_rect->width &&
|
||||
outer_rect->height >= inner_rect->height);
|
||||
}
|
||||
|
||||
@ -325,9 +327,9 @@ meta_rectangle_contains_rect (const MetaRectangle *outer_rect,
|
||||
const MetaRectangle *inner_rect)
|
||||
{
|
||||
return
|
||||
inner_rect->x >= outer_rect->x &&
|
||||
inner_rect->y >= outer_rect->y &&
|
||||
inner_rect->x + inner_rect->width <= outer_rect->x + outer_rect->width &&
|
||||
inner_rect->x >= outer_rect->x &&
|
||||
inner_rect->y >= outer_rect->y &&
|
||||
inner_rect->x + inner_rect->width <= outer_rect->x + outer_rect->width &&
|
||||
inner_rect->y + inner_rect->height <= outer_rect->y + outer_rect->height;
|
||||
}
|
||||
|
||||
@ -378,7 +380,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
||||
* would cause drift.
|
||||
*/
|
||||
new_width -= (old_rect->width - new_width) % 2;
|
||||
rect->x = old_rect->x + (old_rect->width - new_width)/2;
|
||||
rect->x = old_rect->x + (old_rect->width - new_width) / 2;
|
||||
break;
|
||||
|
||||
case NorthEastGravity:
|
||||
@ -410,7 +412,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
||||
* would cause drift.
|
||||
*/
|
||||
new_height -= (old_rect->height - new_height) % 2;
|
||||
rect->y = old_rect->y + (old_rect->height - new_height)/2;
|
||||
rect->y = old_rect->y + (old_rect->height - new_height) / 2;
|
||||
break;
|
||||
|
||||
case SouthWestGravity:
|
||||
@ -428,7 +430,7 @@ meta_rectangle_resize_with_gravity (const MetaRectangle *old_rect,
|
||||
}
|
||||
|
||||
/* Not so simple helper function for get_minimal_spanning_set_for_region() */
|
||||
static GList*
|
||||
static GList *
|
||||
merge_spanning_rects_in_region (GList *region)
|
||||
{
|
||||
/* NOTE FOR ANY OPTIMIZATION PEOPLE OUT THERE: Please see the
|
||||
@ -436,7 +438,7 @@ merge_spanning_rects_in_region (GList *region)
|
||||
* considerations that also apply to this function.
|
||||
*/
|
||||
|
||||
GList* compare;
|
||||
GList *compare;
|
||||
compare = region;
|
||||
|
||||
if (region == NULL)
|
||||
@ -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;
|
||||
@ -590,10 +591,10 @@ check_strut_align (MetaStrut *strut, const MetaRectangle *rect)
|
||||
*
|
||||
* Returns: (transfer full) (element-type Meta.Rectangle): Minimal spanning set
|
||||
*/
|
||||
GList*
|
||||
GList *
|
||||
meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
const MetaRectangle *basic_rect,
|
||||
const GSList *all_struts)
|
||||
const GSList *all_struts)
|
||||
{
|
||||
/* NOTE FOR OPTIMIZERS: This function *might* be somewhat slow,
|
||||
* especially due to the call to merge_spanning_rects_in_region() (which
|
||||
@ -631,9 +632,9 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
* URL splitting.)
|
||||
*/
|
||||
|
||||
GList *ret;
|
||||
GList *tmp_list;
|
||||
const GSList *strut_iter;
|
||||
GList *ret;
|
||||
GList *tmp_list;
|
||||
const GSList *strut_iter;
|
||||
MetaRectangle *temp_rect;
|
||||
|
||||
/* The algorithm is basically as follows:
|
||||
@ -654,7 +655,7 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
for (strut_iter = all_struts; strut_iter; strut_iter = strut_iter->next)
|
||||
{
|
||||
GList *rect_iter;
|
||||
MetaStrut *strut = (MetaStrut*)strut_iter->data;
|
||||
MetaStrut *strut = (MetaStrut *) strut_iter->data;
|
||||
MetaRectangle *strut_rect = &strut->rect;
|
||||
|
||||
tmp_list = ret;
|
||||
@ -662,7 +663,7 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
rect_iter = tmp_list;
|
||||
while (rect_iter)
|
||||
{
|
||||
MetaRectangle *rect = (MetaRectangle*) rect_iter->data;
|
||||
MetaRectangle *rect = (MetaRectangle *) rect_iter->data;
|
||||
|
||||
if (!meta_rectangle_overlap (strut_rect, rect) ||
|
||||
!check_strut_align (strut, basic_rect))
|
||||
@ -684,7 +685,7 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
temp_rect = g_new (MetaRectangle, 1);
|
||||
*temp_rect = *rect;
|
||||
new_x = BOX_RIGHT (*strut_rect);
|
||||
temp_rect->width = BOX_RIGHT(*rect) - new_x;
|
||||
temp_rect->width = BOX_RIGHT (*rect) - new_x;
|
||||
temp_rect->x = new_x;
|
||||
ret = g_list_prepend (ret, temp_rect);
|
||||
}
|
||||
@ -727,12 +728,12 @@ meta_rectangle_get_minimal_spanning_set_for_region (
|
||||
* meta_rectangle_expand_region: (skip)
|
||||
*
|
||||
*/
|
||||
GList*
|
||||
meta_rectangle_expand_region (GList *region,
|
||||
const int left_expand,
|
||||
const int right_expand,
|
||||
const int top_expand,
|
||||
const int bottom_expand)
|
||||
GList *
|
||||
meta_rectangle_expand_region (GList *region,
|
||||
const int left_expand,
|
||||
const int right_expand,
|
||||
const int top_expand,
|
||||
const int bottom_expand)
|
||||
{
|
||||
return meta_rectangle_expand_region_conditionally (region,
|
||||
left_expand,
|
||||
@ -747,27 +748,27 @@ meta_rectangle_expand_region (GList *region,
|
||||
* meta_rectangle_expand_region_conditionally: (skip)
|
||||
*
|
||||
*/
|
||||
GList*
|
||||
meta_rectangle_expand_region_conditionally (GList *region,
|
||||
const int left_expand,
|
||||
const int right_expand,
|
||||
const int top_expand,
|
||||
const int bottom_expand,
|
||||
const int min_x,
|
||||
const int min_y)
|
||||
GList *
|
||||
meta_rectangle_expand_region_conditionally (GList *region,
|
||||
const int left_expand,
|
||||
const int right_expand,
|
||||
const int top_expand,
|
||||
const int bottom_expand,
|
||||
const int min_x,
|
||||
const int min_y)
|
||||
{
|
||||
GList *tmp_list = region;
|
||||
while (tmp_list)
|
||||
{
|
||||
MetaRectangle *rect = (MetaRectangle*) tmp_list->data;
|
||||
MetaRectangle *rect = (MetaRectangle *) tmp_list->data;
|
||||
if (rect->width >= min_x)
|
||||
{
|
||||
rect->x -= left_expand;
|
||||
rect->width += (left_expand + right_expand);
|
||||
rect->x -= left_expand;
|
||||
rect->width += (left_expand + right_expand);
|
||||
}
|
||||
if (rect->height >= min_y)
|
||||
{
|
||||
rect->y -= top_expand;
|
||||
rect->y -= top_expand;
|
||||
rect->height += (top_expand + bottom_expand);
|
||||
}
|
||||
tmp_list = tmp_list->next;
|
||||
@ -790,16 +791,16 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
* horizontal directions (exclusive-)or both vertical directions.
|
||||
*/
|
||||
g_assert ((direction == META_DIRECTION_HORIZONTAL) ^
|
||||
(direction == META_DIRECTION_VERTICAL ));
|
||||
(direction == META_DIRECTION_VERTICAL));
|
||||
|
||||
if (direction == META_DIRECTION_HORIZONTAL)
|
||||
{
|
||||
rect->x = expand_to->x;
|
||||
rect->width = expand_to->width;
|
||||
rect->x = expand_to->x;
|
||||
rect->width = expand_to->width;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect->y = expand_to->y;
|
||||
rect->y = expand_to->y;
|
||||
rect->height = expand_to->height;
|
||||
}
|
||||
|
||||
@ -807,7 +808,7 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
/* Run over all struts */
|
||||
for (strut_iter = all_struts; strut_iter; strut_iter = strut_iter->next)
|
||||
{
|
||||
MetaStrut *strut = (MetaStrut*) strut_iter->data;
|
||||
MetaStrut *strut = (MetaStrut *) strut_iter->data;
|
||||
|
||||
/* Skip struts that don't overlap */
|
||||
if (!meta_rectangle_overlap (&strut->rect, rect))
|
||||
@ -817,13 +818,13 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
{
|
||||
if (strut->side == META_SIDE_LEFT)
|
||||
{
|
||||
int offset = BOX_RIGHT(strut->rect) - BOX_LEFT(*rect);
|
||||
rect->x += offset;
|
||||
int offset = BOX_RIGHT (strut->rect) - BOX_LEFT (*rect);
|
||||
rect->x += offset;
|
||||
rect->width -= offset;
|
||||
}
|
||||
else if (strut->side == META_SIDE_RIGHT)
|
||||
{
|
||||
int offset = BOX_RIGHT (*rect) - BOX_LEFT(strut->rect);
|
||||
int offset = BOX_RIGHT (*rect) - BOX_LEFT (strut->rect);
|
||||
rect->width -= offset;
|
||||
}
|
||||
/* else ignore the strut */
|
||||
@ -832,13 +833,13 @@ meta_rectangle_expand_to_avoiding_struts (MetaRectangle *rect,
|
||||
{
|
||||
if (strut->side == META_SIDE_TOP)
|
||||
{
|
||||
int offset = BOX_BOTTOM(strut->rect) - BOX_TOP(*rect);
|
||||
rect->y += offset;
|
||||
int offset = BOX_BOTTOM (strut->rect) - BOX_TOP (*rect);
|
||||
rect->y += offset;
|
||||
rect->height -= offset;
|
||||
}
|
||||
else if (strut->side == META_SIDE_BOTTOM)
|
||||
{
|
||||
int offset = BOX_BOTTOM(*rect) - BOX_TOP(strut->rect);
|
||||
int offset = BOX_BOTTOM (*rect) - BOX_TOP (strut->rect);
|
||||
rect->height -= offset;
|
||||
}
|
||||
/* else ignore the strut */
|
||||
@ -850,7 +851,7 @@ void
|
||||
meta_rectangle_free_list_and_elements (GList *filled_list)
|
||||
{
|
||||
g_list_foreach (filled_list,
|
||||
(void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */
|
||||
(void (*)(gpointer, gpointer)) & g_free, /* ew, for ugly */
|
||||
NULL);
|
||||
g_list_free (filled_list);
|
||||
}
|
||||
@ -860,7 +861,7 @@ meta_rectangle_could_fit_in_region (const GList *spanning_rects,
|
||||
const MetaRectangle *rect)
|
||||
{
|
||||
const GList *temp;
|
||||
gboolean could_fit;
|
||||
gboolean could_fit;
|
||||
|
||||
temp = spanning_rects;
|
||||
could_fit = FALSE;
|
||||
@ -878,7 +879,7 @@ meta_rectangle_contained_in_region (const GList *spanning_rects,
|
||||
const MetaRectangle *rect)
|
||||
{
|
||||
const GList *temp;
|
||||
gboolean contained;
|
||||
gboolean contained;
|
||||
|
||||
temp = spanning_rects;
|
||||
contained = FALSE;
|
||||
@ -896,7 +897,7 @@ meta_rectangle_overlaps_with_region (const GList *spanning_rects,
|
||||
const MetaRectangle *rect)
|
||||
{
|
||||
const GList *temp;
|
||||
gboolean overlaps;
|
||||
gboolean overlaps;
|
||||
|
||||
temp = spanning_rects;
|
||||
overlaps = FALSE;
|
||||
@ -918,7 +919,7 @@ meta_rectangle_clamp_to_fit_into_region (const GList *spanning_rects,
|
||||
{
|
||||
const GList *temp;
|
||||
const MetaRectangle *best_rect = NULL;
|
||||
int best_overlap = 0;
|
||||
int best_overlap = 0;
|
||||
|
||||
/* First, find best rectangle from spanning_rects to which we can clamp
|
||||
* rect to fit into.
|
||||
@ -926,7 +927,7 @@ meta_rectangle_clamp_to_fit_into_region (const GList *spanning_rects,
|
||||
for (temp = spanning_rects; temp; temp = temp->next)
|
||||
{
|
||||
MetaRectangle *compare_rect = temp->data;
|
||||
int maximal_overlap_amount_for_compare;
|
||||
int maximal_overlap_amount_for_compare;
|
||||
|
||||
/* If x is fixed and the entire width of rect doesn't fit in compare,
|
||||
* skip this rectangle.
|
||||
@ -945,19 +946,19 @@ meta_rectangle_clamp_to_fit_into_region (const GList *spanning_rects,
|
||||
continue;
|
||||
|
||||
/* If compare can't hold the min_size window, skip this rectangle. */
|
||||
if (compare_rect->width < min_size->width ||
|
||||
if (compare_rect->width < min_size->width ||
|
||||
compare_rect->height < min_size->height)
|
||||
continue;
|
||||
|
||||
/* Determine maximal overlap amount */
|
||||
maximal_overlap_amount_for_compare =
|
||||
MIN (rect->width, compare_rect->width) *
|
||||
MIN (rect->width, compare_rect->width) *
|
||||
MIN (rect->height, compare_rect->height);
|
||||
|
||||
/* See if this is the best rect so far */
|
||||
if (maximal_overlap_amount_for_compare > best_overlap)
|
||||
{
|
||||
best_rect = compare_rect;
|
||||
best_rect = compare_rect;
|
||||
best_overlap = maximal_overlap_amount_for_compare;
|
||||
}
|
||||
}
|
||||
@ -969,25 +970,25 @@ meta_rectangle_clamp_to_fit_into_region (const GList *spanning_rects,
|
||||
|
||||
/* If it doesn't fit, at least make it no bigger than it has to be */
|
||||
if (!(fixed_directions & FIXED_DIRECTION_X))
|
||||
rect->width = min_size->width;
|
||||
rect->width = min_size->width;
|
||||
if (!(fixed_directions & FIXED_DIRECTION_Y))
|
||||
rect->height = min_size->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect->width = MIN (rect->width, best_rect->width);
|
||||
rect->width = MIN (rect->width, best_rect->width);
|
||||
rect->height = MIN (rect->height, best_rect->height);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
meta_rectangle_clip_to_region (const GList *spanning_rects,
|
||||
FixedDirections fixed_directions,
|
||||
MetaRectangle *rect)
|
||||
meta_rectangle_clip_to_region (const GList *spanning_rects,
|
||||
FixedDirections fixed_directions,
|
||||
MetaRectangle *rect)
|
||||
{
|
||||
const GList *temp;
|
||||
const MetaRectangle *best_rect = NULL;
|
||||
int best_overlap = 0;
|
||||
int best_overlap = 0;
|
||||
|
||||
/* First, find best rectangle from spanning_rects to which we will clip
|
||||
* rect into.
|
||||
@ -995,8 +996,8 @@ meta_rectangle_clip_to_region (const GList *spanning_rects,
|
||||
for (temp = spanning_rects; temp; temp = temp->next)
|
||||
{
|
||||
MetaRectangle *compare_rect = temp->data;
|
||||
MetaRectangle overlap;
|
||||
int maximal_overlap_amount_for_compare;
|
||||
MetaRectangle overlap;
|
||||
int maximal_overlap_amount_for_compare;
|
||||
|
||||
/* If x is fixed and the entire width of rect doesn't fit in compare,
|
||||
* skip the rectangle.
|
||||
@ -1021,7 +1022,7 @@ meta_rectangle_clip_to_region (const GList *spanning_rects,
|
||||
/* See if this is the best rect so far */
|
||||
if (maximal_overlap_amount_for_compare > best_overlap)
|
||||
{
|
||||
best_rect = compare_rect;
|
||||
best_rect = compare_rect;
|
||||
best_overlap = maximal_overlap_amount_for_compare;
|
||||
}
|
||||
}
|
||||
@ -1040,7 +1041,7 @@ meta_rectangle_clip_to_region (const GList *spanning_rects,
|
||||
{
|
||||
/* Find the new left and right */
|
||||
int new_x = MAX (rect->x, best_rect->x);
|
||||
rect->width = MIN ((rect->x + rect->width) - new_x,
|
||||
rect->width = MIN ((rect->x + rect->width) - new_x,
|
||||
(best_rect->x + best_rect->width) - new_x);
|
||||
rect->x = new_x;
|
||||
}
|
||||
@ -1052,7 +1053,7 @@ meta_rectangle_clip_to_region (const GList *spanning_rects,
|
||||
{
|
||||
/* Clip the top, if needed */
|
||||
int new_y = MAX (rect->y, best_rect->y);
|
||||
rect->height = MIN ((rect->y + rect->height) - new_y,
|
||||
rect->height = MIN ((rect->y + rect->height) - new_y,
|
||||
(best_rect->y + best_rect->height) - new_y);
|
||||
rect->y = new_y;
|
||||
}
|
||||
@ -1060,14 +1061,14 @@ meta_rectangle_clip_to_region (const GList *spanning_rects,
|
||||
}
|
||||
|
||||
void
|
||||
meta_rectangle_shove_into_region (const GList *spanning_rects,
|
||||
FixedDirections fixed_directions,
|
||||
MetaRectangle *rect)
|
||||
meta_rectangle_shove_into_region (const GList *spanning_rects,
|
||||
FixedDirections fixed_directions,
|
||||
MetaRectangle *rect)
|
||||
{
|
||||
const GList *temp;
|
||||
const MetaRectangle *best_rect = NULL;
|
||||
int best_overlap = 0;
|
||||
int shortest_distance = G_MAXINT;
|
||||
int best_overlap = 0;
|
||||
int shortest_distance = G_MAXINT;
|
||||
|
||||
/* First, find best rectangle from spanning_rects to which we will shove
|
||||
* rect into.
|
||||
@ -1076,8 +1077,8 @@ meta_rectangle_shove_into_region (const GList *spanning_rects,
|
||||
for (temp = spanning_rects; temp; temp = temp->next)
|
||||
{
|
||||
MetaRectangle *compare_rect = temp->data;
|
||||
int maximal_overlap_amount_for_compare;
|
||||
int dist_to_compare;
|
||||
int maximal_overlap_amount_for_compare;
|
||||
int dist_to_compare;
|
||||
|
||||
/* If x is fixed and the entire width of rect doesn't fit in compare,
|
||||
* skip this rectangle.
|
||||
@ -1097,7 +1098,7 @@ meta_rectangle_shove_into_region (const GList *spanning_rects,
|
||||
|
||||
/* Determine maximal overlap amount between rect & compare_rect */
|
||||
maximal_overlap_amount_for_compare =
|
||||
MIN (rect->width, compare_rect->width) *
|
||||
MIN (rect->width, compare_rect->width) *
|
||||
MIN (rect->height, compare_rect->height);
|
||||
|
||||
/* Determine distance necessary to put rect into compare_rect */
|
||||
@ -1116,10 +1117,10 @@ meta_rectangle_shove_into_region (const GList *spanning_rects,
|
||||
/* See if this is the best rect so far */
|
||||
if ((maximal_overlap_amount_for_compare > best_overlap) ||
|
||||
(maximal_overlap_amount_for_compare == best_overlap &&
|
||||
dist_to_compare < shortest_distance))
|
||||
dist_to_compare < shortest_distance))
|
||||
{
|
||||
best_rect = compare_rect;
|
||||
best_overlap = maximal_overlap_amount_for_compare;
|
||||
best_rect = compare_rect;
|
||||
best_overlap = maximal_overlap_amount_for_compare;
|
||||
shortest_distance = dist_to_compare;
|
||||
}
|
||||
}
|
||||
@ -1162,12 +1163,12 @@ meta_rectangle_shove_into_region (const GList *spanning_rects,
|
||||
}
|
||||
|
||||
void
|
||||
meta_rectangle_find_linepoint_closest_to_point (double x1,
|
||||
double y1,
|
||||
double x2,
|
||||
double y2,
|
||||
double px,
|
||||
double py,
|
||||
meta_rectangle_find_linepoint_closest_to_point (double x1,
|
||||
double y1,
|
||||
double x2,
|
||||
double y2,
|
||||
double px,
|
||||
double py,
|
||||
double *valx,
|
||||
double *valy)
|
||||
{
|
||||
@ -1237,18 +1238,18 @@ meta_rectangle_edge_aligns (const MetaRectangle *rect, const MetaEdge *edge)
|
||||
{
|
||||
case META_SIDE_LEFT:
|
||||
case META_SIDE_RIGHT:
|
||||
return BOX_TOP (*rect) <= BOX_BOTTOM (edge->rect) &&
|
||||
return BOX_TOP (*rect) <= BOX_BOTTOM (edge->rect) &&
|
||||
BOX_TOP (edge->rect) <= BOX_BOTTOM (*rect);
|
||||
case META_SIDE_TOP:
|
||||
case META_SIDE_BOTTOM:
|
||||
return BOX_LEFT (*rect) <= BOX_RIGHT (edge->rect) &&
|
||||
return BOX_LEFT (*rect) <= BOX_RIGHT (edge->rect) &&
|
||||
BOX_LEFT (edge->rect) <= BOX_RIGHT (*rect);
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
static GList*
|
||||
static GList *
|
||||
get_rect_minus_overlap (const GList *rect_in_list,
|
||||
MetaRectangle *overlap)
|
||||
{
|
||||
@ -1274,18 +1275,18 @@ get_rect_minus_overlap (const GList *rect_in_list,
|
||||
if (BOX_TOP (*rect) < BOX_TOP (*overlap))
|
||||
{
|
||||
temp = g_new (MetaRectangle, 1);
|
||||
temp->x = overlap->x;
|
||||
temp->width = overlap->width;
|
||||
temp->y = BOX_TOP (*rect);
|
||||
temp->x = overlap->x;
|
||||
temp->width = overlap->width;
|
||||
temp->y = BOX_TOP (*rect);
|
||||
temp->height = BOX_TOP (*overlap) - BOX_TOP (*rect);
|
||||
ret = g_list_prepend (ret, temp);
|
||||
}
|
||||
if (BOX_BOTTOM (*rect) > BOX_BOTTOM (*overlap))
|
||||
{
|
||||
temp = g_new (MetaRectangle, 1);
|
||||
temp->x = overlap->x;
|
||||
temp->width = overlap->width;
|
||||
temp->y = BOX_BOTTOM (*overlap);
|
||||
temp->x = overlap->x;
|
||||
temp->width = overlap->width;
|
||||
temp->y = BOX_BOTTOM (*overlap);
|
||||
temp->height = BOX_BOTTOM (*rect) - BOX_BOTTOM (*overlap);
|
||||
ret = g_list_prepend (ret, temp);
|
||||
}
|
||||
@ -1293,7 +1294,7 @@ get_rect_minus_overlap (const GList *rect_in_list,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static GList*
|
||||
static GList *
|
||||
replace_rect_with_list (GList *old_element,
|
||||
GList *new_list)
|
||||
{
|
||||
@ -1334,7 +1335,7 @@ replace_rect_with_list (GList *old_element,
|
||||
* that aren't disjoint in a way that the overlapping part is only included
|
||||
* once, so it's not really magic...).
|
||||
*/
|
||||
static GList*
|
||||
static GList *
|
||||
get_disjoint_strut_rect_list_in_region (const GSList *old_struts,
|
||||
const MetaRectangle *region)
|
||||
{
|
||||
@ -1345,7 +1346,7 @@ get_disjoint_strut_rect_list_in_region (const GSList *old_struts,
|
||||
strut_rects = NULL;
|
||||
while (old_struts)
|
||||
{
|
||||
MetaRectangle *cur = &((MetaStrut*)old_struts->data)->rect;
|
||||
MetaRectangle *cur = &((MetaStrut *) old_struts->data)->rect;
|
||||
MetaRectangle *copy = g_new (MetaRectangle, 1);
|
||||
*copy = *cur;
|
||||
if (meta_rectangle_intersect (copy, region, copy))
|
||||
@ -1377,7 +1378,7 @@ get_disjoint_strut_rect_list_in_region (const GSList *old_struts,
|
||||
/* Get a list of rectangles for each strut that don't overlap
|
||||
* the intersection region.
|
||||
*/
|
||||
GList *cur_leftover = get_rect_minus_overlap (tmp, &overlap);
|
||||
GList *cur_leftover = get_rect_minus_overlap (tmp, &overlap);
|
||||
GList *comp_leftover = get_rect_minus_overlap (compare, &overlap);
|
||||
|
||||
/* Add the intersection region to cur_leftover */
|
||||
@ -1392,7 +1393,7 @@ get_disjoint_strut_rect_list_in_region (const GSList *old_struts,
|
||||
tmp = strut_rects;
|
||||
}
|
||||
else
|
||||
tmp = replace_rect_with_list (tmp, cur_leftover);
|
||||
tmp = replace_rect_with_list (tmp, cur_leftover);
|
||||
compare = replace_rect_with_list (compare, comp_leftover);
|
||||
|
||||
if (compare == NULL)
|
||||
@ -1420,7 +1421,7 @@ meta_rectangle_edge_cmp_ignore_type (gconstpointer a, gconstpointer b)
|
||||
/* Edges must be both vertical or both horizontal, or it doesn't make
|
||||
* sense to compare them.
|
||||
*/
|
||||
g_assert ((a_edge_rect->rect.width == 0 && b_edge_rect->rect.width == 0) ||
|
||||
g_assert ((a_edge_rect->rect.width == 0 && b_edge_rect->rect.width == 0) ||
|
||||
(a_edge_rect->rect.height == 0 && b_edge_rect->rect.height == 0));
|
||||
|
||||
a_compare = b_compare = 0; /* gcc-3.4.2 sucks at figuring initialized'ness */
|
||||
@ -1498,7 +1499,7 @@ rectangle_and_edge_intersection (const MetaRectangle *rect,
|
||||
MetaEdge *overlap,
|
||||
int *handle_type)
|
||||
{
|
||||
const MetaRectangle *rect2 = &edge->rect;
|
||||
const MetaRectangle *rect2 = &edge->rect;
|
||||
MetaRectangle *result = &overlap->rect;
|
||||
gboolean intersect = TRUE;
|
||||
|
||||
@ -1509,13 +1510,13 @@ rectangle_and_edge_intersection (const MetaRectangle *rect,
|
||||
/* Figure out what the intersection is */
|
||||
result->x = MAX (rect->x, rect2->x);
|
||||
result->y = MAX (rect->y, rect2->y);
|
||||
result->width = MIN (BOX_RIGHT (*rect), BOX_RIGHT (*rect2)) - result->x;
|
||||
result->width = MIN (BOX_RIGHT (*rect), BOX_RIGHT (*rect2)) - result->x;
|
||||
result->height = MIN (BOX_BOTTOM (*rect), BOX_BOTTOM (*rect2)) - result->y;
|
||||
|
||||
/* Find out if the intersection is empty; have to do it this way since
|
||||
* edges have a thickness of 0
|
||||
*/
|
||||
if ((result->width < 0 || result->height < 0) ||
|
||||
if ((result->width < 0 || result->height < 0) ||
|
||||
(result->width == 0 && result->height == 0))
|
||||
{
|
||||
result->width = 0;
|
||||
@ -1576,7 +1577,7 @@ rectangle_and_edge_intersection (const MetaRectangle *rect,
|
||||
* rect_is_internal is false, the side types are switched (LEFT<->RIGHT and
|
||||
* TOP<->BOTTOM).
|
||||
*/
|
||||
static GList*
|
||||
static GList *
|
||||
add_edges (GList *cur_edges,
|
||||
const MetaRectangle *rect,
|
||||
gboolean rect_is_internal)
|
||||
@ -1584,7 +1585,7 @@ add_edges (GList *cur_edges,
|
||||
MetaEdge *temp_edge;
|
||||
int i;
|
||||
|
||||
for (i=0; i<4; i++)
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
temp_edge->rect = *rect;
|
||||
@ -1598,8 +1599,8 @@ add_edges (GList *cur_edges,
|
||||
case 1:
|
||||
temp_edge->side_type =
|
||||
rect_is_internal ? META_SIDE_RIGHT : META_SIDE_LEFT;
|
||||
temp_edge->rect.x += temp_edge->rect.width;
|
||||
temp_edge->rect.width = 0;
|
||||
temp_edge->rect.x += temp_edge->rect.width;
|
||||
temp_edge->rect.width = 0;
|
||||
break;
|
||||
case 2:
|
||||
temp_edge->side_type =
|
||||
@ -1609,8 +1610,8 @@ add_edges (GList *cur_edges,
|
||||
case 3:
|
||||
temp_edge->side_type =
|
||||
rect_is_internal ? META_SIDE_BOTTOM : META_SIDE_TOP;
|
||||
temp_edge->rect.y += temp_edge->rect.height;
|
||||
temp_edge->rect.height = 0;
|
||||
temp_edge->rect.y += temp_edge->rect.height;
|
||||
temp_edge->rect.height = 0;
|
||||
break;
|
||||
}
|
||||
temp_edge->edge_type = META_EDGE_SCREEN;
|
||||
@ -1623,8 +1624,8 @@ add_edges (GList *cur_edges,
|
||||
/* Remove any part of old_edge that intersects remove and add any resulting
|
||||
* edges to cur_list. Return cur_list when finished.
|
||||
*/
|
||||
static GList*
|
||||
split_edge (GList *cur_list,
|
||||
static GList *
|
||||
split_edge (GList *cur_list,
|
||||
const MetaEdge *old_edge,
|
||||
const MetaEdge *remove)
|
||||
{
|
||||
@ -1634,42 +1635,42 @@ split_edge (GList *cur_list,
|
||||
case META_SIDE_LEFT:
|
||||
case META_SIDE_RIGHT:
|
||||
g_assert (meta_rectangle_vert_overlap (&old_edge->rect, &remove->rect));
|
||||
if (BOX_TOP (old_edge->rect) < BOX_TOP (remove->rect))
|
||||
if (BOX_TOP (old_edge->rect) < BOX_TOP (remove->rect))
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
*temp_edge = *old_edge;
|
||||
temp_edge->rect.height = BOX_TOP (remove->rect)
|
||||
- BOX_TOP (old_edge->rect);
|
||||
- BOX_TOP (old_edge->rect);
|
||||
cur_list = g_list_prepend (cur_list, temp_edge);
|
||||
}
|
||||
if (BOX_BOTTOM (old_edge->rect) > BOX_BOTTOM (remove->rect))
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
*temp_edge = *old_edge;
|
||||
temp_edge->rect.y = BOX_BOTTOM (remove->rect);
|
||||
temp_edge->rect.y = BOX_BOTTOM (remove->rect);
|
||||
temp_edge->rect.height = BOX_BOTTOM (old_edge->rect)
|
||||
- BOX_BOTTOM (remove->rect);
|
||||
- BOX_BOTTOM (remove->rect);
|
||||
cur_list = g_list_prepend (cur_list, temp_edge);
|
||||
}
|
||||
break;
|
||||
case META_SIDE_TOP:
|
||||
case META_SIDE_BOTTOM:
|
||||
g_assert (meta_rectangle_horiz_overlap (&old_edge->rect, &remove->rect));
|
||||
if (BOX_LEFT (old_edge->rect) < BOX_LEFT (remove->rect))
|
||||
if (BOX_LEFT (old_edge->rect) < BOX_LEFT (remove->rect))
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
*temp_edge = *old_edge;
|
||||
temp_edge->rect.width = BOX_LEFT (remove->rect)
|
||||
- BOX_LEFT (old_edge->rect);
|
||||
- BOX_LEFT (old_edge->rect);
|
||||
cur_list = g_list_prepend (cur_list, temp_edge);
|
||||
}
|
||||
if (BOX_RIGHT (old_edge->rect) > BOX_RIGHT (remove->rect))
|
||||
{
|
||||
temp_edge = g_new (MetaEdge, 1);
|
||||
*temp_edge = *old_edge;
|
||||
temp_edge->rect.x = BOX_RIGHT (remove->rect);
|
||||
temp_edge->rect.x = BOX_RIGHT (remove->rect);
|
||||
temp_edge->rect.width = BOX_RIGHT (old_edge->rect)
|
||||
- BOX_RIGHT (remove->rect);
|
||||
- BOX_RIGHT (remove->rect);
|
||||
cur_list = g_list_prepend (cur_list, temp_edge);
|
||||
}
|
||||
break;
|
||||
@ -1684,12 +1685,12 @@ split_edge (GList *cur_list,
|
||||
* if and how rect and edge intersect.
|
||||
*/
|
||||
static void
|
||||
fix_up_edges (MetaRectangle *rect, MetaEdge *edge,
|
||||
GList **strut_edges, GList **edge_splits,
|
||||
gboolean *edge_needs_removal)
|
||||
fix_up_edges (MetaRectangle *rect, MetaEdge *edge,
|
||||
GList **strut_edges, GList **edge_splits,
|
||||
gboolean *edge_needs_removal)
|
||||
{
|
||||
MetaEdge overlap;
|
||||
int handle_type;
|
||||
int handle_type;
|
||||
|
||||
if (!rectangle_and_edge_intersection (rect, edge, &overlap, &handle_type))
|
||||
return;
|
||||
@ -1734,10 +1735,9 @@ fix_up_edges (MetaRectangle *rect, MetaEdge *edge,
|
||||
* This function removes intersections of edges with the rectangles from the
|
||||
* list of edges.
|
||||
*/
|
||||
GList*
|
||||
meta_rectangle_remove_intersections_with_boxes_from_edges (
|
||||
GList *edges,
|
||||
const GSList *rectangles)
|
||||
GList *
|
||||
meta_rectangle_remove_intersections_with_boxes_from_edges (GList *edges,
|
||||
const GSList *rectangles)
|
||||
{
|
||||
const GSList *rect_iter;
|
||||
const int opposing = 1;
|
||||
@ -1752,13 +1752,12 @@ meta_rectangle_remove_intersections_with_boxes_from_edges (
|
||||
{
|
||||
MetaEdge *edge = edge_iter->data;
|
||||
MetaEdge overlap;
|
||||
int handle;
|
||||
int handle;
|
||||
gboolean edge_iter_advanced = FALSE;
|
||||
|
||||
/* 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
|
||||
@ -1802,14 +1801,14 @@ meta_rectangle_remove_intersections_with_boxes_from_edges (
|
||||
*
|
||||
* This function is trying to find all the edges of an onscreen region.
|
||||
*/
|
||||
GList*
|
||||
GList *
|
||||
meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
|
||||
const GSList *all_struts)
|
||||
{
|
||||
GList *ret;
|
||||
GList *fixed_strut_rects;
|
||||
GList *edge_iter;
|
||||
const GList *strut_rect_iter;
|
||||
GList *ret;
|
||||
GList *fixed_strut_rects;
|
||||
GList *edge_iter;
|
||||
const GList *strut_rect_iter;
|
||||
|
||||
/* The algorithm is basically as follows:
|
||||
* Make sure the struts are disjoint
|
||||
@ -1836,7 +1835,7 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
|
||||
strut_rect_iter = fixed_strut_rects;
|
||||
while (strut_rect_iter)
|
||||
{
|
||||
MetaRectangle *strut_rect = (MetaRectangle*) strut_rect_iter->data;
|
||||
MetaRectangle *strut_rect = (MetaRectangle *) strut_rect_iter->data;
|
||||
|
||||
/* Get the new possible edges we may need to add from the strut */
|
||||
GList *new_strut_edges = add_edges (NULL, strut_rect, FALSE);
|
||||
@ -1848,7 +1847,7 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
|
||||
GList *splits_of_cur_edge = NULL;
|
||||
gboolean edge_needs_removal = FALSE;
|
||||
|
||||
fix_up_edges (strut_rect, cur_edge,
|
||||
fix_up_edges (strut_rect, cur_edge,
|
||||
&new_strut_edges, &splits_of_cur_edge,
|
||||
&edge_needs_removal);
|
||||
|
||||
@ -1888,10 +1887,9 @@ meta_rectangle_find_onscreen_edges (const MetaRectangle *basic_rect,
|
||||
* meta_rectangle_find_nonintersected_monitor_edges: (skip)
|
||||
*
|
||||
*/
|
||||
GList*
|
||||
meta_rectangle_find_nonintersected_monitor_edges (
|
||||
const GList *monitor_rects,
|
||||
const GSList *all_struts)
|
||||
GList *
|
||||
meta_rectangle_find_nonintersected_monitor_edges (const GList *monitor_rects,
|
||||
const GSList *all_struts)
|
||||
{
|
||||
/* This function cannot easily be merged with
|
||||
* meta_rectangle_find_onscreen_edges() because real screen edges
|
||||
@ -1899,7 +1897,7 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
* immediately on the other side"; monitor edges are different.
|
||||
*/
|
||||
GList *ret;
|
||||
const GList *cur;
|
||||
const GList *cur;
|
||||
GSList *temp_rects;
|
||||
|
||||
/* Initialize the return list to be empty */
|
||||
@ -1918,16 +1916,16 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
MetaRectangle *compare_rect = compare->data;
|
||||
|
||||
/* Check if cur might be horizontally adjacent to compare */
|
||||
if (meta_rectangle_vert_overlap(cur_rect, compare_rect))
|
||||
if (meta_rectangle_vert_overlap (cur_rect, compare_rect))
|
||||
{
|
||||
MetaSide side_type;
|
||||
int y = MAX (cur_rect->y, compare_rect->y);
|
||||
int y = MAX (cur_rect->y, compare_rect->y);
|
||||
int height = MIN (BOX_BOTTOM (*cur_rect) - y,
|
||||
BOX_BOTTOM (*compare_rect) - y);
|
||||
int width = 0;
|
||||
int width = 0;
|
||||
int x;
|
||||
|
||||
if (BOX_LEFT (*cur_rect) == BOX_RIGHT (*compare_rect))
|
||||
if (BOX_LEFT (*cur_rect) == BOX_RIGHT (*compare_rect))
|
||||
{
|
||||
/* compare_rect is to the left of cur_rect */
|
||||
x = BOX_LEFT (*cur_rect);
|
||||
@ -1950,7 +1948,7 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
* a right edge for the monitor on the left. Just fill
|
||||
* up the edges and stick 'em on the list.
|
||||
*/
|
||||
MetaEdge *new_edge = g_new (MetaEdge, 1);
|
||||
MetaEdge *new_edge = g_new (MetaEdge, 1);
|
||||
|
||||
new_edge->rect = meta_rect (x, y, width, height);
|
||||
new_edge->side_type = side_type;
|
||||
@ -1961,16 +1959,16 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
}
|
||||
|
||||
/* Check if cur might be vertically adjacent to compare */
|
||||
if (meta_rectangle_horiz_overlap(cur_rect, compare_rect))
|
||||
if (meta_rectangle_horiz_overlap (cur_rect, compare_rect))
|
||||
{
|
||||
MetaSide side_type;
|
||||
int x = MAX (cur_rect->x, compare_rect->x);
|
||||
int width = MIN (BOX_RIGHT (*cur_rect) - x,
|
||||
BOX_RIGHT (*compare_rect) - x);
|
||||
int x = MAX (cur_rect->x, compare_rect->x);
|
||||
int width = MIN (BOX_RIGHT (*cur_rect) - x,
|
||||
BOX_RIGHT (*compare_rect) - x);
|
||||
int height = 0;
|
||||
int y;
|
||||
|
||||
if (BOX_TOP (*cur_rect) == BOX_BOTTOM (*compare_rect))
|
||||
if (BOX_TOP (*cur_rect) == BOX_BOTTOM (*compare_rect))
|
||||
{
|
||||
/* compare_rect is to the top of cur_rect */
|
||||
y = BOX_TOP (*cur_rect);
|
||||
@ -2011,7 +2009,7 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
temp_rects = NULL;
|
||||
for (; all_struts; all_struts = all_struts->next)
|
||||
temp_rects = g_slist_prepend (temp_rects,
|
||||
&((MetaStrut*)all_struts->data)->rect);
|
||||
&((MetaStrut *) all_struts->data)->rect);
|
||||
ret = meta_rectangle_remove_intersections_with_boxes_from_edges (ret,
|
||||
temp_rects);
|
||||
g_slist_free (temp_rects);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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)
|
||||
{
|
||||
@ -76,7 +77,7 @@ meta_core_queue_frame_resize (Display *xdisplay,
|
||||
|
||||
static gboolean
|
||||
lower_window_and_transients (MetaWindow *window,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
||||
|
||||
@ -94,7 +95,7 @@ lower_window_and_transients (MetaWindow *window,
|
||||
meta_window_located_on_workspace (window,
|
||||
workspace_manager->active_workspace))
|
||||
{
|
||||
GList* link;
|
||||
GList *link;
|
||||
link = g_list_find (workspace_manager->active_workspace->mru_list,
|
||||
window);
|
||||
g_assert (link);
|
||||
@ -123,10 +124,10 @@ meta_core_user_lower_and_unfocus (Display *xdisplay,
|
||||
|
||||
lower_window_and_transients (window, NULL);
|
||||
|
||||
/* Rather than try to figure that out whether we just lowered
|
||||
* the focus window, assume that's always the case. (Typically,
|
||||
* this will be invoked via keyboard action or by a mouse action;
|
||||
* in either case the window or a modal child will have been focused.) */
|
||||
/* Rather than try to figure that out whether we just lowered
|
||||
* the focus window, assume that's always the case. (Typically,
|
||||
* this will be invoked via keyboard action or by a mouse action;
|
||||
* in either case the window or a modal child will have been focused.) */
|
||||
meta_workspace_focus_default_window (workspace_manager->active_workspace,
|
||||
NULL,
|
||||
timestamp);
|
||||
@ -134,7 +135,7 @@ meta_core_user_lower_and_unfocus (Display *xdisplay,
|
||||
|
||||
void
|
||||
meta_core_toggle_maximize_vertically (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
Window frame_xwindow)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
|
||||
@ -149,7 +150,7 @@ meta_core_toggle_maximize_vertically (Display *xdisplay,
|
||||
|
||||
void
|
||||
meta_core_toggle_maximize_horizontally (Display *xdisplay,
|
||||
Window frame_xwindow)
|
||||
Window frame_xwindow)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
|
||||
@ -178,12 +179,12 @@ meta_core_toggle_maximize (Display *xdisplay,
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_show_window_menu (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaWindowMenuType menu,
|
||||
int root_x,
|
||||
int root_y,
|
||||
guint32 timestamp)
|
||||
meta_core_show_window_menu (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaWindowMenuType menu,
|
||||
int root_x,
|
||||
int root_y,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
|
||||
@ -195,11 +196,11 @@ meta_core_show_window_menu (Display *xdisplay,
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_show_window_menu_for_rect (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaWindowMenuType menu,
|
||||
MetaRectangle *rect,
|
||||
guint32 timestamp)
|
||||
meta_core_show_window_menu_for_rect (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaWindowMenuType menu,
|
||||
MetaRectangle *rect,
|
||||
guint32 timestamp)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
|
||||
@ -211,16 +212,16 @@ meta_core_show_window_menu_for_rect (Display *xdisplay,
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_core_begin_grab_op (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaGrabOp op,
|
||||
gboolean pointer_already_grabbed,
|
||||
gboolean frame_action,
|
||||
int button,
|
||||
gulong modmask,
|
||||
guint32 timestamp,
|
||||
int root_x,
|
||||
int root_y)
|
||||
meta_core_begin_grab_op (Display *xdisplay,
|
||||
Window frame_xwindow,
|
||||
MetaGrabOp op,
|
||||
gboolean pointer_already_grabbed,
|
||||
gboolean frame_action,
|
||||
int button,
|
||||
gulong modmask,
|
||||
guint32 timestamp,
|
||||
int root_x,
|
||||
int root_y)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_xwindow);
|
||||
MetaDisplay *display;
|
||||
@ -268,8 +269,8 @@ meta_core_grab_buttons (Display *xdisplay,
|
||||
}
|
||||
|
||||
void
|
||||
meta_core_set_screen_cursor (Display *xdisplay,
|
||||
Window frame_on_screen,
|
||||
meta_core_set_screen_cursor (Display *xdisplay,
|
||||
Window frame_on_screen,
|
||||
MetaCursor cursor)
|
||||
{
|
||||
MetaWindow *window = get_window (xdisplay, frame_on_screen);
|
||||
|
@ -33,9 +33,9 @@
|
||||
#include "meta/workspace.h"
|
||||
|
||||
static void
|
||||
close_dialog_response_cb (MetaCloseDialog *dialog,
|
||||
MetaCloseDialogResponse response,
|
||||
MetaWindow *window)
|
||||
close_dialog_response_cb (MetaCloseDialog *dialog,
|
||||
MetaCloseDialogResponse response,
|
||||
MetaWindow *window)
|
||||
{
|
||||
if (response == META_CLOSE_DIALOG_RESPONSE_FORCE_CLOSE)
|
||||
meta_window_kill (window);
|
||||
@ -50,8 +50,9 @@ meta_window_ensure_close_dialog (MetaWindow *window)
|
||||
return;
|
||||
|
||||
display = window->display;
|
||||
window->close_dialog = meta_compositor_create_close_dialog (display->compositor,
|
||||
window);
|
||||
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);
|
||||
}
|
||||
@ -84,8 +85,8 @@ meta_window_check_alive (MetaWindow *window,
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_delete (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
meta_window_delete (MetaWindow *window,
|
||||
guint32 timestamp)
|
||||
{
|
||||
META_WINDOW_GET_CLASS (window)->delete (window, timestamp);
|
||||
|
||||
|
@ -109,11 +109,11 @@
|
||||
typedef struct
|
||||
{
|
||||
MetaWindow *window;
|
||||
guint32 serial;
|
||||
guint ping_timeout_id;
|
||||
guint32 serial;
|
||||
guint ping_timeout_id;
|
||||
} MetaPingData;
|
||||
|
||||
G_DEFINE_TYPE(MetaDisplay, meta_display, G_TYPE_OBJECT);
|
||||
G_DEFINE_TYPE (MetaDisplay, meta_display, G_TYPE_OBJECT);
|
||||
|
||||
/* Signals */
|
||||
enum
|
||||
@ -151,7 +151,8 @@ enum
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
||||
PROP_FOCUS_WINDOW
|
||||
@ -170,17 +171,17 @@ static MetaDisplay *the_display = NULL;
|
||||
static void on_monitors_changed_internal (MetaMonitorManager *monitor_manager,
|
||||
MetaDisplay *display);
|
||||
|
||||
static void prefs_changed_callback (MetaPreference pref,
|
||||
void *data);
|
||||
static void prefs_changed_callback (MetaPreference pref,
|
||||
void *data);
|
||||
|
||||
static int mru_cmp (gconstpointer a,
|
||||
gconstpointer b);
|
||||
|
||||
static void
|
||||
meta_display_get_property(GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
meta_display_get_property(GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
MetaDisplay *display = META_DISPLAY (object);
|
||||
|
||||
@ -196,10 +197,10 @@ meta_display_get_property(GObject *object,
|
||||
}
|
||||
|
||||
static void
|
||||
meta_display_set_property(GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
meta_display_set_property(GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -560,7 +561,7 @@ enable_compositor (MetaDisplay *display)
|
||||
}
|
||||
|
||||
int version = (x11_display->composite_major_version * 10) +
|
||||
x11_display->composite_minor_version;
|
||||
x11_display->composite_minor_version;
|
||||
if (version < 3)
|
||||
{
|
||||
meta_warning ("Your version of COMPOSITE is too old.");
|
||||
@ -569,7 +570,7 @@ enable_compositor (MetaDisplay *display)
|
||||
}
|
||||
|
||||
if (!display->compositor)
|
||||
display->compositor = meta_compositor_new (display);
|
||||
display->compositor = meta_compositor_new (display);
|
||||
|
||||
meta_compositor_manage (display->compositor);
|
||||
}
|
||||
@ -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_xwindow);
|
||||
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 ();
|
||||
|
||||
@ -823,9 +829,9 @@ ptrcmp (gconstpointer a, gconstpointer b)
|
||||
*
|
||||
* Return value: (transfer container): the list of windows.
|
||||
*/
|
||||
GSList*
|
||||
meta_display_list_windows (MetaDisplay *display,
|
||||
MetaListWindowsFlags flags)
|
||||
GSList *
|
||||
meta_display_list_windows (MetaDisplay *display,
|
||||
MetaListWindowsFlags flags)
|
||||
{
|
||||
GSList *winlist;
|
||||
GSList *prev;
|
||||
@ -992,14 +998,15 @@ meta_display_close (MetaDisplay *display,
|
||||
* Returns: The singleton X display, or %NULL if @xdisplay isn't the one
|
||||
* we're managing.
|
||||
*/
|
||||
MetaDisplay*
|
||||
MetaDisplay *
|
||||
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",
|
||||
xdisplay);
|
||||
meta_warning (
|
||||
"Could not find display for X display %p, probably going to crash\n",
|
||||
xdisplay);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -1012,7 +1019,7 @@ meta_display_for_x_display (Display *xdisplay)
|
||||
* Returns: The only #MetaDisplay there is. This can be %NULL, but only
|
||||
* during startup.
|
||||
*/
|
||||
MetaDisplay*
|
||||
MetaDisplay *
|
||||
meta_get_display (void)
|
||||
{
|
||||
return the_display;
|
||||
@ -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
|
||||
@ -1097,11 +1105,11 @@ meta_display_windows_are_interactable (MetaDisplay *display)
|
||||
* the result.
|
||||
*/
|
||||
gboolean
|
||||
meta_display_xserver_time_is_before (MetaDisplay *display,
|
||||
guint32 time1,
|
||||
guint32 time2)
|
||||
meta_display_xserver_time_is_before (MetaDisplay *display,
|
||||
guint32 time1,
|
||||
guint32 time2)
|
||||
{
|
||||
return XSERVER_TIME_IS_BEFORE(time1, time2);
|
||||
return XSERVER_TIME_IS_BEFORE (time1, time2);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -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 */
|
||||
@ -1179,11 +1189,11 @@ window_raise_with_delay_callback (void *data)
|
||||
if (meta_stack_get_top (window->display->stack) != window)
|
||||
{
|
||||
if (meta_window_has_pointer (window))
|
||||
meta_window_raise (window);
|
||||
meta_window_raise (window);
|
||||
else
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Pointer not inside window, not raising %s\n",
|
||||
window->desc);
|
||||
meta_topic (META_DEBUG_FOCUS,
|
||||
"Pointer not inside window, not raising %s\n",
|
||||
window->desc);
|
||||
}
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
@ -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);
|
||||
@ -1335,9 +1347,9 @@ meta_display_unregister_wayland_window (MetaDisplay *display,
|
||||
g_hash_table_remove (display->wayland_windows, window);
|
||||
}
|
||||
|
||||
MetaWindow*
|
||||
MetaWindow *
|
||||
meta_display_lookup_stamp (MetaDisplay *display,
|
||||
guint64 stamp)
|
||||
guint64 stamp)
|
||||
{
|
||||
return g_hash_table_lookup (display->stamps, &stamp);
|
||||
}
|
||||
@ -1361,13 +1373,13 @@ meta_display_unregister_stamp (MetaDisplay *display,
|
||||
g_hash_table_remove (display->stamps, &stamp);
|
||||
}
|
||||
|
||||
MetaWindow*
|
||||
MetaWindow *
|
||||
meta_display_lookup_stack_id (MetaDisplay *display,
|
||||
guint64 stack_id)
|
||||
{
|
||||
if (META_STACK_ID_IS_X11 (stack_id))
|
||||
return meta_x11_display_lookup_x_window (display->x11_display,
|
||||
(Window)stack_id);
|
||||
(Window) stack_id);
|
||||
else
|
||||
return meta_display_lookup_stamp (display, stack_id);
|
||||
}
|
||||
@ -1391,16 +1403,17 @@ 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);
|
||||
snprintf (result, sizeof (buffer[0]), "%#" G_GINT64_MODIFIER "x", stack_id);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_notify_window_created (MetaDisplay *display,
|
||||
MetaWindow *window)
|
||||
meta_display_notify_window_created (MetaDisplay *display,
|
||||
MetaWindow *window)
|
||||
{
|
||||
g_signal_emit (display, display_signals[WINDOW_CREATED], 0, window);
|
||||
}
|
||||
@ -1640,9 +1653,10 @@ 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",
|
||||
op, window->desc, display->grab_op,
|
||||
display->grab_window ? display->grab_window->desc : "none");
|
||||
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;
|
||||
@ -1861,7 +1881,7 @@ meta_display_check_threshold_reached (MetaDisplay *display,
|
||||
void
|
||||
meta_display_queue_retheme_all_windows (MetaDisplay *display)
|
||||
{
|
||||
GSList* windows;
|
||||
GSList *windows;
|
||||
GSList *tmp;
|
||||
|
||||
windows = meta_display_list_windows (display, META_LIST_DEFAULT);
|
||||
@ -1989,7 +2009,7 @@ meta_display_ping_timeout (gpointer data)
|
||||
*/
|
||||
void
|
||||
meta_display_ping_window (MetaWindow *window,
|
||||
guint32 serial)
|
||||
guint32 serial)
|
||||
{
|
||||
MetaDisplay *display = window->display;
|
||||
MetaPingData *ping_data;
|
||||
@ -2007,9 +2027,10 @@ meta_display_ping_window (MetaWindow *window,
|
||||
ping_data->window = window;
|
||||
ping_data->serial = serial;
|
||||
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");
|
||||
meta_display_ping_timeout,
|
||||
ping_data);
|
||||
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);
|
||||
|
||||
@ -2030,8 +2051,8 @@ meta_display_ping_window (MetaWindow *window,
|
||||
* reply handler function, and freeing memory.
|
||||
*/
|
||||
void
|
||||
meta_display_pong_for_serial (MetaDisplay *display,
|
||||
guint32 serial)
|
||||
meta_display_pong_for_serial (MetaDisplay *display,
|
||||
guint32 serial)
|
||||
{
|
||||
GSList *tmp;
|
||||
|
||||
@ -2074,12 +2095,19 @@ 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*
|
||||
static MetaWindow *
|
||||
find_tab_forward (MetaDisplay *display,
|
||||
MetaTabList type,
|
||||
MetaWorkspace *workspace,
|
||||
@ -2119,7 +2147,7 @@ find_tab_forward (MetaDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static MetaWindow*
|
||||
static MetaWindow *
|
||||
find_tab_backward (MetaDisplay *display,
|
||||
MetaTabList type,
|
||||
MetaWorkspace *workspace,
|
||||
@ -2164,8 +2192,8 @@ mru_cmp (gconstpointer a,
|
||||
{
|
||||
guint32 time_a, time_b;
|
||||
|
||||
time_a = meta_window_get_user_time ((MetaWindow *)a);
|
||||
time_b = meta_window_get_user_time ((MetaWindow *)b);
|
||||
time_a = meta_window_get_user_time ((MetaWindow *) a);
|
||||
time_b = meta_window_get_user_time ((MetaWindow *) b);
|
||||
|
||||
if (time_a > time_b)
|
||||
return -1;
|
||||
@ -2189,7 +2217,7 @@ mru_cmp (gconstpointer a,
|
||||
*
|
||||
* Returns: (transfer container) (element-type Meta.Window): List of windows
|
||||
*/
|
||||
GList*
|
||||
GList *
|
||||
meta_display_get_tab_list (MetaDisplay *display,
|
||||
MetaTabList type,
|
||||
MetaWorkspace *workspace)
|
||||
@ -2265,7 +2293,7 @@ meta_display_get_tab_list (MetaDisplay *display,
|
||||
* Returns: (transfer none): Next window
|
||||
*
|
||||
*/
|
||||
MetaWindow*
|
||||
MetaWindow *
|
||||
meta_display_get_tab_next (MetaDisplay *display,
|
||||
MetaTabList type,
|
||||
MetaWorkspace *workspace,
|
||||
@ -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
|
||||
{
|
||||
@ -2314,7 +2348,7 @@ meta_display_get_tab_next (MetaDisplay *display,
|
||||
* Returns: (transfer none): Current window
|
||||
*
|
||||
*/
|
||||
MetaWindow*
|
||||
MetaWindow *
|
||||
meta_display_get_tab_current (MetaDisplay *display,
|
||||
MetaTabList type,
|
||||
MetaWorkspace *workspace)
|
||||
@ -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);
|
||||
@ -2416,7 +2451,7 @@ meta_display_unmanage_windows (MetaDisplay *display,
|
||||
winlist = meta_display_list_windows (display,
|
||||
META_LIST_INCLUDE_OVERRIDE_REDIRECT);
|
||||
winlist = g_slist_sort (winlist, meta_display_stack_cmp);
|
||||
g_slist_foreach (winlist, (GFunc)g_object_ref, NULL);
|
||||
g_slist_foreach (winlist, (GFunc) g_object_ref, NULL);
|
||||
|
||||
/* Unmanage all windows */
|
||||
tmp = winlist;
|
||||
@ -2441,8 +2476,8 @@ int
|
||||
meta_display_stack_cmp (const void *a,
|
||||
const void *b)
|
||||
{
|
||||
MetaWindow *aw = (void*) a;
|
||||
MetaWindow *bw = (void*) b;
|
||||
MetaWindow *aw = (void *) a;
|
||||
MetaWindow *bw = (void *) b;
|
||||
|
||||
return meta_stack_windows_cmp (aw->display->stack, aw, bw);
|
||||
}
|
||||
@ -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,
|
||||
@ -2499,7 +2536,7 @@ meta_display_increment_focus_sentinel (MetaDisplay *display)
|
||||
display->x11_display->xroot,
|
||||
display->x11_display->atom__MUTTER_SENTINEL,
|
||||
XA_CARDINAL,
|
||||
32, PropModeReplace, (guchar*) data, 1);
|
||||
32, PropModeReplace, (guchar *) data, 1);
|
||||
|
||||
display->sentinel_counter += 1;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -2627,7 +2665,7 @@ meta_display_supports_extended_barriers (MetaDisplay *display)
|
||||
if (META_IS_BACKEND_X11 (meta_get_backend ()))
|
||||
{
|
||||
return (META_X11_DISPLAY_HAS_XINPUT_23 (display->x11_display) &&
|
||||
!meta_is_wayland_compositor());
|
||||
!meta_is_wayland_compositor ());
|
||||
}
|
||||
|
||||
g_assert_not_reached ();
|
||||
@ -2747,11 +2785,11 @@ meta_display_request_restart (MetaDisplay *display)
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_display_show_resize_popup (MetaDisplay *display,
|
||||
gboolean show,
|
||||
meta_display_show_resize_popup (MetaDisplay *display,
|
||||
gboolean show,
|
||||
MetaRectangle *rect,
|
||||
int display_w,
|
||||
int display_h)
|
||||
int display_w,
|
||||
int display_h)
|
||||
{
|
||||
gboolean result = FALSE;
|
||||
|
||||
@ -2812,8 +2850,9 @@ 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,
|
||||
pad);
|
||||
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,8 +2902,9 @@ 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,
|
||||
compositor->seat);
|
||||
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)
|
||||
{
|
||||
@ -2954,10 +2996,10 @@ meta_display_notify_pad_group_switch (MetaDisplay *display,
|
||||
}
|
||||
|
||||
void
|
||||
meta_display_foreach_window (MetaDisplay *display,
|
||||
MetaListWindowsFlags flags,
|
||||
MetaDisplayWindowFunc func,
|
||||
gpointer data)
|
||||
meta_display_foreach_window (MetaDisplay *display,
|
||||
MetaListWindowsFlags flags,
|
||||
MetaDisplayWindowFunc func,
|
||||
gpointer data)
|
||||
{
|
||||
GSList *windows;
|
||||
|
||||
@ -3086,7 +3128,7 @@ meta_display_update_tile_preview (MetaDisplay *display,
|
||||
if (display->tile_preview_timeout_id > 0)
|
||||
g_source_remove (display->tile_preview_timeout_id);
|
||||
|
||||
meta_display_update_tile_preview_timeout ((gpointer)display);
|
||||
meta_display_update_tile_preview_timeout ((gpointer) display);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,9 +3433,10 @@ void
|
||||
meta_display_queue_check_fullscreen (MetaDisplay *display)
|
||||
{
|
||||
if (!display->check_fullscreen_later)
|
||||
display->check_fullscreen_later = meta_later_add (META_LATER_CHECK_FULLSCREEN,
|
||||
check_fullscreen_func,
|
||||
display, NULL);
|
||||
display->check_fullscreen_later = meta_later_add (
|
||||
META_LATER_CHECK_FULLSCREEN,
|
||||
check_fullscreen_func,
|
||||
display, NULL);
|
||||
}
|
||||
|
||||
int
|
||||
@ -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 *
|
||||
|
@ -33,20 +33,20 @@
|
||||
*/
|
||||
#define WINDOW_EDGES_RELEVANT(window, display) \
|
||||
meta_window_should_be_showing (window) && \
|
||||
window != display->grab_window && \
|
||||
window->type != META_WINDOW_DESKTOP && \
|
||||
window->type != META_WINDOW_MENU && \
|
||||
window->type != META_WINDOW_SPLASHSCREEN
|
||||
window != display->grab_window && \
|
||||
window->type != META_WINDOW_DESKTOP && \
|
||||
window->type != META_WINDOW_MENU && \
|
||||
window->type != META_WINDOW_SPLASHSCREEN
|
||||
|
||||
struct ResistanceDataForAnEdge
|
||||
{
|
||||
gboolean timeout_setup;
|
||||
guint timeout_id;
|
||||
int timeout_edge_pos;
|
||||
gboolean timeout_over;
|
||||
GSourceFunc timeout_func;
|
||||
MetaWindow *window;
|
||||
int keyboard_buildup;
|
||||
gboolean timeout_setup;
|
||||
guint timeout_id;
|
||||
int timeout_edge_pos;
|
||||
gboolean timeout_over;
|
||||
GSourceFunc timeout_func;
|
||||
MetaWindow *window;
|
||||
int keyboard_buildup;
|
||||
};
|
||||
typedef struct ResistanceDataForAnEdge ResistanceDataForAnEdge;
|
||||
|
||||
@ -96,17 +96,17 @@ find_index_of_edge_near_position (const GArray *edges,
|
||||
/* Initialize mid, edge, & compare in the off change that the array only
|
||||
* has one element.
|
||||
*/
|
||||
mid = 0;
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
mid = 0;
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
|
||||
/* Begin the search... */
|
||||
low = 0;
|
||||
low = 0;
|
||||
high = edges->len - 1;
|
||||
while (low < high)
|
||||
{
|
||||
mid = low + (high - low)/2;
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
mid = low + (high - low) / 2;
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
|
||||
if (compare == position)
|
||||
@ -130,13 +130,13 @@ find_index_of_edge_near_position (const GArray *edges,
|
||||
while (compare >= position && mid > 0)
|
||||
{
|
||||
mid--;
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
}
|
||||
while (compare < position && mid < (int)edges->len - 1)
|
||||
while (compare < position && mid < (int) edges->len - 1)
|
||||
{
|
||||
mid++;
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
}
|
||||
|
||||
@ -149,16 +149,16 @@ find_index_of_edge_near_position (const GArray *edges,
|
||||
}
|
||||
else
|
||||
{
|
||||
while (compare <= position && mid < (int)edges->len - 1)
|
||||
while (compare <= position && mid < (int) edges->len - 1)
|
||||
{
|
||||
mid++;
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
}
|
||||
while (compare > position && mid > 0)
|
||||
{
|
||||
mid--;
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
}
|
||||
|
||||
@ -199,17 +199,17 @@ find_nearest_position (const GArray *edges,
|
||||
/* Initialize mid, edge, & compare in the off change that the array only
|
||||
* has one element.
|
||||
*/
|
||||
mid = 0;
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
mid = 0;
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
|
||||
/* Begin the search... */
|
||||
low = 0;
|
||||
low = 0;
|
||||
high = edges->len - 1;
|
||||
while (low < high)
|
||||
{
|
||||
mid = low + (high - low)/2;
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
mid = low + (high - low) / 2;
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
|
||||
if (compare == position)
|
||||
@ -229,7 +229,7 @@ find_nearest_position (const GArray *edges,
|
||||
best_dist = INT_MAX;
|
||||
|
||||
/* Start the search at mid */
|
||||
edge = g_array_index (edges, MetaEdge*, mid);
|
||||
edge = g_array_index (edges, MetaEdge *, mid);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
edges_align = meta_rectangle_edge_aligns (new_rect, edge);
|
||||
if (edges_align &&
|
||||
@ -244,14 +244,14 @@ find_nearest_position (const GArray *edges,
|
||||
}
|
||||
|
||||
/* Now start searching higher than mid */
|
||||
for (i = mid + 1; i < (int)edges->len; i++)
|
||||
for (i = mid + 1; i < (int) edges->len; i++)
|
||||
{
|
||||
edge = g_array_index (edges, MetaEdge*, i);
|
||||
edge = g_array_index (edges, MetaEdge *, i);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
|
||||
edges_align = horizontal ?
|
||||
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
|
||||
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
|
||||
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
|
||||
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
|
||||
|
||||
if (edges_align &&
|
||||
(!only_forward ||
|
||||
@ -268,14 +268,14 @@ find_nearest_position (const GArray *edges,
|
||||
}
|
||||
|
||||
/* Now start searching lower than mid */
|
||||
for (i = mid-1; i >= 0; i--)
|
||||
for (i = mid - 1; i >= 0; i--)
|
||||
{
|
||||
edge = g_array_index (edges, MetaEdge*, i);
|
||||
edge = g_array_index (edges, MetaEdge *, i);
|
||||
compare = horizontal ? edge->rect.x : edge->rect.y;
|
||||
|
||||
edges_align = horizontal ?
|
||||
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
|
||||
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
|
||||
meta_rectangle_vert_overlap (&edge->rect, new_rect) :
|
||||
meta_rectangle_horiz_overlap (&edge->rect, new_rect);
|
||||
|
||||
if (edges_align &&
|
||||
(!only_forward ||
|
||||
@ -324,31 +324,31 @@ edge_resistance_timeout (gpointer data)
|
||||
}
|
||||
|
||||
static int
|
||||
apply_edge_resistance (MetaWindow *window,
|
||||
int old_pos,
|
||||
int new_pos,
|
||||
const MetaRectangle *old_rect,
|
||||
const MetaRectangle *new_rect,
|
||||
GArray *edges,
|
||||
ResistanceDataForAnEdge *resistance_data,
|
||||
GSourceFunc timeout_func,
|
||||
gboolean xdir,
|
||||
gboolean keyboard_op)
|
||||
apply_edge_resistance (MetaWindow *window,
|
||||
int old_pos,
|
||||
int new_pos,
|
||||
const MetaRectangle *old_rect,
|
||||
const MetaRectangle *new_rect,
|
||||
GArray *edges,
|
||||
ResistanceDataForAnEdge *resistance_data,
|
||||
GSourceFunc timeout_func,
|
||||
gboolean xdir,
|
||||
gboolean keyboard_op)
|
||||
{
|
||||
int i, begin, end;
|
||||
int last_edge;
|
||||
gboolean increasing = new_pos > old_pos;
|
||||
int increment = increasing ? 1 : -1;
|
||||
int increment = increasing ? 1 : -1;
|
||||
|
||||
const int PIXEL_DISTANCE_THRESHOLD_TOWARDS_WINDOW = 16;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_AWAYFROM_WINDOW = 0;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_TOWARDS_MONITOR = 32;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_AWAYFROM_MONITOR = 0;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_TOWARDS_SCREEN = 32;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_AWAYFROM_SCREEN = 0;
|
||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_WINDOW = 0;
|
||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_MONITOR = 0;
|
||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_SCREEN = 0;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_TOWARDS_WINDOW = 16;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_AWAYFROM_WINDOW = 0;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_TOWARDS_MONITOR = 32;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_AWAYFROM_MONITOR = 0;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_TOWARDS_SCREEN = 32;
|
||||
const int PIXEL_DISTANCE_THRESHOLD_AWAYFROM_SCREEN = 0;
|
||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_WINDOW = 0;
|
||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_MONITOR = 0;
|
||||
const int TIMEOUT_RESISTANCE_LENGTH_MS_SCREEN = 0;
|
||||
|
||||
/* Quit if no movement was specified */
|
||||
if (old_pos == new_pos)
|
||||
@ -357,7 +357,7 @@ apply_edge_resistance (MetaWindow *window,
|
||||
/* Remove the old timeout if it's no longer relevant */
|
||||
if (resistance_data->timeout_setup &&
|
||||
((resistance_data->timeout_edge_pos > old_pos &&
|
||||
resistance_data->timeout_edge_pos > new_pos) ||
|
||||
resistance_data->timeout_edge_pos > new_pos) ||
|
||||
(resistance_data->timeout_edge_pos < old_pos &&
|
||||
resistance_data->timeout_edge_pos < new_pos)))
|
||||
{
|
||||
@ -370,27 +370,27 @@ apply_edge_resistance (MetaWindow *window,
|
||||
}
|
||||
|
||||
/* Get the range of indices in the edge array that we move past/to. */
|
||||
begin = find_index_of_edge_near_position (edges, old_pos, increasing, xdir);
|
||||
end = find_index_of_edge_near_position (edges, new_pos, !increasing, xdir);
|
||||
begin = find_index_of_edge_near_position (edges, old_pos, increasing, xdir);
|
||||
end = find_index_of_edge_near_position (edges, new_pos, !increasing, xdir);
|
||||
|
||||
/* begin and end can be outside the array index, if the window is partially
|
||||
* off the screen
|
||||
*/
|
||||
last_edge = edges->len - 1;
|
||||
begin = CLAMP (begin, 0, last_edge);
|
||||
end = CLAMP (end, 0, last_edge);
|
||||
end = CLAMP (end, 0, last_edge);
|
||||
|
||||
/* Loop over all these edges we're moving past/to. */
|
||||
i = begin;
|
||||
while ((increasing && i <= end) ||
|
||||
while ((increasing && i <= end) ||
|
||||
(!increasing && i >= end))
|
||||
{
|
||||
gboolean edges_align;
|
||||
MetaEdge *edge = g_array_index (edges, MetaEdge*, i);
|
||||
int compare = xdir ? edge->rect.x : edge->rect.y;
|
||||
gboolean edges_align;
|
||||
MetaEdge *edge = g_array_index (edges, MetaEdge *, i);
|
||||
int compare = xdir ? edge->rect.x : edge->rect.y;
|
||||
|
||||
/* Find out if this edge is relevant */
|
||||
edges_align = meta_rectangle_edge_aligns (new_rect, edge) ||
|
||||
edges_align = meta_rectangle_edge_aligns (new_rect, edge) ||
|
||||
meta_rectangle_edge_aligns (old_rect, edge);
|
||||
|
||||
/* Nothing to do unless the edges align */
|
||||
@ -550,8 +550,8 @@ apply_edge_resistance_to_each_side (MetaDisplay *display,
|
||||
gboolean is_resize)
|
||||
{
|
||||
MetaEdgeResistanceData *edge_data;
|
||||
MetaRectangle modified_rect;
|
||||
gboolean modified;
|
||||
MetaRectangle modified_rect;
|
||||
gboolean modified;
|
||||
int new_left, new_right, new_top, new_bottom;
|
||||
|
||||
if (display->grab_edge_resistance_data == NULL)
|
||||
@ -566,26 +566,26 @@ apply_edge_resistance_to_each_side (MetaDisplay *display,
|
||||
* sides of windows to both left and right edges.
|
||||
*/
|
||||
|
||||
new_left = apply_edge_snapping (BOX_LEFT (*old_outer),
|
||||
BOX_LEFT (*new_outer),
|
||||
new_outer,
|
||||
edge_data->left_edges,
|
||||
TRUE,
|
||||
keyboard_op);
|
||||
new_left = apply_edge_snapping (BOX_LEFT (*old_outer),
|
||||
BOX_LEFT (*new_outer),
|
||||
new_outer,
|
||||
edge_data->left_edges,
|
||||
TRUE,
|
||||
keyboard_op);
|
||||
|
||||
new_right = apply_edge_snapping (BOX_RIGHT (*old_outer),
|
||||
BOX_RIGHT (*new_outer),
|
||||
new_outer,
|
||||
edge_data->right_edges,
|
||||
TRUE,
|
||||
keyboard_op);
|
||||
new_right = apply_edge_snapping (BOX_RIGHT (*old_outer),
|
||||
BOX_RIGHT (*new_outer),
|
||||
new_outer,
|
||||
edge_data->right_edges,
|
||||
TRUE,
|
||||
keyboard_op);
|
||||
|
||||
new_top = apply_edge_snapping (BOX_TOP (*old_outer),
|
||||
BOX_TOP (*new_outer),
|
||||
new_outer,
|
||||
edge_data->top_edges,
|
||||
FALSE,
|
||||
keyboard_op);
|
||||
new_top = apply_edge_snapping (BOX_TOP (*old_outer),
|
||||
BOX_TOP (*new_outer),
|
||||
new_outer,
|
||||
edge_data->top_edges,
|
||||
FALSE,
|
||||
keyboard_op);
|
||||
|
||||
new_bottom = apply_edge_snapping (BOX_BOTTOM (*old_outer),
|
||||
BOX_BOTTOM (*new_outer),
|
||||
@ -600,13 +600,13 @@ apply_edge_resistance_to_each_side (MetaDisplay *display,
|
||||
guint i;
|
||||
|
||||
const gfloat tile_edges[] =
|
||||
{
|
||||
1./4.,
|
||||
1./3.,
|
||||
1./2.,
|
||||
2./3.,
|
||||
3./4.,
|
||||
};
|
||||
{
|
||||
1. / 4.,
|
||||
1. / 3.,
|
||||
1. / 2.,
|
||||
2. / 3.,
|
||||
3. / 4.,
|
||||
};
|
||||
|
||||
meta_window_get_work_area_current_monitor (window, &workarea);
|
||||
|
||||
@ -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)
|
||||
{
|
||||
@ -647,45 +648,45 @@ apply_edge_resistance_to_each_side (MetaDisplay *display,
|
||||
if (!is_resize || window->size_hints.width_inc == 1)
|
||||
{
|
||||
/* Now, apply the normal horizontal edge resistance */
|
||||
new_left = apply_edge_resistance (window,
|
||||
BOX_LEFT (*old_outer),
|
||||
BOX_LEFT (*new_outer),
|
||||
old_outer,
|
||||
new_outer,
|
||||
edge_data->left_edges,
|
||||
&edge_data->left_data,
|
||||
timeout_func,
|
||||
TRUE,
|
||||
keyboard_op);
|
||||
new_right = apply_edge_resistance (window,
|
||||
BOX_RIGHT (*old_outer),
|
||||
BOX_RIGHT (*new_outer),
|
||||
old_outer,
|
||||
new_outer,
|
||||
edge_data->right_edges,
|
||||
&edge_data->right_data,
|
||||
timeout_func,
|
||||
TRUE,
|
||||
keyboard_op);
|
||||
new_left = apply_edge_resistance (window,
|
||||
BOX_LEFT (*old_outer),
|
||||
BOX_LEFT (*new_outer),
|
||||
old_outer,
|
||||
new_outer,
|
||||
edge_data->left_edges,
|
||||
&edge_data->left_data,
|
||||
timeout_func,
|
||||
TRUE,
|
||||
keyboard_op);
|
||||
new_right = apply_edge_resistance (window,
|
||||
BOX_RIGHT (*old_outer),
|
||||
BOX_RIGHT (*new_outer),
|
||||
old_outer,
|
||||
new_outer,
|
||||
edge_data->right_edges,
|
||||
&edge_data->right_data,
|
||||
timeout_func,
|
||||
TRUE,
|
||||
keyboard_op);
|
||||
}
|
||||
else
|
||||
{
|
||||
new_left = new_outer->x;
|
||||
new_left = new_outer->x;
|
||||
new_right = new_outer->x + new_outer->width;
|
||||
}
|
||||
/* Same for vertical resizes... */
|
||||
if (!is_resize || window->size_hints.height_inc == 1)
|
||||
{
|
||||
new_top = apply_edge_resistance (window,
|
||||
BOX_TOP (*old_outer),
|
||||
BOX_TOP (*new_outer),
|
||||
old_outer,
|
||||
new_outer,
|
||||
edge_data->top_edges,
|
||||
&edge_data->top_data,
|
||||
timeout_func,
|
||||
FALSE,
|
||||
keyboard_op);
|
||||
new_top = apply_edge_resistance (window,
|
||||
BOX_TOP (*old_outer),
|
||||
BOX_TOP (*new_outer),
|
||||
old_outer,
|
||||
new_outer,
|
||||
edge_data->top_edges,
|
||||
&edge_data->top_data,
|
||||
timeout_func,
|
||||
FALSE,
|
||||
keyboard_op);
|
||||
new_bottom = apply_edge_resistance (window,
|
||||
BOX_BOTTOM (*old_outer),
|
||||
BOX_BOTTOM (*new_outer),
|
||||
@ -699,7 +700,7 @@ apply_edge_resistance_to_each_side (MetaDisplay *display,
|
||||
}
|
||||
else
|
||||
{
|
||||
new_top = new_outer->y;
|
||||
new_top = new_outer->y;
|
||||
new_bottom = new_outer->y + new_outer->height;
|
||||
}
|
||||
}
|
||||
@ -717,7 +718,7 @@ apply_edge_resistance_to_each_side (MetaDisplay *display,
|
||||
void
|
||||
meta_display_cleanup_edges (MetaDisplay *display)
|
||||
{
|
||||
guint i,j;
|
||||
guint i, j;
|
||||
MetaEdgeResistanceData *edge_data = display->grab_edge_resistance_data;
|
||||
GHashTable *edges_to_be_freed;
|
||||
|
||||
@ -755,7 +756,7 @@ meta_display_cleanup_edges (MetaDisplay *display)
|
||||
|
||||
for (j = 0; j < tmp->len; j++)
|
||||
{
|
||||
MetaEdge *edge = g_array_index (tmp, MetaEdge*, j);
|
||||
MetaEdge *edge = g_array_index (tmp, MetaEdge *, j);
|
||||
if (edge->edge_type == META_EDGE_WINDOW &&
|
||||
edge->side_type == side)
|
||||
{
|
||||
@ -783,14 +784,14 @@ meta_display_cleanup_edges (MetaDisplay *display)
|
||||
edge_data->bottom_edges = NULL;
|
||||
|
||||
/* Cleanup the timeouts */
|
||||
if (edge_data->left_data.timeout_setup &&
|
||||
edge_data->left_data.timeout_id != 0)
|
||||
if (edge_data->left_data.timeout_setup &&
|
||||
edge_data->left_data.timeout_id != 0)
|
||||
g_source_remove (edge_data->left_data.timeout_id);
|
||||
if (edge_data->right_data.timeout_setup &&
|
||||
edge_data->right_data.timeout_id != 0)
|
||||
if (edge_data->right_data.timeout_setup &&
|
||||
edge_data->right_data.timeout_id != 0)
|
||||
g_source_remove (edge_data->right_data.timeout_id);
|
||||
if (edge_data->top_data.timeout_setup &&
|
||||
edge_data->top_data.timeout_id != 0)
|
||||
if (edge_data->top_data.timeout_setup &&
|
||||
edge_data->top_data.timeout_id != 0)
|
||||
g_source_remove (edge_data->top_data.timeout_id);
|
||||
if (edge_data->bottom_data.timeout_setup &&
|
||||
edge_data->bottom_data.timeout_id != 0)
|
||||
@ -811,9 +812,9 @@ stupid_sort_requiring_extra_pointer_dereference (gconstpointer a,
|
||||
|
||||
static void
|
||||
cache_edges (MetaDisplay *display,
|
||||
GList *window_edges,
|
||||
GList *monitor_edges,
|
||||
GList *screen_edges)
|
||||
GList *window_edges,
|
||||
GList *monitor_edges,
|
||||
GList *screen_edges)
|
||||
{
|
||||
MetaEdgeResistanceData *edge_data;
|
||||
GList *tmp;
|
||||
@ -824,12 +825,12 @@ cache_edges (MetaDisplay *display,
|
||||
* 0th: Print debugging information to the log about the edges
|
||||
*/
|
||||
#ifdef WITH_VERBOSE_MODE
|
||||
if (meta_is_verbose())
|
||||
if (meta_is_verbose ())
|
||||
{
|
||||
int max_edges = MAX (MAX( g_list_length (window_edges),
|
||||
int max_edges = MAX (MAX (g_list_length (window_edges),
|
||||
g_list_length (monitor_edges)),
|
||||
g_list_length (screen_edges));
|
||||
char big_buffer[(EDGE_LENGTH+2)*max_edges];
|
||||
char big_buffer[(EDGE_LENGTH + 2) * max_edges];
|
||||
|
||||
meta_rectangle_edge_list_to_string (window_edges, ", ", big_buffer);
|
||||
meta_topic (META_DEBUG_EDGE_RESISTANCE,
|
||||
@ -897,21 +898,21 @@ cache_edges (MetaDisplay *display,
|
||||
g_assert (display->grab_edge_resistance_data == NULL);
|
||||
display->grab_edge_resistance_data = g_new0 (MetaEdgeResistanceData, 1);
|
||||
edge_data = display->grab_edge_resistance_data;
|
||||
edge_data->left_edges = g_array_sized_new (FALSE,
|
||||
FALSE,
|
||||
sizeof(MetaEdge*),
|
||||
num_left + num_right);
|
||||
edge_data->right_edges = g_array_sized_new (FALSE,
|
||||
FALSE,
|
||||
sizeof(MetaEdge*),
|
||||
num_left + num_right);
|
||||
edge_data->top_edges = g_array_sized_new (FALSE,
|
||||
FALSE,
|
||||
sizeof(MetaEdge*),
|
||||
num_top + num_bottom);
|
||||
edge_data->left_edges = g_array_sized_new (FALSE,
|
||||
FALSE,
|
||||
sizeof (MetaEdge *),
|
||||
num_left + num_right);
|
||||
edge_data->right_edges = g_array_sized_new (FALSE,
|
||||
FALSE,
|
||||
sizeof (MetaEdge *),
|
||||
num_left + num_right);
|
||||
edge_data->top_edges = g_array_sized_new (FALSE,
|
||||
FALSE,
|
||||
sizeof (MetaEdge *),
|
||||
num_top + num_bottom);
|
||||
edge_data->bottom_edges = g_array_sized_new (FALSE,
|
||||
FALSE,
|
||||
sizeof(MetaEdge*),
|
||||
sizeof (MetaEdge *),
|
||||
num_top + num_bottom);
|
||||
|
||||
/*
|
||||
@ -978,14 +979,14 @@ initialize_grab_edge_resistance_data (MetaDisplay *display)
|
||||
{
|
||||
MetaEdgeResistanceData *edge_data = display->grab_edge_resistance_data;
|
||||
|
||||
edge_data->left_data.timeout_setup = FALSE;
|
||||
edge_data->right_data.timeout_setup = FALSE;
|
||||
edge_data->top_data.timeout_setup = FALSE;
|
||||
edge_data->left_data.timeout_setup = FALSE;
|
||||
edge_data->right_data.timeout_setup = FALSE;
|
||||
edge_data->top_data.timeout_setup = FALSE;
|
||||
edge_data->bottom_data.timeout_setup = FALSE;
|
||||
|
||||
edge_data->left_data.keyboard_buildup = 0;
|
||||
edge_data->right_data.keyboard_buildup = 0;
|
||||
edge_data->top_data.keyboard_buildup = 0;
|
||||
edge_data->left_data.keyboard_buildup = 0;
|
||||
edge_data->right_data.keyboard_buildup = 0;
|
||||
edge_data->top_data.keyboard_buildup = 0;
|
||||
edge_data->bottom_data.keyboard_buildup = 0;
|
||||
}
|
||||
|
||||
@ -1055,8 +1056,8 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
|
||||
cur_window_iter = stacked_windows;
|
||||
while (cur_window_iter != NULL)
|
||||
{
|
||||
MetaRectangle cur_rect;
|
||||
MetaWindow *cur_window = cur_window_iter->data;
|
||||
MetaRectangle cur_rect;
|
||||
MetaWindow *cur_window = cur_window_iter->data;
|
||||
meta_window_get_frame_rect (cur_window, &cur_rect);
|
||||
|
||||
/* Check if we want to use this window's edges for edge
|
||||
@ -1132,7 +1133,7 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
|
||||
while (rem_win_stacking &&
|
||||
stack_position >= GPOINTER_TO_INT (rem_win_stacking->data))
|
||||
{
|
||||
rem_windows = rem_windows->next;
|
||||
rem_windows = rem_windows->next;
|
||||
rem_win_stacking = rem_win_stacking->next;
|
||||
}
|
||||
|
||||
@ -1160,7 +1161,7 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
|
||||
* to free a list instead of four ugly ones?
|
||||
*/
|
||||
g_slist_foreach (obscuring_windows,
|
||||
(void (*)(gpointer,gpointer))&g_free, /* ew, for ugly */
|
||||
(void (*)(gpointer, gpointer)) & g_free, /* ew, for ugly */
|
||||
NULL);
|
||||
g_slist_free (obscuring_windows);
|
||||
|
||||
@ -1187,12 +1188,12 @@ compute_resistance_and_snapping_edges (MetaDisplay *display)
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
int *new_x,
|
||||
int *new_y,
|
||||
GSourceFunc timeout_func,
|
||||
gboolean snap,
|
||||
gboolean is_keyboard_op)
|
||||
meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
int *new_x,
|
||||
int *new_y,
|
||||
GSourceFunc timeout_func,
|
||||
gboolean snap,
|
||||
gboolean is_keyboard_op)
|
||||
{
|
||||
MetaRectangle old_outer, proposed_outer, new_outer;
|
||||
gboolean is_resize;
|
||||
@ -1230,9 +1231,9 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
else
|
||||
reference = &old_outer;
|
||||
|
||||
left_change = BOX_LEFT (new_outer) - BOX_LEFT (*reference);
|
||||
left_change = BOX_LEFT (new_outer) - BOX_LEFT (*reference);
|
||||
right_change = BOX_RIGHT (new_outer) - BOX_RIGHT (*reference);
|
||||
if ( snap && is_keyboard_op && left_change == 0)
|
||||
if (snap && is_keyboard_op && left_change == 0)
|
||||
smaller_x_change = right_change;
|
||||
else if (snap && is_keyboard_op && right_change == 0)
|
||||
smaller_x_change = left_change;
|
||||
@ -1241,9 +1242,9 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
else
|
||||
smaller_x_change = right_change;
|
||||
|
||||
top_change = BOX_TOP (new_outer) - BOX_TOP (*reference);
|
||||
top_change = BOX_TOP (new_outer) - BOX_TOP (*reference);
|
||||
bottom_change = BOX_BOTTOM (new_outer) - BOX_BOTTOM (*reference);
|
||||
if ( snap && is_keyboard_op && top_change == 0)
|
||||
if (snap && is_keyboard_op && top_change == 0)
|
||||
smaller_y_change = bottom_change;
|
||||
else if (snap && is_keyboard_op && bottom_change == 0)
|
||||
smaller_y_change = top_change;
|
||||
@ -1253,9 +1254,9 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
smaller_y_change = bottom_change;
|
||||
|
||||
*new_x = old_outer.x + smaller_x_change +
|
||||
(BOX_LEFT (*reference) - BOX_LEFT (old_outer));
|
||||
(BOX_LEFT (*reference) - BOX_LEFT (old_outer));
|
||||
*new_y = old_outer.y + smaller_y_change +
|
||||
(BOX_TOP (*reference) - BOX_TOP (old_outer));
|
||||
(BOX_TOP (*reference) - BOX_TOP (old_outer));
|
||||
|
||||
meta_topic (META_DEBUG_EDGE_RESISTANCE,
|
||||
"outer x & y move-to coordinate changed from %d,%d to %d,%d\n",
|
||||
@ -1265,19 +1266,19 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_edge_resistance_for_resize (MetaWindow *window,
|
||||
int *new_width,
|
||||
int *new_height,
|
||||
int gravity,
|
||||
GSourceFunc timeout_func,
|
||||
gboolean snap,
|
||||
gboolean is_keyboard_op)
|
||||
meta_window_edge_resistance_for_resize (MetaWindow *window,
|
||||
int *new_width,
|
||||
int *new_height,
|
||||
int gravity,
|
||||
GSourceFunc timeout_func,
|
||||
gboolean snap,
|
||||
gboolean is_keyboard_op)
|
||||
{
|
||||
MetaRectangle old_outer, new_outer;
|
||||
int proposed_outer_width, proposed_outer_height;
|
||||
|
||||
meta_window_get_frame_rect (window, &old_outer);
|
||||
proposed_outer_width = *new_width;
|
||||
proposed_outer_width = *new_width;
|
||||
proposed_outer_height = *new_height;
|
||||
meta_rectangle_resize_with_gravity (&old_outer,
|
||||
&new_outer,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user