809
822
g_object_notify (G_OBJECT (global), "screen-height");
813
global_stage_before_paint (ClutterStage *stage,
826
global_stage_before_paint (gpointer data)
816
828
shell_perf_log_event (shell_perf_log_get_default (),
817
829
"clutter.stagePaintStart");
821
global_stage_after_paint (ClutterStage *stage,
835
global_stage_after_paint (gpointer data)
824
837
shell_perf_log_event (shell_perf_log_get_default (),
825
838
"clutter.stagePaintDone");
829
shell_fonts_init (ClutterStage *stage)
831
CoglPangoFontMap *fontmap;
833
/* Disable text mipmapping; it causes problems on pre-GEM Intel
834
* drivers and we should just be rendering text at the right
835
* size rather than scaling it. If we do effects where we dynamically
836
* zoom labels, then we might want to reconsider.
838
fontmap = COGL_PANGO_FONT_MAP (clutter_get_font_map ());
839
cogl_pango_font_map_set_use_mipmapping (fontmap, FALSE);
842
843
/* This is an IBus workaround. The flow of events with IBus is that every time
1027
1029
meta_plugin_end_modal (global->plugin, timestamp);
1031
* shell_global_create_pointer_barrier:
1032
* @global: a #ShellGlobal
1033
* @x1: left X coordinate
1034
* @y1: top Y coordinate
1035
* @x2: right X coordinate
1036
* @y2: bottom Y coordinate
1037
* @directions: The directions we're allowed to pass through
1039
* If supported by X creates a pointer barrier.
1041
* Return value: value you can pass to shell_global_destroy_pointer_barrier()
1044
shell_global_create_pointer_barrier (ShellGlobal *global,
1045
int x1, int y1, int x2, int y2,
1048
#if HAVE_XFIXESCREATEPOINTERBARRIER
1050
XFixesCreatePointerBarrier (global->xdisplay,
1051
DefaultRootWindow (global->xdisplay),
1062
* shell_global_destroy_pointer_barrier:
1063
* @global: a #ShellGlobal
1064
* @barrier: a pointer barrier
1066
* Destroys the @barrier created by shell_global_create_pointer_barrier().
1069
shell_global_destroy_pointer_barrier (ShellGlobal *global, guint32 barrier)
1071
#if HAVE_XFIXESCREATEPOINTERBARRIER
1072
g_return_if_fail (barrier > 0);
1074
XFixesDestroyPointerBarrier (global->xdisplay, (PointerBarrier)barrier);
1078
1032
/* Code to close all file descriptors before we exec; copied from gspawn.c in GLib.
1080
1034
* Authors: Padraig O'Briain, Matthias Clasen, Lennart Poettering
1617
1562
schedule_leisure_functions (global);
1566
build_ca_proplist_for_event (ca_proplist *props,
1567
const char *event_property,
1568
const char *event_id,
1569
const char *event_description,
1570
ClutterEvent *for_event)
1572
ca_proplist_sets (props, event_property, event_id);
1573
ca_proplist_sets (props, CA_PROP_EVENT_DESCRIPTION, event_description);
1574
ca_proplist_sets (props, CA_PROP_CANBERRA_CACHE_CONTROL, "volatile");
1578
if (clutter_event_type (for_event) != CLUTTER_KEY_PRESS &&
1579
clutter_event_type (for_event) != CLUTTER_KEY_RELEASE)
1583
clutter_event_get_position (for_event, &point);
1585
ca_proplist_setf (props, CA_PROP_EVENT_MOUSE_X, "%d", (int)point.x);
1586
ca_proplist_setf (props, CA_PROP_EVENT_MOUSE_Y, "%d", (int)point.y);
1589
if (clutter_event_type (for_event) == CLUTTER_BUTTON_PRESS ||
1590
clutter_event_type (for_event) == CLUTTER_BUTTON_RELEASE)
1594
button = clutter_event_get_button (for_event);
1595
ca_proplist_setf (props, CA_PROP_EVENT_MOUSE_BUTTON, "%d", button);
1621
1601
* shell_global_play_theme_sound:
1622
1602
* @global: the #ShellGlobal
1623
1603
* @id: an id, used to cancel later (0 if not needed)
1624
1604
* @name: the sound name
1626
* Plays a simple sound picked according to Freedesktop sound theme.
1627
* Really just a workaround for libcanberra not being introspected.
1630
shell_global_play_theme_sound (ShellGlobal *global,
1634
ca_context_play (global->sound_context, id, CA_PROP_EVENT_ID, name, NULL);
1605
* @for_event: (allow-none): a #ClutterEvent in response to which the sound is played
1607
* Plays a simple sound picked according to Freedesktop sound theme.
1608
* Really just a workaround for libcanberra not being introspected.
1611
shell_global_play_theme_sound (ShellGlobal *global,
1614
const char *description,
1615
ClutterEvent *for_event)
1619
ca_proplist_create (&props);
1620
build_ca_proplist_for_event (props, CA_PROP_EVENT_ID, name, description, for_event);
1622
ca_context_play_full (global->sound_context, id, props, NULL, NULL);
1624
ca_proplist_destroy (props);
1628
* shell_global_play_theme_sound_full:
1629
* @global: the #ShellGlobal
1630
* @id: an id, used to cancel later (0 if not needed)
1631
* @name: the sound name
1632
* @description: the localized description of the event that triggered this alert
1633
* @for_event: (allow-none): a #ClutterEvent in response to which the sound is played
1634
* @application_id: application on behalf of which the sound is played
1635
* @application_name:
1637
* Plays a simple sound picked according to Freedesktop sound theme.
1638
* Really just a workaround for libcanberra not being introspected.
1641
shell_global_play_theme_sound_full (ShellGlobal *global,
1644
const char *description,
1645
ClutterEvent *for_event,
1646
const char *application_id,
1647
const char *application_name)
1651
ca_proplist_create (&props);
1652
build_ca_proplist_for_event (props, CA_PROP_EVENT_ID, name, description, for_event);
1653
ca_proplist_sets (props, CA_PROP_APPLICATION_ID, application_id);
1654
ca_proplist_sets (props, CA_PROP_APPLICATION_NAME, application_name);
1656
ca_context_play_full (global->sound_context, id, props, NULL, NULL);
1658
ca_proplist_destroy (props);
1662
* shell_global_play_sound_file_full:
1663
* @global: the #ShellGlobal
1664
* @id: an id, used to cancel later (0 if not needed)
1665
* @file_name: the file name to play
1666
* @description: the localized description of the event that triggered this alert
1667
* @for_event: (allow-none): a #ClutterEvent in response to which the sound is played
1668
* @application_id: application on behalf of which the sound is played
1669
* @application_name:
1671
* Like shell_global_play_theme_sound_full(), but with an explicit path
1672
* instead of a themed sound.
1675
shell_global_play_sound_file_full (ShellGlobal *global,
1677
const char *file_name,
1678
const char *description,
1679
ClutterEvent *for_event,
1680
const char *application_id,
1681
const char *application_name)
1685
ca_proplist_create (&props);
1686
build_ca_proplist_for_event (props, CA_PROP_MEDIA_FILENAME, file_name, description, for_event);
1687
ca_proplist_sets (props, CA_PROP_APPLICATION_ID, application_id);
1688
ca_proplist_sets (props, CA_PROP_APPLICATION_NAME, application_name);
1690
ca_context_play_full (global->sound_context, id, props, NULL, NULL);
1692
ca_proplist_destroy (props);
1696
* shell_global_play_sound_file:
1697
* @global: the #ShellGlobal
1698
* @id: an id, used to cancel later (0 if not needed)
1699
* @file_name: the file name to play
1700
* @description: the localized description of the event that triggered this alert
1701
* @for_event: (allow-none): a #ClutterEvent in response to which the sound is played
1703
* Like shell_global_play_theme_sound(), but with an explicit path
1704
* instead of a themed sound.
1707
shell_global_play_sound_file (ShellGlobal *global,
1709
const char *file_name,
1710
const char *description,
1711
ClutterEvent *for_event)
1715
ca_proplist_create (&props);
1716
build_ca_proplist_for_event (props, CA_PROP_MEDIA_FILENAME, file_name, description, for_event);
1718
ca_context_play_full (global->sound_context, id, props, NULL, NULL);
1720
ca_proplist_destroy (props);
1714
1800
return global->session_mode;
1718
* shell_global_create_xrootpmap_texture:
1719
* @global: The #ShellGlobal
1721
* This returns the _XROOTPMAP_ID pixmap that gdm should have stuffed
1722
* in the root window. The goal here is to allow a smooth fade between
1723
* plymouth and the shell greeter. This is also a workaround for gjs not
1724
* supporting raw xlib types.
1726
* Returns: (transfer floating): A #ClutterActor that represents the
1727
* _XROOTPMAP_ID pixmap property from the root window.
1730
shell_global_create_xrootpmap_texture (ShellGlobal *global)
1734
unsigned long res_nitems, bytesafter;
1735
unsigned char *data;
1736
Pixmap root_pixmap_id = None;
1738
g_return_val_if_fail (SHELL_IS_GLOBAL (global), NULL);
1740
if (XGetWindowProperty (global->xdisplay,
1741
DefaultRootWindow (global->xdisplay),
1742
XInternAtom (global->xdisplay, "_XROOTPMAP_ID", False),
1743
0, G_MAXLONG, False, XA_PIXMAP,
1744
&res_type, &res_format, &res_nitems, &bytesafter, &data) == Success)
1746
if (res_type == XA_PIXMAP && res_format == 32 && res_nitems == 1)
1747
root_pixmap_id = * (Pixmap *) data;
1751
if (root_pixmap_id != None)
1752
return clutter_x11_texture_pixmap_new_with_pixmap (root_pixmap_id);
1758
1804
get_runtime_state_path (ShellGlobal *global,
1759
1805
const char *property_name)