Compare commits

..

11 Commits

Author SHA1 Message Date
Florian Müllner
1767672375 Bump version to 3.33.3
Update NEWS.
2019-06-24 19:37:43 +02:00
Florian Müllner
6fc4cd3c0c build: Bump gsettings-desktop-schemas requirement 2019-06-24 19:33:30 +02:00
Florian Müllner
feb9d129db window-x11: Fix typo 2019-06-24 19:33:30 +02:00
Carlos Garnacho
2b519cba36 backends: Move numlock persistence handling here
We used to have wayland-specific paths for this in src/wayland, now we
have ClutterKeymap that we can rely on in order to do state tracking,
and can do this all on src/backend domain.

This accomodates the feature in common code, so will work on both
Wayland and X11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 18:24:57 +02:00
Carlos Garnacho
832fc798d5 backends: Add missing code to restore NumLock state on X11
It's not be called to any practical effect yet in this backend, but will
do soon.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/590
2019-06-24 17:12:14 +02:00
Florian Müllner
bd0743a421 ci: Install sysprof dependency from copr
The currently used package links are outdated. Instead of updating them
to the current release number, rely on copr repos having a higher priority
than system repos and simply specify the package name.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/644
2019-06-24 14:35:46 +00:00
Jonas Ådahl
20731887f2 monitor-manager/dummy: Fix name of mode debug env var
It provides ways to configure the modes, not the actual monitors.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/529
2019-06-24 13:49:52 +00:00
Jonas Ådahl
980d9b1042 monitor-manager/dummy: Make modes env var override the defaults
So that one can effectively change the default resolution.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/529
2019-06-24 13:49:52 +00:00
Corentin Noël
bd7704f9e1 meta: Make MetaBackgroundGroup derivable
https://gitlab.gnome.org/GNOME/mutter/merge_requests/640
2019-06-24 13:49:31 +00:00
Jonas Ådahl
68f18f1fe9 monitor-manager/kms: Use KMS abstraction to get and set CRTC gamma
Still doesn't synchronize with frame drawing, but no point in doing that
until gamma is managed by mutter itself and not gnome-settings-daemon.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/634
2019-06-24 13:36:10 +00:00
Jonas Ådahl
c655166398 kms-impl/simple: Removing extra semi colon
https://gitlab.gnome.org/GNOME/mutter/merge_requests/634
2019-06-24 13:36:10 +00:00
28 changed files with 444 additions and 381 deletions

View File

@@ -4,6 +4,7 @@ RUN dnf -y update && dnf -y upgrade && \
dnf install -y 'dnf-command(builddep)' && \
dnf install -y 'dnf-command(copr)' && \
dnf copr enable -y fmuellner/gnome-shell-ci && \
dnf copr enable -y hergertme/sysprof-3 && \
dnf builddep -y mutter && \
@@ -15,7 +16,7 @@ RUN dnf -y update && dnf -y upgrade && \
# Unpackaged versions
dnf install -y https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00834984-gsettings-desktop-schemas/gsettings-desktop-schemas-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/jadahl/mutter-ci/fedora-29-x86_64/00834984-gsettings-desktop-schemas/gsettings-desktop-schemas-devel-3.30.1-1.20181206git918efdd69be53.fc29.x86_64.rpm && \
dnf install -y https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/libsysprof-ui-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-cli-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-3.33.2-1.fc30.x86_64.rpm https://copr-be.cloud.fedoraproject.org/results/hergertme/sysprof-3/fedora-30-x86_64/00917385-sysprof/sysprof-devel-3.33.2-1.fc30.x86_64.rpm && \
dnf install -y sysprof-devel && \
dnf install -y intltool redhat-rpm-config make && \

35
NEWS
View File

@@ -1,3 +1,38 @@
3.33.3
======
* Prepare for running Xwayland on demand [Carlos; !420]
* Fix text selection color rendering [Florian; #494]
* Fix black shadows when using fractional scaling [Robert; #609]
* Honor startup sequence workspace on wayland [Carlos; gnome-shell#674]
* Only emit 'grab-op-end` signal after dropping grabs [Marco; !596]
* Add a Sysprof-based profiler [Jonas, Georges; !197, !603]
* Relax "xwayland-allow-grabs" setting [Olivier; #597]
* Implement locate-pointer accessibility feature [Olivier; !453]
* Implement mouse accessibility [Olivier; !512]
* Consolidate frame throttling [Daniel, Georges; !363]
* Fix setting blank cursor under wayland [Jonas; #630]
* Pixel-align OpenGL cursors [Jonas; !610]
* Handle returning from fullscreen/maximization better [Jonas; !621]
* Improve screencast support on multi-monitor systems [Georges; !623]
* Fix running X11 applications with sudo under wayland [Hans; #643]
* Implement toggle-keys notification [Olivier; #637]
* Add initial KMS transactional support [Jonas; !525]
* Improve finding new focus window when the old one is closed [Marco; #308]
* Misc. bug fixes and cleanups [Jonas, Carlos, Marco, Florian, Pekka, Robert,
Douglas, Georges, Daniel, Emil, Niels, Hans, Olivier, Ting-Wei, Corentin;
!591, #398, !592, !581, !597, !598, !593, !497, #591, !545, gtk#1675, !601,
#568, !564, !605, !609, !115, !214, !611, !617, !616, !619, !624, !622, !627,
!628, !629, !632, !633, !631, !636, !639, !638, !634, !640, !529, !644, !590]
Contributors:
Jonas Ådahl, Piotr Drąg, Olivier Fourdan, Carlos Garnacho, Hans de Goede,
Niels De Graef, Ting-Wei Lan, Robert Mader, Florian Müllner,
Georges Basile Stavracas Neto, Corentin Noël, Pekka Paalanen, Douglas R. Reno,
Marco Trevisan (Treviño), Emil Velikov, Daniel van Vugt
Translators:
Balázs Úr [hu], Daniel Mustieles [es], Nathan Follens [nl], Goran Vidović [hr]
3.33.2
======
* Fix rendering lag on Xorg [Daniel; !520, !281]

View File

@@ -46,4 +46,3 @@
#mesondefine COGL_HAS_X11_SUPPORT
#mesondefine COGL_HAS_XLIB
#mesondefine COGL_HAS_XLIB_SUPPORT
#mesondefine COGL_HAS_LIBDRM

View File

@@ -29,7 +29,6 @@
*/
#include "cogl-config.h"
#include "cogl-defines.h"
#include <string.h>
#include <math.h>
@@ -309,66 +308,3 @@ cogl_pixel_format_to_string (CoglPixelFormat format)
g_assert_not_reached ();
}
#ifdef COGL_HAS_LIBDRM
typedef struct _PixelFormatMap {
uint32_t drm_format;
CoglPixelFormat cogl_format;
CoglTextureComponents cogl_components;
} PixelFormatMap;
static const PixelFormatMap pixel_format_map[] = {
/* DRM formats are defined as little-endian, not machine endian. */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
{ DRM_FORMAT_RGB565, COGL_PIXEL_FORMAT_RGB_565, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
#elif G_BYTE_ORDER == G_BIG_ENDIAN
/* DRM_FORMAT_RGB565 cannot be expressed. */
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
#else
#error "unexpected G_BYTE_ORDER"
#endif
};
gboolean
cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format,
CoglTextureComponents *out_components)
{
const size_t n = G_N_ELEMENTS (pixel_format_map);
size_t i;
for (i = 0; i < n; i++)
{
if (pixel_format_map[i].drm_format == drm_format)
break;
}
if (i == n)
return FALSE;
if (out_format)
*out_format = pixel_format_map[i].cogl_format;
if (out_components)
*out_components = pixel_format_map[i].cogl_components;
return TRUE;
}
#endif

View File

@@ -38,12 +38,7 @@
#include <stdint.h>
#include <stddef.h>
#ifdef COGL_HAS_LIBDRM
#include <drm_fourcc.h>
#endif
#include <cogl/cogl-defines.h>
#include <cogl/cogl-texture-components.h>
#include <glib.h>
#include <glib-object.h>
@@ -63,9 +58,6 @@ G_BEGIN_DECLS
*
* Other examples of factors that can influence the layout in memory are the
* system's endianness.
*
* This file also contains methods to map Linux DRM 4CC codes to
* CoglPixelFormats.
*/
#define COGL_A_BIT (1 << 4)
@@ -303,34 +295,6 @@ _cogl_pixel_format_is_endian_dependant (CoglPixelFormat format);
const char *
cogl_pixel_format_to_string (CoglPixelFormat format);
#ifdef COGL_HAS_LIBDRM
/* added in libdrm 2.4.95 */
#ifndef DRM_FORMAT_INVALID
#define DRM_FORMAT_INVALID 0
#endif
/**
* cogl_pixel_format_from_drm_format:
* @drm_format: The DRM 4CC code (as specified in drm_fourcc.h)
* @out_format: (out) (optional): The corresponding #CoglPixelFormat (if successful)
* @out_components: (out) (optional): The corresponding #CoglTextureComponents,
* if sucessful.
*
* Does an internal lookup to find a #CoglPixelFormat that matches the given
* DRM 4CC code. If no such format could be found, this function will return
* %FALSE and the output parameters will stay untouched.
*
* Returns: %TRUE if a #CoglPixelFormat corresponding to the 4CC code exists,
* %FALSE otherwise.
*/
gboolean
cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format,
CoglTextureComponents *out_components);
#endif /* COGL_HAS_LIBDRM */
G_END_DECLS
#endif /* __COGL_PIXEL_FORMAT_H__ */

View File

@@ -1,80 +0,0 @@
/*
* Cogl
*
* A Low Level GPU Graphics and Utilities API
*
* Copyright (C) 2007,2008,2009,2010 Intel Corporation.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*/
#if !defined(__COGL_H_INSIDE__) && !defined(COGL_COMPILATION)
#error "Only <cogl/cogl.h> can be included directly."
#endif
#ifndef __COGL_TEXTURE_COMPONENTS_H__
#define __COGL_TEXTURE_COMPONENTS_H__
#include <cogl/cogl-types.h>
#include <cogl/cogl-macros.h>
#include <cogl/cogl-defines.h>
#include <glib-object.h>
G_BEGIN_DECLS
/**
* SECTION:cogl-texture-components
* @short_description: Functions for creating and manipulating textures
*
* CoglTextureComponents can be used to specify what components of a
* #CoglTexture can be used for sampling later. This affects how data is
* uploaded to the GPU.
*/
/**
* CoglTextureComponents:
* @COGL_TEXTURE_COMPONENTS_A: Only the alpha component
* @COGL_TEXTURE_COMPONENTS_RG: Red and green components. Note that
* this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
* is advertised.
* @COGL_TEXTURE_COMPONENTS_RGB: Red, green and blue components
* @COGL_TEXTURE_COMPONENTS_RGBA: Red, green, blue and alpha components
* @COGL_TEXTURE_COMPONENTS_DEPTH: Only a depth component
*
* See cogl_texture_set_components().
*
* Since: 1.18
*/
typedef enum _CoglTextureComponents
{
COGL_TEXTURE_COMPONENTS_A = 1,
COGL_TEXTURE_COMPONENTS_RG,
COGL_TEXTURE_COMPONENTS_RGB,
COGL_TEXTURE_COMPONENTS_RGBA,
COGL_TEXTURE_COMPONENTS_DEPTH
} CoglTextureComponents;
G_END_DECLS
#endif /* __COGL_TEXTURE_COMPONENTS_H__ */

View File

@@ -122,6 +122,29 @@ uint32_t cogl_texture_error_quark (void);
gboolean
cogl_is_texture (void *object);
/**
* CoglTextureComponents:
* @COGL_TEXTURE_COMPONENTS_A: Only the alpha component
* @COGL_TEXTURE_COMPONENTS_RG: Red and green components. Note that
* this can only be used if the %COGL_FEATURE_ID_TEXTURE_RG feature
* is advertised.
* @COGL_TEXTURE_COMPONENTS_RGB: Red, green and blue components
* @COGL_TEXTURE_COMPONENTS_RGBA: Red, green, blue and alpha components
* @COGL_TEXTURE_COMPONENTS_DEPTH: Only a depth component
*
* See cogl_texture_set_components().
*
* Since: 1.18
*/
typedef enum _CoglTextureComponents
{
COGL_TEXTURE_COMPONENTS_A = 1,
COGL_TEXTURE_COMPONENTS_RG,
COGL_TEXTURE_COMPONENTS_RGB,
COGL_TEXTURE_COMPONENTS_RGBA,
COGL_TEXTURE_COMPONENTS_DEPTH
} CoglTextureComponents;
/**
* cogl_texture_set_components:
* @texture: a #CoglTexture pointer.

View File

@@ -12,7 +12,6 @@ cdata.set('COGL_HAS_X11', have_x11)
cdata.set('COGL_HAS_X11_SUPPORT', have_x11)
cdata.set('COGL_HAS_XLIB', have_x11)
cdata.set('COGL_HAS_XLIB_SUPPORT', have_x11)
cdata.set('COGL_HAS_LIBDRM', have_native_backend and libdrm_dep.found())
cogl_defines_h = configure_file(
input: 'cogl-defines.h.meson',
@@ -94,7 +93,6 @@ cogl_headers = [
'cogl-texture.h',
'cogl-texture-2d.h',
'cogl-texture-2d-sliced.h',
'cogl-texture-components.h',
'cogl-types.h',
'cogl.h',
]

View File

@@ -1,5 +1,5 @@
project('mutter', 'c',
version: '3.33.2',
version: '3.33.3',
meson_version: '>= 0.50.0',
license: 'GPLv2+'
)
@@ -18,7 +18,7 @@ uprof_req = '>= 0.3'
pango_req = '>= 1.2.0'
cairo_req = '>= 1.10.0'
pangocairo_req = '>= 1.20'
gsettings_desktop_schemas_req = '>= 3.31.0'
gsettings_desktop_schemas_req = '>= 3.33.0'
json_glib_req = '>= 0.12.0'
upower_glib_req = '>= 0.99.0'
xcomposite_req = '>= 0.4'

View File

@@ -144,6 +144,7 @@ struct _MetaBackendPrivate
gboolean is_pointer_position_initialized;
guint device_update_idle_id;
guint keymap_state_changed_id;
GHashTable *device_monitors;
@@ -178,6 +179,14 @@ meta_backend_finalize (GObject *object)
MetaBackend *backend = META_BACKEND (object);
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
if (priv->keymap_state_changed_id)
{
ClutterKeymap *keymap;
keymap = clutter_backend_get_keymap (priv->clutter_backend);
g_signal_handler_disconnect (keymap, priv->keymap_state_changed_id);
}
g_list_free_full (priv->gpus, g_object_unref);
g_clear_object (&priv->monitor_manager);
@@ -491,6 +500,7 @@ meta_backend_real_post_init (MetaBackend *backend)
{
MetaBackendPrivate *priv = meta_backend_get_instance_private (backend);
ClutterDeviceManager *device_manager = clutter_device_manager_get_default ();
ClutterKeymap *keymap = clutter_backend_get_keymap (priv->clutter_backend);
priv->stage = meta_stage_new (backend);
clutter_actor_realize (priv->stage);
@@ -517,6 +527,15 @@ meta_backend_real_post_init (MetaBackend *backend)
priv->input_settings = meta_backend_create_input_settings (backend);
if (priv->input_settings)
{
priv->keymap_state_changed_id =
g_signal_connect_swapped (keymap, "state-changed",
G_CALLBACK (meta_input_settings_maybe_save_numlock_state),
priv->input_settings);
meta_input_settings_maybe_restore_numlock_state (priv->input_settings);
}
#ifdef HAVE_REMOTE_DESKTOP
priv->remote_access_controller =
g_object_new (META_TYPE_REMOTE_ACCESS_CONTROLLER, NULL);

View File

@@ -144,4 +144,7 @@ WacomDevice * meta_input_settings_get_tablet_wacom_device (MetaInputSettings *se
ClutterInputDevice *device);
#endif
void meta_input_settings_maybe_save_numlock_state (MetaInputSettings *input_settings);
void meta_input_settings_maybe_restore_numlock_state (MetaInputSettings *input_settings);
#endif /* META_INPUT_SETTINGS_PRIVATE_H */

View File

@@ -1152,6 +1152,8 @@ meta_input_settings_changed_cb (GSettings *settings,
strcmp (key, "repeat-interval") == 0 ||
strcmp (key, "delay") == 0)
update_keyboard_repeat (input_settings);
else if (strcmp (key, "remember-numlock-state") == 0)
meta_input_settings_maybe_save_numlock_state (input_settings);
}
}
@@ -2609,3 +2611,39 @@ meta_input_settings_get_pad_action_label (MetaInputSettings *input_settings,
return NULL;
}
void
meta_input_settings_maybe_save_numlock_state (MetaInputSettings *input_settings)
{
MetaInputSettingsPrivate *priv;
ClutterKeymap *keymap;
gboolean numlock_state;
priv = meta_input_settings_get_instance_private (input_settings);
if (!g_settings_get_boolean (priv->keyboard_settings, "remember-numlock-state"))
return;
keymap = clutter_backend_get_keymap (clutter_get_default_backend ());
numlock_state = clutter_keymap_get_num_lock_state (keymap);
if (numlock_state == g_settings_get_boolean (priv->keyboard_settings, "numlock-state"))
return;
g_settings_set_boolean (priv->keyboard_settings, "numlock-state", numlock_state);
}
void
meta_input_settings_maybe_restore_numlock_state (MetaInputSettings *input_settings)
{
MetaInputSettingsPrivate *priv;
gboolean numlock_state;
priv = meta_input_settings_get_instance_private (input_settings);
if (!g_settings_get_boolean (priv->keyboard_settings, "remember-numlock-state"))
return;
numlock_state = g_settings_get_boolean (priv->keyboard_settings, "numlock-state");
meta_backend_set_numlock (meta_get_backend (), numlock_state);
}

View File

@@ -145,15 +145,7 @@ append_monitor (MetaMonitorManager *manager,
const char *mode_specs_str;
GList *l;
for (i = 0; i < G_N_ELEMENTS (default_specs); i++)
{
CrtcModeSpec *spec;
spec = g_memdup (&default_specs[i], sizeof (CrtcModeSpec));
mode_specs = g_list_prepend (mode_specs, spec);
}
mode_specs_str = getenv ("MUTTER_DEBUG_DUMMY_MONITORS_SPECS");
mode_specs_str = getenv ("MUTTER_DEBUG_DUMMY_MODE_SPECS");
if (mode_specs_str && *mode_specs_str != '\0')
{
g_auto (GStrv) specs = g_strsplit (mode_specs_str, ":", -1);
@@ -181,6 +173,16 @@ append_monitor (MetaMonitorManager *manager,
}
}
}
else
{
for (i = 0; i < G_N_ELEMENTS (default_specs); i++)
{
CrtcModeSpec *spec;
spec = g_memdup (&default_specs[i], sizeof (CrtcModeSpec));
mode_specs = g_list_prepend (mode_specs, spec);
}
}
for (l = mode_specs; l; l = l->next)
{
@@ -395,10 +397,11 @@ meta_monitor_manager_dummy_read_current (MetaMonitorManager *manager)
* Specifies the number of dummy monitors to include in the stage. Every
* monitor is 1024x786 pixels and they are placed on a horizontal row.
*
* MUTTER_DEBUG_DUMMY_MONITORS_SPECS
* MUTTER_DEBUG_DUMMY_MODE_SPECS
*
* A colon separated list of monitor specifications that can be used to
* configure the monitor via dbus API.
* A colon separated list of mode specifications that can be used to
* configure the monitor via dbus API. Setting this environment variable
* overrides the default set of modes available.
* Format should be WWxHH:WWxHH@RR
*
* MUTTER_DEBUG_DUMMY_MONITOR_SCALES

View File

@@ -814,6 +814,7 @@ void meta_backend_native_resume (MetaBackendNative *native)
meta_backend_get_monitor_manager (backend);
MetaMonitorManagerKms *monitor_manager_kms =
META_MONITOR_MANAGER_KMS (monitor_manager);
MetaInputSettings *input_settings;
MetaIdleMonitor *idle_monitor;
meta_monitor_manager_kms_resume (monitor_manager_kms);
@@ -827,4 +828,7 @@ void meta_backend_native_resume (MetaBackendNative *native)
idle_monitor = meta_backend_get_idle_monitor (backend, 0);
meta_idle_monitor_reset_idletime (idle_monitor);
input_settings = meta_backend_get_input_settings (backend);
meta_input_settings_maybe_restore_numlock_state (input_settings);
}

View File

@@ -40,6 +40,17 @@ struct _MetaKmsCrtc
G_DEFINE_TYPE (MetaKmsCrtc, meta_kms_crtc, G_TYPE_OBJECT)
void
meta_kms_crtc_set_gamma (MetaKmsCrtc *crtc,
MetaKmsUpdate *update,
int size,
const uint16_t *red,
const uint16_t *green,
const uint16_t *blue)
{
meta_kms_update_set_crtc_gamma (update, crtc, size, red, green, blue);
}
MetaKmsDevice *
meta_kms_crtc_get_device (MetaKmsCrtc *crtc)
{
@@ -64,6 +75,36 @@ meta_kms_crtc_get_idx (MetaKmsCrtc *crtc)
return crtc->idx;
}
static void
read_gamma_state (MetaKmsCrtc *crtc,
MetaKmsImplDevice *impl_device,
drmModeCrtc *drm_crtc)
{
MetaKmsCrtcState *current_state = &crtc->current_state;
if (current_state->gamma.size != drm_crtc->gamma_size)
{
current_state->gamma.size = drm_crtc->gamma_size;
current_state->gamma.red = g_realloc_n (current_state->gamma.red,
drm_crtc->gamma_size,
sizeof (uint16_t));
current_state->gamma.green = g_realloc_n (current_state->gamma.green,
drm_crtc->gamma_size,
sizeof (uint16_t));
current_state->gamma.blue = g_realloc_n (current_state->gamma.blue,
drm_crtc->gamma_size,
sizeof (uint16_t));
}
drmModeCrtcGetGamma (meta_kms_impl_device_get_fd (impl_device),
crtc->id,
current_state->gamma.size,
current_state->gamma.red,
current_state->gamma.green,
current_state->gamma.blue);
}
static void
meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
MetaKmsImplDevice *impl_device,
@@ -79,6 +120,8 @@ meta_kms_crtc_read_state (MetaKmsCrtc *crtc,
.is_drm_mode_valid = drm_crtc->mode_valid,
.drm_mode = drm_crtc->mode,
};
read_gamma_state (crtc, impl_device, drm_crtc);
}
void
@@ -109,6 +152,18 @@ meta_kms_crtc_new (MetaKmsImplDevice *impl_device,
return crtc;
}
static void
meta_kms_crtc_finalize (GObject *object)
{
MetaKmsCrtc *crtc = META_KMS_CRTC (object);
g_clear_pointer (&crtc->current_state.gamma.red, g_free);
g_clear_pointer (&crtc->current_state.gamma.green, g_free);
g_clear_pointer (&crtc->current_state.gamma.blue, g_free);
G_OBJECT_CLASS (meta_kms_crtc_parent_class)->finalize (object);
}
static void
meta_kms_crtc_init (MetaKmsCrtc *crtc)
{
@@ -117,4 +172,7 @@ meta_kms_crtc_init (MetaKmsCrtc *crtc)
static void
meta_kms_crtc_class_init (MetaKmsCrtcClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = meta_kms_crtc_finalize;
}

View File

@@ -36,6 +36,14 @@ typedef struct _MetaKmsCrtcState
uint32_t common_possible_crtcs;
uint32_t common_possible_clones;
uint32_t encoder_device_idxs;
struct {
uint16_t *red;
uint16_t *green;
uint16_t *blue;
int size;
} gamma;
} MetaKmsCrtcState;
#define META_TYPE_KMS_CRTC (meta_kms_crtc_get_type ())
@@ -43,6 +51,13 @@ G_DECLARE_FINAL_TYPE (MetaKmsCrtc, meta_kms_crtc,
META, KMS_CRTC,
GObject)
void meta_kms_crtc_set_gamma (MetaKmsCrtc *crtc,
MetaKmsUpdate *update,
int size,
const uint16_t *red,
const uint16_t *green,
const uint16_t *blue);
MetaKmsDevice * meta_kms_crtc_get_device (MetaKmsCrtc *crtc);
const MetaKmsCrtcState * meta_kms_crtc_get_current_state (MetaKmsCrtc *crtc);

View File

@@ -201,7 +201,7 @@ process_mode_set (MetaKmsImpl *impl,
GError **error)
{
MetaKmsImplSimple *impl_simple = META_KMS_IMPL_SIMPLE (impl);
MetaKmsCrtc *crtc = mode_set->crtc;;
MetaKmsCrtc *crtc = mode_set->crtc;
MetaKmsDevice *device = meta_kms_crtc_get_device (crtc);
MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device);
g_autofree uint32_t *connectors = NULL;
@@ -284,6 +284,35 @@ process_mode_set (MetaKmsImpl *impl,
return TRUE;
}
static gboolean
process_crtc_gamma (MetaKmsImpl *impl,
MetaKmsCrtcGamma *gamma,
GError **error)
{
MetaKmsCrtc *crtc = gamma->crtc;
MetaKmsDevice *device = meta_kms_crtc_get_device (crtc);
MetaKmsImplDevice *impl_device = meta_kms_device_get_impl_device (device);
int fd;
int ret;
fd = meta_kms_impl_device_get_fd (impl_device);
ret = drmModeCrtcSetGamma (fd, meta_kms_crtc_get_id (crtc),
gamma->size,
gamma->red,
gamma->green,
gamma->blue);
if (ret != 0)
{
g_set_error (error, G_IO_ERROR, g_io_error_from_errno (-ret),
"drmModeCrtcSetGamma on CRTC %u failed: %s",
meta_kms_crtc_get_id (crtc),
g_strerror (-ret));
return FALSE;
}
return TRUE;
}
static gboolean
is_timestamp_earlier_than (uint64_t ts1,
uint64_t ts2)
@@ -708,6 +737,14 @@ meta_kms_impl_simple_process_update (MetaKmsImpl *impl,
goto discard_page_flips;
}
for (l = meta_kms_update_get_crtc_gammas (update); l; l = l->next)
{
MetaKmsCrtcGamma *gamma = l->data;
if (!process_crtc_gamma (impl, gamma, error))
goto discard_page_flips;
}
for (l = meta_kms_update_get_page_flips (update); l; l = l->next)
{
MetaKmsPageFlip *page_flip = l->data;

View File

@@ -59,6 +59,15 @@ typedef struct _MetaKmsConnectorProperty
uint64_t value;
} MetaKmsConnectorProperty;
typedef struct _MetaKmsCrtcGamma
{
MetaKmsCrtc *crtc;
int size;
uint16_t *red;
uint16_t *green;
uint16_t *blue;
} MetaKmsCrtcGamma;
typedef struct _MetaKmsPageFlip
{
MetaKmsCrtc *crtc;
@@ -77,6 +86,13 @@ void meta_kms_update_set_connector_property (MetaKmsUpdate *update,
uint32_t prop_id,
uint64_t value);
void meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
int size,
const uint16_t *red,
const uint16_t *green,
const uint16_t *blue);
void meta_kms_plane_assignment_set_plane_property (MetaKmsPlaneAssignment *plane_assignment,
uint32_t prop_id,
uint64_t value);
@@ -89,6 +105,8 @@ GList * meta_kms_update_get_page_flips (MetaKmsUpdate *update);
GList * meta_kms_update_get_connector_properties (MetaKmsUpdate *update);
GList * meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update);
gboolean meta_kms_update_has_mode_set (MetaKmsUpdate *update);
#endif /* META_KMS_UPDATE_PRIVATE_H */

View File

@@ -34,6 +34,7 @@ struct _MetaKmsUpdate
GList *plane_assignments;
GList *page_flips;
GList *connector_properties;
GList *crtc_gammas;
};
static MetaKmsProperty *
@@ -142,6 +143,39 @@ meta_kms_update_set_connector_property (MetaKmsUpdate *update,
prop);
}
static void
meta_kms_crtc_gamma_free (MetaKmsCrtcGamma *gamma)
{
g_free (gamma->red);
g_free (gamma->green);
g_free (gamma->blue);
g_free (gamma);
}
void
meta_kms_update_set_crtc_gamma (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
int size,
const uint16_t *red,
const uint16_t *green,
const uint16_t *blue)
{
MetaKmsCrtcGamma *gamma;
g_assert (!meta_kms_update_is_sealed (update));
gamma = g_new0 (MetaKmsCrtcGamma, 1);
*gamma = (MetaKmsCrtcGamma) {
.crtc = crtc,
.size = size,
.red = g_memdup (red, size * sizeof *red),
.green = g_memdup (green, size * sizeof *green),
.blue = g_memdup (blue, size * sizeof *blue),
};
update->crtc_gammas = g_list_prepend (update->crtc_gammas, gamma);
}
void
meta_kms_update_page_flip (MetaKmsUpdate *update,
MetaKmsCrtc *crtc,
@@ -225,6 +259,12 @@ meta_kms_update_get_connector_properties (MetaKmsUpdate *update)
return update->connector_properties;
}
GList *
meta_kms_update_get_crtc_gammas (MetaKmsUpdate *update)
{
return update->crtc_gammas;
}
gboolean
meta_kms_update_has_mode_set (MetaKmsUpdate *update)
{
@@ -258,6 +298,7 @@ meta_kms_update_free (MetaKmsUpdate *update)
(GDestroyNotify) meta_kms_mode_set_free);
g_list_free_full (update->page_flips, g_free);
g_list_free_full (update->connector_properties, g_free);
g_list_free_full (update->crtc_gammas, (GDestroyNotify) meta_kms_crtc_gamma_free);
g_free (update);
}

View File

@@ -367,20 +367,16 @@ meta_monitor_manager_kms_get_crtc_gamma (MetaMonitorManager *manager,
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));
drmModeCrtc *kms_crtc;
MetaKmsCrtc *kms_crtc;
const MetaKmsCrtcState *crtc_state;
kms_crtc = drmModeGetCrtc (kms_fd, crtc->crtc_id);
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
crtc_state = meta_kms_crtc_get_current_state (kms_crtc);
*size = kms_crtc->gamma_size;
*red = g_new (unsigned short, *size);
*green = g_new (unsigned short, *size);
*blue = g_new (unsigned short, *size);
drmModeCrtcGetGamma (kms_fd, crtc->crtc_id, *size, *red, *green, *blue);
drmModeFreeCrtc (kms_crtc);
*size = crtc_state->gamma.size;
*red = g_memdup (crtc_state->gamma.red, *size * sizeof **red);
*green = g_memdup (crtc_state->gamma.green, *size * sizeof **green);
*blue = g_memdup (crtc_state->gamma.blue, *size * sizeof **blue);
}
static char *
@@ -453,20 +449,25 @@ meta_monitor_manager_kms_set_crtc_gamma (MetaMonitorManager *manager,
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));
MetaBackend *backend = meta_monitor_manager_get_backend (manager);
MetaBackendNative *backend_native = META_BACKEND_NATIVE (backend);
MetaKms *kms = meta_backend_native_get_kms (backend_native);
MetaKmsCrtc *kms_crtc;
g_autofree char *gamma_ramp_string = NULL;
int ret;
MetaKmsUpdate *kms_update;
g_autoptr (GError) error = NULL;
gamma_ramp_string = generate_gamma_ramp_string (size, red, green, blue);
g_debug ("Setting CRTC (%ld) gamma to %s", crtc->crtc_id, gamma_ramp_string);
ret = drmModeCrtcSetGamma (kms_fd, crtc->crtc_id, size, red, green, blue);
if (ret != 0)
{
g_warning ("Failed to set CRTC (%ld) Gamma: %s",
crtc->crtc_id, g_strerror (-ret));
}
kms_update = meta_kms_ensure_pending_update (kms);
kms_crtc = meta_crtc_kms_get_kms_crtc (crtc);
meta_kms_crtc_set_gamma (kms_crtc, kms_update,
size, red, green, blue);
if (!meta_kms_post_pending_update_sync (kms, &error))
g_warning ("Failed to CRTC gamma: %s", error->message);
}
static void

View File

@@ -75,6 +75,11 @@
#define EGL_DRM_MASTER_FD_EXT 0x333C
#endif
/* added in libdrm 2.4.95 */
#ifndef DRM_FORMAT_INVALID
#define DRM_FORMAT_INVALID 0
#endif
enum
{
PROP_0,
@@ -246,6 +251,11 @@ static void
free_next_secondary_bo (MetaGpuKms *gpu_kms,
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state);
static gboolean
cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format,
CoglTextureComponents *out_components);
static void
meta_renderer_native_gpu_data_free (MetaRendererNativeGpuData *renderer_gpu_data)
{
@@ -1813,6 +1823,65 @@ secondary_gpu_get_next_dumb_buffer (MetaOnscreenNativeSecondaryGpuState *seconda
return &secondary_gpu_state->cpu.dumb_fbs[0];
}
typedef struct _PixelFormatMap {
uint32_t drm_format;
CoglPixelFormat cogl_format;
CoglTextureComponents cogl_components;
} PixelFormatMap;
static const PixelFormatMap pixel_format_map[] = {
/* DRM formats are defined as little-endian, not machine endian. */
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
{ DRM_FORMAT_RGB565, COGL_PIXEL_FORMAT_RGB_565, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
#elif G_BYTE_ORDER == G_BIG_ENDIAN
/* DRM_FORMAT_RGB565 cannot be expressed. */
{ DRM_FORMAT_ABGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XBGR8888, COGL_PIXEL_FORMAT_ABGR_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_ARGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_XRGB8888, COGL_PIXEL_FORMAT_ARGB_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_BGRA8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_BGRX8888, COGL_PIXEL_FORMAT_BGRA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
{ DRM_FORMAT_RGBA8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGBA },
{ DRM_FORMAT_RGBX8888, COGL_PIXEL_FORMAT_RGBA_8888_PRE, COGL_TEXTURE_COMPONENTS_RGB },
#else
#error "unexpected G_BYTE_ORDER"
#endif
};
static gboolean
cogl_pixel_format_from_drm_format (uint32_t drm_format,
CoglPixelFormat *out_format,
CoglTextureComponents *out_components)
{
const size_t n = G_N_ELEMENTS (pixel_format_map);
size_t i;
for (i = 0; i < n; i++)
{
if (pixel_format_map[i].drm_format == drm_format)
break;
}
if (i == n)
return FALSE;
if (out_format)
*out_format = pixel_format_map[i].cogl_format;
if (out_components)
*out_components = pixel_format_map[i].cogl_components;
return TRUE;
}
static void
copy_shared_framebuffer_cpu (CoglOnscreen *onscreen,
MetaOnscreenNativeSecondaryGpuState *secondary_gpu_state,

View File

@@ -667,7 +667,13 @@ static void
meta_backend_x11_set_numlock (MetaBackend *backend,
gboolean numlock_state)
{
/* TODO: Currently handled by gnome-settings-deamon */
MetaBackendX11 *x11 = META_BACKEND_X11 (backend);
MetaBackendX11Private *priv = meta_backend_x11_get_instance_private (x11);
unsigned int num_mask;
num_mask = XkbKeysymToModifiers (priv->xdisplay, XK_Num_Lock);
XkbLockModifiers (priv->xdisplay, XkbUseCoreKbd, num_mask,
numlock_state ? num_mask : 0);
}
void

View File

@@ -19,11 +19,6 @@
#include "compositor/meta-cullable.h"
#include "meta/meta-background-group.h"
struct _MetaBackgroundGroup
{
ClutterActor parent;
};
static void cullable_iface_init (MetaCullableInterface *iface);
G_DEFINE_TYPE_WITH_CODE (MetaBackgroundGroup, meta_background_group, CLUTTER_TYPE_ACTOR,

View File

@@ -10,10 +10,15 @@
#define META_TYPE_BACKGROUND_GROUP (meta_background_group_get_type ())
META_EXPORT
G_DECLARE_FINAL_TYPE (MetaBackgroundGroup,
meta_background_group,
META, BACKGROUND_GROUP,
ClutterActor)
G_DECLARE_DERIVABLE_TYPE (MetaBackgroundGroup,
meta_background_group,
META, BACKGROUND_GROUP,
ClutterActor)
struct _MetaBackgroundGroupClass
{
ClutterActorClass parent_class;
};
META_EXPORT
ClutterActor *meta_background_group_new (void);

View File

@@ -43,6 +43,10 @@
#include "linux-dmabuf-unstable-v1-server-protocol.h"
#ifndef DRM_FORMAT_MOD_INVALID
#define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1)
#endif
#define META_WAYLAND_DMA_BUF_MAX_FDS 4
struct _MetaWaylandDmaBufBuffer
@@ -80,15 +84,28 @@ meta_wayland_dma_buf_realize_texture (MetaWaylandBuffer *buffer,
if (buffer->dma_buf.texture)
return TRUE;
/*
* NOTE: The cogl_format here is only used for texture color channel
* swizzling as compared to COGL_PIXEL_FORMAT_ARGB. It is *not* used
* for accessing the buffer memory. EGL will access the buffer
* memory according to the DRM fourcc code. Cogl will not mmap
* and access the buffer memory at all.
*/
if (!cogl_pixel_format_from_drm_format (dma_buf->drm_format, &cogl_format, NULL))
switch (dma_buf->drm_format)
{
/*
* NOTE: The cogl_format here is only used for texture color channel
* swizzling as compared to COGL_PIXEL_FORMAT_ARGB. It is *not* used
* for accessing the buffer memory. EGL will access the buffer
* memory according to the DRM fourcc code. Cogl will not mmap
* and access the buffer memory at all.
*/
case DRM_FORMAT_XRGB8888:
cogl_format = COGL_PIXEL_FORMAT_RGB_888;
break;
case DRM_FORMAT_ARGB8888:
cogl_format = COGL_PIXEL_FORMAT_ARGB_8888_PRE;
break;
case DRM_FORMAT_ARGB2101010:
cogl_format = COGL_PIXEL_FORMAT_ARGB_2101010_PRE;
break;
case DRM_FORMAT_RGB565:
cogl_format = COGL_PIXEL_FORMAT_RGB_565;
break;
default:
g_set_error (error, G_IO_ERROR,
G_IO_ERROR_FAILED,
"Unsupported buffer format %d", dma_buf->drm_format);

View File

@@ -65,19 +65,11 @@
#endif
#define GSD_KEYBOARD_SCHEMA "org.gnome.settings-daemon.peripherals.keyboard"
typedef enum
{
GSD_KEYBOARD_NUM_LOCK_STATE_UNKNOWN,
GSD_KEYBOARD_NUM_LOCK_STATE_ON,
GSD_KEYBOARD_NUM_LOCK_STATE_OFF
} GsdKeyboardNumLockState;
G_DEFINE_TYPE (MetaWaylandKeyboard, meta_wayland_keyboard,
META_TYPE_WAYLAND_INPUT_DEVICE)
static void meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard);
static void meta_wayland_keyboard_set_numlock (MetaWaylandKeyboard *keyboard,
gboolean numlock_state);
static void notify_modifiers (MetaWaylandKeyboard *keyboard);
static guint evdev_code (const ClutterKeyEvent *event);
@@ -404,110 +396,6 @@ notify_modifiers (MetaWaylandKeyboard *keyboard)
xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE));
}
static void
numlock_set_xkb_state (MetaWaylandKeyboard *keyboard,
GsdKeyboardNumLockState state)
{
MetaBackend *backend = meta_get_backend ();
gboolean numlock_state;
if (state != GSD_KEYBOARD_NUM_LOCK_STATE_ON &&
state != GSD_KEYBOARD_NUM_LOCK_STATE_OFF)
return;
numlock_state = (state == GSD_KEYBOARD_NUM_LOCK_STATE_ON);
meta_verbose ("set numlock state %s\n", (numlock_state ? "ON" : "OFF"));
meta_backend_set_numlock (backend, numlock_state);
meta_wayland_keyboard_set_numlock (keyboard, numlock_state);
}
static void
maybe_restore_numlock_state (MetaWaylandKeyboard *keyboard)
{
gboolean remember_numlock;
if (!keyboard->gsd_settings)
return;
/* We are cheating for now, we use g-s-d settings... */
remember_numlock = g_settings_get_boolean (keyboard->gsd_settings,
"remember-numlock-state");
if (remember_numlock)
{
GsdKeyboardNumLockState state;
state = g_settings_get_enum (keyboard->gsd_settings, "numlock-state");
numlock_set_xkb_state (keyboard, state);
}
}
static void
maybe_save_numlock_state (MetaWaylandKeyboard *keyboard)
{
#ifdef HAVE_NATIVE_BACKEND
MetaWaylandXkbInfo *xkb_info = &keyboard->xkb_info;
GsdKeyboardNumLockState numlock_state;
int numlock_active;
if (!META_IS_BACKEND_NATIVE (meta_get_backend ()))
return;
if (!xkb_info->state)
return;
if (!keyboard->gsd_settings)
return;
if (!g_settings_get_boolean (keyboard->gsd_settings, "remember-numlock-state"))
return;
numlock_active = xkb_state_mod_name_is_active(xkb_info->state,
"Mod2",
XKB_STATE_MODS_LOCKED);
switch (numlock_active)
{
case -1:
numlock_state = GSD_KEYBOARD_NUM_LOCK_STATE_UNKNOWN;
break;
case 0:
numlock_state = GSD_KEYBOARD_NUM_LOCK_STATE_OFF;
break;
default:
numlock_state = GSD_KEYBOARD_NUM_LOCK_STATE_ON;
break;
}
g_settings_set_enum (keyboard->gsd_settings, "numlock-state", numlock_state);
#endif
}
static void
meta_wayland_keyboard_set_numlock (MetaWaylandKeyboard *keyboard,
gboolean numlock_state)
{
MetaWaylandXkbInfo *xkb_info = &keyboard->xkb_info;
xkb_mod_mask_t latched, locked, group, depressed;
xkb_mod_mask_t numlock;
meta_verbose ("backend numlock state %s\n", (numlock_state ? "ON" : "OFF"));
latched = xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_LATCHED);
locked = xkb_state_serialize_mods (xkb_info->state, XKB_STATE_MODS_LOCKED);
group = xkb_state_serialize_layout (xkb_info->state, XKB_STATE_LAYOUT_EFFECTIVE);
depressed = xkb_state_serialize_mods(xkb_info->state, XKB_STATE_DEPRESSED);
numlock = (1 << xkb_keymap_mod_get_index(xkb_info->keymap, "Mod2"));
if (numlock_state == TRUE)
locked |= numlock;
else
locked &= ~numlock;
xkb_state_update_mask (xkb_info->state, depressed, latched, locked, 0, 0, group);
kbd_a11y_apply_mask (keyboard);
notify_modifiers (keyboard);
}
static void
meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard)
{
@@ -615,16 +503,6 @@ notify_key_repeat (MetaWaylandKeyboard *keyboard)
}
}
static void
remember_numlock_state_changed (GSettings *settings,
const char *key,
gpointer data)
{
MetaWaylandKeyboard *keyboard = data;
maybe_save_numlock_state (keyboard);
}
static void
settings_changed (GSettings *settings,
const char *key,
@@ -678,24 +556,11 @@ void
meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
{
MetaBackend *backend = meta_get_backend ();
GSettingsSchema *schema;
keyboard->settings = g_settings_new ("org.gnome.desktop.peripherals.keyboard");
g_signal_connect (keyboard->settings, "changed",
G_CALLBACK (settings_changed), keyboard);
/* We are cheating for now, we use g-s-d settings... Check if available */
schema = g_settings_schema_source_lookup (g_settings_schema_source_get_default (),
GSD_KEYBOARD_SCHEMA,
TRUE);
if (schema)
{
keyboard->gsd_settings = g_settings_new_full (schema, NULL, NULL);
g_settings_schema_unref (schema);
g_signal_connect (keyboard->gsd_settings, "changed::remember-numlock-state",
G_CALLBACK (remember_numlock_state_changed), keyboard);
}
g_signal_connect (backend, "keymap-changed",
G_CALLBACK (on_keymap_changed), keyboard);
g_signal_connect (backend, "keymap-layout-group-changed",
@@ -705,8 +570,6 @@ meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard)
G_CALLBACK (on_kbd_a11y_mask_changed), keyboard);
meta_wayland_keyboard_take_keymap (keyboard, meta_backend_get_keymap (backend));
maybe_restore_numlock_state (keyboard);
}
static void
@@ -735,8 +598,6 @@ meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard)
wl_list_init (&keyboard->focus_resource_list);
g_clear_object (&keyboard->settings);
if (keyboard->gsd_settings)
g_object_unref (keyboard->gsd_settings);
}
static guint
@@ -802,8 +663,6 @@ meta_wayland_keyboard_handle_event (MetaWaylandKeyboard *keyboard,
if (keyboard->mods_changed != 0)
{
if (keyboard->mods_changed & XKB_STATE_MODS_LOCKED)
maybe_save_numlock_state (keyboard);
notify_modifiers (keyboard);
keyboard->mods_changed = 0;
}

View File

@@ -104,7 +104,6 @@ struct _MetaWaylandKeyboard
MetaWaylandKeyboardGrab default_grab;
GSettings *settings;
GSettings *gsd_settings;
};
void meta_wayland_keyboard_enable (MetaWaylandKeyboard *keyboard);

View File

@@ -888,7 +888,7 @@ meta_window_x11_focus (MetaWindow *window,
* the window responds to WM_TAKE_FOCUS, but if we're unmanaging
* the current focus window we *need* to move the focus away, so
* we focus the no focus window before sending WM_TAKE_FOCUS,
* and eventually the default focus windwo excluding this one,
* and eventually the default focus window excluding this one,
* if meanwhile we don't get any focus request.
*/
if (window->display->focus_window != NULL &&