Compare commits

..

4 Commits

Author SHA1 Message Date
Alexander Mikhaylenko
0c03702168 window: Appear as focused while focusing
Prevent focused window from blinking after switching to another
workspace on X11.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/850
2020-07-07 20:49:55 +00:00
Alexander Mikhaylenko
03514bb31a window: Make default focus window on each workspace appear focused
Makes workspace transitions in gnome-shell look more seamless, since
both outgoing and incoming workspace have focused windows.

This is only done for click focus mode, since it's not known which
window would be focused for the other modes.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/850
2020-07-07 20:49:55 +00:00
Alexander Mikhaylenko
697b84e80e workspace: Add meta_workspace_get_default_focus_window()
This will be used in the next commit to make this window appear focused.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/850
2020-07-07 20:49:54 +00:00
Alexander Mikhaylenko
5fd90e85ed stack: Check workspace in get_default_focus_window()
Check against the window argument, instead of active workspace.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/850
2020-07-07 20:49:54 +00:00
22 changed files with 269 additions and 603 deletions

View File

@@ -18,7 +18,7 @@ check-commit-log:
build-mutter:
stage: build
script:
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- ninja -C build
- ninja -C build install
artifacts:
@@ -85,12 +85,11 @@ test-mutter-coverage:
dependencies:
- test-mutter
script:
- meson . coverage-build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
- ninja -C coverage-build coverage
- cat coverage-build/meson-logs/coverage.txt
- ninja -C build coverage
- cat build/meson-logs/coverage.txt
artifacts:
paths:
- coverage-build/meson-logs
- build/meson-logs
when: manual
except:
refs:

View File

@@ -7,15 +7,15 @@ msgid ""
msgstr ""
"Project-Id-Version: mutter master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2020-05-26 13:44+0000\n"
"PO-Revision-Date: 2020-07-12 18:34+0200\n"
"POT-Creation-Date: 2019-08-06 00:49+0000\n"
"PO-Revision-Date: 2019-09-03 09:53+0200\n"
"Last-Translator: Fabio Tomat <f.t.public@gmail.com>\n"
"Language-Team: Friulian <fur@li.org>\n"
"Language: fur\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3.1\n"
"X-Generator: Poedit 2.2.3\n"
#: data/50-mutter-navigation.xml:6
msgid "Navigation"
@@ -420,32 +420,19 @@ msgstr "Modificadôr di doprâ par localizâ il pontadôr"
msgid "This key will initiate the “locate pointer” action."
msgstr "Cheste clâf e inizializerâ la azion “localize pontadôr”."
#: data/org.gnome.mutter.gschema.xml.in:142
msgid "Timeout for check-alive ping"
msgstr "Timp scjadût pal control di sorevivence dal ping"
#: data/org.gnome.mutter.gschema.xml.in:143
msgid ""
"Number of milliseconds a client has to respond to a ping request in order to "
"not be detected as frozen. Using 0 will disable the alive check completely."
msgstr ""
"Numar di miliseconts jenfri di chei che un client al à di rispuindi a une "
"richieste di ping, par fâ in mût che nol vegni identificât tant che "
"inglaçât. Doprant 0 si disabilitarà dal dut il control di sorevivence."
#: data/org.gnome.mutter.gschema.xml.in:165
#: data/org.gnome.mutter.gschema.xml.in:155
msgid "Select window from tab popup"
msgstr "Selezione barcon dal tab popup"
#: data/org.gnome.mutter.gschema.xml.in:170
#: data/org.gnome.mutter.gschema.xml.in:160
msgid "Cancel tab popup"
msgstr "Anule tab popup"
#: data/org.gnome.mutter.gschema.xml.in:175
#: data/org.gnome.mutter.gschema.xml.in:165
msgid "Switch monitor configurations"
msgstr "Cambie configurazions visôr"
#: data/org.gnome.mutter.gschema.xml.in:180
#: data/org.gnome.mutter.gschema.xml.in:170
msgid "Rotates the built-in monitor configuration"
msgstr "Al volte la configurazion dal visôr integrât"
@@ -559,7 +546,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2631
#: src/backends/meta-input-settings.c:2531
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Cambie mût (Grup %d)"
@@ -567,34 +554,34 @@ msgstr "Cambie mût (Grup %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2654
#: src/backends/meta-input-settings.c:2554
msgid "Switch monitor"
msgstr "Cambie visôr"
#: src/backends/meta-input-settings.c:2656
#: src/backends/meta-input-settings.c:2556
msgid "Show on-screen help"
msgstr "Mostre jutori a schermi"
#: src/backends/meta-monitor.c:226
#: src/backends/meta-monitor.c:223
msgid "Built-in display"
msgstr "Display integrât"
#: src/backends/meta-monitor.c:255
#: src/backends/meta-monitor.c:252
msgid "Unknown"
msgstr "No cognossût"
#: src/backends/meta-monitor.c:257
#: src/backends/meta-monitor.c:254
msgid "Unknown Display"
msgstr "Display no cognossût"
#: src/backends/meta-monitor.c:265
#: src/backends/meta-monitor.c:262
#, c-format
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:273
#: src/backends/meta-monitor.c:270
#, c-format
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "
@@ -603,13 +590,13 @@ msgid "%s %s"
msgstr "%s %s"
#. Translators: this string will appear in Sysprof
#: src/backends/meta-profiler.c:79
#: src/backends/meta-profiler.c:82
msgid "Compositor"
msgstr "Composidôr"
#. This probably means that a non-WM compositor like xcompmgr is running;
#. * we have no way to get it to exit
#: src/compositor/compositor.c:545
#: src/compositor/compositor.c:510
#, c-format
msgid ""
"Another compositing manager is already running on screen %i on display “%s”."
@@ -621,47 +608,47 @@ msgstr ""
msgid "Bell event"
msgstr "Event cjampane"
#: src/core/main.c:190
#: src/core/main.c:185
msgid "Disable connection to session manager"
msgstr "Disabilite la conession al gjestôr de session"
#: src/core/main.c:196
#: src/core/main.c:191
msgid "Replace the running window manager"
msgstr "Rimplace il window manager in vore"
#: src/core/main.c:202
#: src/core/main.c:197
msgid "Specify session management ID"
msgstr "Specifiche il ID di gjestion session"
#: src/core/main.c:207
#: src/core/main.c:202
msgid "X Display to use"
msgstr "Display X di doprâ"
#: src/core/main.c:213
#: src/core/main.c:208
msgid "Initialize session from savefile"
msgstr "Inizialize session da file salvât"
#: src/core/main.c:219
#: src/core/main.c:214
msgid "Make X calls synchronous"
msgstr "Fâs lis clamadis X sincronis"
#: src/core/main.c:226
#: src/core/main.c:221
msgid "Run as a wayland compositor"
msgstr "Eseguìs come compositor wayland"
#: src/core/main.c:232
#: src/core/main.c:227
msgid "Run as a nested compositor"
msgstr "Eseguìs come compositor nidiât"
#: src/core/main.c:238
#: src/core/main.c:233
msgid "Run wayland compositor without starting Xwayland"
msgstr "Eseguìs il compositôr di wayland cence inviâ Xwayland"
#: src/core/main.c:246
#: src/core/main.c:241
msgid "Run as a full display server, rather than nested"
msgstr "Eseguìs come servidôr display complet, invezit che nidiât"
#: src/core/main.c:252
#: src/core/main.c:247
msgid "Run with X11 backend"
msgstr "Eseguìs cul backend X11"
@@ -714,21 +701,21 @@ msgstr "Stampe version"
msgid "Mutter plugin to use"
msgstr "Plugin Mutter di doprâ"
#: src/core/prefs.c:1911
#: src/core/prefs.c:1849
#, c-format
msgid "Workspace %d"
msgstr "Spazi di lavôr %d"
#: src/core/util.c:119
#: src/core/util.c:121
msgid "Mutter was compiled without support for verbose mode\n"
msgstr "Mutter al è stât compilât cence supuart pe modalitât fetose\n"
#: src/wayland/meta-wayland-tablet-pad.c:568
#: src/wayland/meta-wayland-tablet-pad.c:567
#, c-format
msgid "Mode Switch: Mode %d"
msgstr "Cambie mût: mût %d"
#: src/x11/meta-x11-display.c:676
#: src/x11/meta-x11-display.c:671
#, c-format
msgid ""
"Display “%s” already has a window manager; try using the --replace option to "
@@ -737,21 +724,21 @@ msgstr ""
"Il display “%s” al à za un window manager; prove dopre la opzion --replace "
"par rimplaçâ chel atuâl."
#: src/x11/meta-x11-display.c:1089
#: src/x11/meta-x11-display.c:1032
msgid "Failed to initialize GDK\n"
msgstr "No si è rivâts a inizializâ GDK\n"
#: src/x11/meta-x11-display.c:1113
#: src/x11/meta-x11-display.c:1056
#, c-format
msgid "Failed to open X Window System display “%s”\n"
msgstr "Impussibil vierzi il display “%s” di X Window System\n"
#: src/x11/meta-x11-display.c:1196
#: src/x11/meta-x11-display.c:1140
#, c-format
msgid "Screen %d on display “%s” is invalid\n"
msgstr "Schermi %d su display “%s” no valit\n"
#: src/x11/meta-x11-selection-input-stream.c:460
#: src/x11/meta-x11-selection-input-stream.c:445
#, c-format
msgid "Format %s not supported"
msgstr "Il formât %s nol è supuartât"
@@ -764,7 +751,7 @@ msgstr ""
"Chescj barcons no supuartin la funzion “salve impostazions atuâls” e si "
"scugnarà tornâ a inviâlis a man tal prossim acès."
#: src/x11/window-props.c:548
#: src/x11/window-props.c:569
#, c-format
msgid "%s (on %s)"
msgstr "%s (su %s)"

View File

@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: mutter\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/mutter/issues\n"
"POT-Creation-Date: 2020-04-27 14:06+0000\n"
"PO-Revision-Date: 2020-07-17 17:56-0300\n"
"POT-Creation-Date: 2020-02-23 17:41+0000\n"
"PO-Revision-Date: 2020-02-24 06:39-0300\n"
"Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n"
"Language-Team: Brazilian Portuguese <gnome-pt_br-list@gnome.org>\n"
"Language: pt_BR\n"
@@ -30,7 +30,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"X-Generator: Gtranslator 3.36.0\n"
"X-Generator: Gtranslator 3.32.0\n"
"X-Project-Style: gnome\n"
#: data/50-mutter-navigation.xml:6
@@ -59,35 +59,35 @@ msgstr "Mover a janela para o último espaço de trabalho"
#: data/50-mutter-navigation.xml:24
msgid "Move window one workspace up"
msgstr "Mover a janela para um espaço de trabalho acima"
msgstr "Mover a janela um espaço de trabalho acima"
#: data/50-mutter-navigation.xml:27
msgid "Move window one workspace down"
msgstr "Mover a janela para um espaço de trabalho abaixo"
msgstr "Mover a janela um espaço de trabalho abaixo"
# Em conformidade com a tradução do gsettings-desktop-schemas --Enrico
#: data/50-mutter-navigation.xml:30
msgid "Move window one monitor to the left"
msgstr "Mover a janela para o monitor da esquerda"
msgstr "Mover janela para o monitor da esquerda"
# Em conformidade com a tradução do gsettings-desktop-schemas --Enrico
#: data/50-mutter-navigation.xml:33
msgid "Move window one monitor to the right"
msgstr "Mover a janela para o monitor da direita"
msgstr "Mover janela para o monitor da direita"
# Em conformidade com a tradução do gsettings-desktop-schemas --Enrico
#: data/50-mutter-navigation.xml:36
msgid "Move window one monitor up"
msgstr "Mover a janela para o monitor acima"
msgstr "Mover janela para o monitor acima"
# Em conformidade com a tradução do gsettings-desktop-schemas --Enrico
#: data/50-mutter-navigation.xml:39
msgid "Move window one monitor down"
msgstr "Mover a janela para o monitor abaixo"
msgstr "Mover janela para o monitor abaixo"
#: data/50-mutter-navigation.xml:43
msgid "Switch applications"
msgstr "Alternar entre aplicativos"
msgstr "Alternar aplicativos"
#: data/50-mutter-navigation.xml:48
msgid "Switch to previous application"
@@ -95,7 +95,7 @@ msgstr "Alternar para o aplicativo anterior"
#: data/50-mutter-navigation.xml:52
msgid "Switch windows"
msgstr "Alternar entre janelas"
msgstr "Alternar janelas"
#: data/50-mutter-navigation.xml:57
msgid "Switch to previous window"
@@ -111,7 +111,7 @@ msgstr "Alternar para a janela anterior de um aplicativo"
#: data/50-mutter-navigation.xml:70
msgid "Switch system controls"
msgstr "Alternar os controles do sistema"
msgstr "Alternar controles do sistema"
#: data/50-mutter-navigation.xml:75
msgid "Switch to previous system control"
@@ -167,11 +167,11 @@ msgstr "Trocar para o último espaço de trabalho"
#: data/50-mutter-navigation.xml:123
msgid "Move to workspace above"
msgstr "Mover a visualização para o espaço de trabalho acima"
msgstr "Mover para o espaço de trabalho acima"
#: data/50-mutter-navigation.xml:126
msgid "Move to workspace below"
msgstr "Mover a visualização para o espaço de trabalho abaixo"
msgstr "Mover para o espaço de trabalho abaixo"
#: data/50-mutter-system.xml:6 data/50-mutter-wayland.xml:6
msgid "System"
@@ -199,11 +199,11 @@ msgstr "Ativar o menu da janela"
#: data/50-mutter-windows.xml:10
msgid "Toggle fullscreen mode"
msgstr "Alternar o modo de tela inteira"
msgstr "Alternar modo de tela inteira"
#: data/50-mutter-windows.xml:12
msgid "Toggle maximization state"
msgstr "Alternar o estado de maximização"
msgstr "Alternar estado de maximização"
#: data/50-mutter-windows.xml:14
msgid "Maximize window"
@@ -211,35 +211,35 @@ msgstr "Maximizar a janela"
#: data/50-mutter-windows.xml:16
msgid "Restore window"
msgstr "Restaurar a anela"
msgstr "Restaurar janela"
#: data/50-mutter-windows.xml:18
msgid "Close window"
msgstr "Fechar a janela"
msgstr "Fechar janela"
#: data/50-mutter-windows.xml:20
msgid "Hide window"
msgstr "Ocultar a janela"
msgstr "Ocultar janela"
#: data/50-mutter-windows.xml:22
msgid "Move window"
msgstr "Mover a janela"
msgstr "Mover janela"
#: data/50-mutter-windows.xml:24
msgid "Resize window"
msgstr "Redimensionar a janela"
msgstr "Redimensionar janela"
#: data/50-mutter-windows.xml:27
msgid "Toggle window on all workspaces or one"
msgstr "Alternar a janela em todos os espaços de trabalho ou apenas em um"
msgstr "Alternar a janela em todos os espaços de trabalho ou em apenas um"
#: data/50-mutter-windows.xml:29
msgid "Raise window if covered, otherwise lower it"
msgstr "Trazer a janela se estiver coberta; caso contrário, coloca atrás"
msgstr "Elevar a janela se estiver coberta; caso contrário, a abaixa"
#: data/50-mutter-windows.xml:31
msgid "Raise window above other windows"
msgstr "Trazer a janela para frente das outras"
msgstr "Elevar a janela para frente das outras"
#: data/50-mutter-windows.xml:33
msgid "Lower window below other windows"
@@ -255,11 +255,11 @@ msgstr "Maximizar a janela horizontalmente"
#: data/50-mutter-windows.xml:41
msgid "View split on left"
msgstr "Visualizar a divisão à esquerda"
msgstr "Visualizar divisão à esquerda"
#: data/50-mutter-windows.xml:45
msgid "View split on right"
msgstr "Visualizar a divisão à direita"
msgstr "Visualizar divisão à direita"
#: data/mutter.desktop.in:4
msgid "Mutter"
@@ -580,7 +580,7 @@ msgstr ""
#. TRANSLATORS: This string refers to a button that switches between
#. * different modes.
#.
#: src/backends/meta-input-settings.c:2631
#: src/backends/meta-input-settings.c:2567
#, c-format
msgid "Mode Switch (Group %d)"
msgstr "Alternador de modo (Grupo %d)"
@@ -588,34 +588,34 @@ msgstr "Alternador de modo (Grupo %d)"
#. TRANSLATORS: This string refers to an action, cycles drawing tablets'
#. * mapping through the available outputs.
#.
#: src/backends/meta-input-settings.c:2654
#: src/backends/meta-input-settings.c:2590
msgid "Switch monitor"
msgstr "Trocar monitor"
#: src/backends/meta-input-settings.c:2656
#: src/backends/meta-input-settings.c:2592
msgid "Show on-screen help"
msgstr "Mostrar ajuda na tela"
#: src/backends/meta-monitor.c:226
#: src/backends/meta-monitor.c:223
msgid "Built-in display"
msgstr "Tela embutida"
#: src/backends/meta-monitor.c:255
#: src/backends/meta-monitor.c:252
msgid "Unknown"
msgstr "Desconhecido"
#: src/backends/meta-monitor.c:257
#: src/backends/meta-monitor.c:254
msgid "Unknown Display"
msgstr "Monitor desconhecido"
#: src/backends/meta-monitor.c:265
#: src/backends/meta-monitor.c:262
#, c-format
msgctxt ""
"This is a monitor vendor name, followed by a size in inches, like 'Dell 15\"'"
msgid "%s %s"
msgstr "%s %s"
#: src/backends/meta-monitor.c:273
#: src/backends/meta-monitor.c:270
#, c-format
msgctxt ""
"This is a monitor vendor name followed by product/model name where size in "

View File

@@ -22,7 +22,7 @@
#ifndef META_INPUT_SETTINGS_PRIVATE_H
#define META_INPUT_SETTINGS_PRIVATE_H
#include <gdesktop-enums.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
#ifdef HAVE_LIBWACOM
#include <libwacom/libwacom.h>
@@ -55,15 +55,9 @@ struct _MetaInputSettingsClass
void (* set_tap_enabled) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_tap_button_map) (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadTapButtonMap mode);
void (* set_tap_and_drag_enabled) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_tap_and_drag_lock_enabled) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);
void (* set_disable_while_typing) (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled);

View File

@@ -620,36 +620,6 @@ update_touchpad_tap_enabled (MetaInputSettings *input_settings,
}
}
static void
update_touchpad_tap_button_map (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
MetaInputSettingsClass *input_settings_class;
GDesktopTouchpadTapButtonMap method;
MetaInputSettingsPrivate *priv;
if (device &&
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
return;
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
method = g_settings_get_enum (priv->touchpad_settings, "tap-button-map");
if (device)
{
settings_device_set_uint_setting (input_settings, device,
input_settings_class->set_tap_button_map,
method);
}
else
{
settings_set_uint_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
(ConfigUintFunc) input_settings_class->set_tap_button_map,
method);
}
}
static void
update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings,
ClutterInputDevice *device)
@@ -682,37 +652,6 @@ update_touchpad_tap_and_drag_enabled (MetaInputSettings *input_settings,
}
}
static void
update_touchpad_tap_and_drag_lock_enabled (MetaInputSettings *input_settings,
ClutterInputDevice *device)
{
MetaInputSettingsClass *input_settings_class;
MetaInputSettingsPrivate *priv;
gboolean enabled;
if (device &&
clutter_input_device_get_device_type (device) != CLUTTER_TOUCHPAD_DEVICE)
return;
priv = meta_input_settings_get_instance_private (input_settings);
input_settings_class = META_INPUT_SETTINGS_GET_CLASS (input_settings);
enabled = g_settings_get_boolean (priv->touchpad_settings, "tap-and-drag-lock");
if (device)
{
settings_device_set_bool_setting (input_settings, device,
input_settings_class->set_tap_and_drag_lock_enabled,
enabled);
}
else
{
settings_set_bool_setting (input_settings, CLUTTER_TOUCHPAD_DEVICE,
NULL,
input_settings_class->set_tap_and_drag_lock_enabled,
enabled);
}
}
static void
update_touchpad_edge_scroll (MetaInputSettings *input_settings,
ClutterInputDevice *device)
@@ -1259,12 +1198,8 @@ meta_input_settings_changed_cb (GSettings *settings,
update_device_natural_scroll (input_settings, NULL);
else if (strcmp (key, "tap-to-click") == 0)
update_touchpad_tap_enabled (input_settings, NULL);
else if (strcmp (key, "tap-button-map") == 0)
update_touchpad_tap_button_map (input_settings, NULL);
else if (strcmp (key, "tap-and-drag") == 0)
update_touchpad_tap_and_drag_enabled (input_settings, NULL);
else if (strcmp (key, "tap-and-drag-lock") == 0)
update_touchpad_tap_and_drag_lock_enabled (input_settings, NULL);
else if (strcmp(key, "disable-while-typing") == 0)
update_touchpad_disable_while_typing (input_settings, NULL);
else if (strcmp (key, "send-events") == 0)
@@ -1765,9 +1700,7 @@ apply_device_settings (MetaInputSettings *input_settings,
update_touchpad_left_handed (input_settings, device);
update_touchpad_tap_enabled (input_settings, device);
update_touchpad_tap_button_map (input_settings, device);
update_touchpad_tap_and_drag_enabled (input_settings, device);
update_touchpad_tap_and_drag_lock_enabled (input_settings, device);
update_touchpad_disable_while_typing (input_settings, device);
update_touchpad_send_events (input_settings, device);
update_touchpad_two_finger_scroll (input_settings, device);

View File

@@ -170,7 +170,6 @@ static void
sync_cursor_state (MetaScreenCastAreaStreamSrc *area_src)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (area_src);
MetaScreenCastRecordFlag flags;
if (!is_cursor_in_stream (area_src))
return;
@@ -178,8 +177,7 @@ sync_cursor_state (MetaScreenCastAreaStreamSrc *area_src)
if (is_redraw_queued (area_src))
return;
flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
meta_screen_cast_stream_src_maybe_record_frame (src);
}
static void
@@ -235,12 +233,10 @@ maybe_record_frame_on_idle (gpointer user_data)
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (user_data);
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (area_src);
MetaScreenCastRecordFlag flags;
area_src->maybe_record_idle_id = 0;
flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
meta_screen_cast_stream_src_maybe_record_frame (src);
return G_SOURCE_REMOVE;
}
@@ -392,9 +388,8 @@ meta_screen_cast_area_stream_src_disable (MetaScreenCastStreamSrc *src)
}
static gboolean
meta_screen_cast_area_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src,
uint8_t *data,
GError **error)
meta_screen_cast_area_stream_src_record_frame (MetaScreenCastStreamSrc *src,
uint8_t *data)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (src);
@@ -405,6 +400,7 @@ meta_screen_cast_area_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src
float scale;
int stride;
ClutterPaintFlag paint_flags = CLUTTER_PAINT_FLAG_NONE;
g_autoptr (GError) error = NULL;
stage = get_stage (area_src);
area = meta_screen_cast_area_stream_get_area (area_stream);
@@ -426,16 +422,18 @@ meta_screen_cast_area_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src
stride,
CLUTTER_CAIRO_FORMAT_ARGB32,
paint_flags,
error))
return FALSE;
&error))
{
g_warning ("Failed to record area: %s", error->message);
return FALSE;
}
return TRUE;
}
static gboolean
meta_screen_cast_area_stream_src_record_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer,
GError **error)
meta_screen_cast_area_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (src);
@@ -469,19 +467,6 @@ meta_screen_cast_area_stream_src_record_to_framebuffer (MetaScreenCastStreamSrc
return TRUE;
}
static void
meta_screen_cast_area_stream_record_follow_up (MetaScreenCastStreamSrc *src)
{
MetaScreenCastAreaStreamSrc *area_src =
META_SCREEN_CAST_AREA_STREAM_SRC (src);
MetaScreenCastRecordFlag flags;
g_clear_handle_id (&area_src->maybe_record_idle_id, g_source_remove);
flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
static void
meta_screen_cast_area_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *src,
struct spa_meta_cursor *spa_meta_cursor)
@@ -593,12 +578,9 @@ meta_screen_cast_area_stream_src_class_init (MetaScreenCastAreaStreamSrcClass *k
src_class->get_specs = meta_screen_cast_area_stream_src_get_specs;
src_class->enable = meta_screen_cast_area_stream_src_enable;
src_class->disable = meta_screen_cast_area_stream_src_disable;
src_class->record_to_buffer =
meta_screen_cast_area_stream_src_record_to_buffer;
src_class->record_to_framebuffer =
meta_screen_cast_area_stream_src_record_to_framebuffer;
src_class->record_follow_up =
meta_screen_cast_area_stream_record_follow_up;
src_class->record_frame = meta_screen_cast_area_stream_src_record_frame;
src_class->blit_to_framebuffer =
meta_screen_cast_area_stream_src_blit_to_framebuffer;
src_class->set_cursor_metadata =
meta_screen_cast_area_stream_src_set_cursor_metadata;
}

View File

@@ -121,10 +121,8 @@ stage_painted (MetaStage *stage,
gpointer user_data)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (user_data);
MetaScreenCastRecordFlag flags;
flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
meta_screen_cast_stream_src_maybe_record_frame (src);
}
static MetaBackend *
@@ -204,7 +202,6 @@ static void
sync_cursor_state (MetaScreenCastMonitorStreamSrc *monitor_src)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (monitor_src);
MetaScreenCastRecordFlag flags;
if (!is_cursor_in_stream (monitor_src))
return;
@@ -212,11 +209,7 @@ sync_cursor_state (MetaScreenCastMonitorStreamSrc *monitor_src)
if (is_redraw_queued (monitor_src))
return;
if (meta_screen_cast_stream_src_pending_follow_up_frame (src))
return;
flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
meta_screen_cast_stream_src_maybe_record_frame (src);
}
static void
@@ -390,9 +383,8 @@ meta_screen_cast_monitor_stream_src_disable (MetaScreenCastStreamSrc *src)
}
static gboolean
meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src,
uint8_t *data,
GError **error)
meta_screen_cast_monitor_stream_src_record_frame (MetaScreenCastStreamSrc *src,
uint8_t *data)
{
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (src);
@@ -400,6 +392,9 @@ meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
if (!is_redraw_queued (monitor_src))
return FALSE;
monitor = get_monitor (monitor_src);
logical_monitor = meta_monitor_get_logical_monitor (monitor);
stage = get_stage (monitor_src);
@@ -409,9 +404,8 @@ meta_screen_cast_monitor_stream_src_record_to_buffer (MetaScreenCastStreamSrc *
}
static gboolean
meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer,
GError **error)
meta_screen_cast_monitor_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer)
{
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (src);
@@ -435,6 +429,7 @@ meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamS
for (l = meta_renderer_get_views (renderer); l; l = l->next)
{
ClutterStageView *view = CLUTTER_STAGE_VIEW (l->data);
g_autoptr (GError) error = NULL;
CoglFramebuffer *view_framebuffer;
MetaRectangle view_layout;
int x, y;
@@ -455,8 +450,12 @@ meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamS
x, y,
cogl_framebuffer_get_width (view_framebuffer),
cogl_framebuffer_get_height (view_framebuffer),
error))
return FALSE;
&error))
{
g_warning ("Error blitting view into DMABuf framebuffer: %s",
error->message);
return FALSE;
}
}
cogl_framebuffer_finish (framebuffer);
@@ -464,44 +463,6 @@ meta_screen_cast_monitor_stream_src_record_to_framebuffer (MetaScreenCastStreamS
return TRUE;
}
static void
meta_screen_cast_monitor_stream_record_follow_up (MetaScreenCastStreamSrc *src)
{
MetaScreenCastMonitorStreamSrc *monitor_src =
META_SCREEN_CAST_MONITOR_STREAM_SRC (src);
MetaBackend *backend = get_backend (monitor_src);
MetaRenderer *renderer = meta_backend_get_renderer (backend);
ClutterStage *stage = get_stage (monitor_src);
MetaMonitor *monitor;
MetaLogicalMonitor *logical_monitor;
MetaRectangle logical_monitor_layout;
GList *l;
monitor = get_monitor (monitor_src);
logical_monitor = meta_monitor_get_logical_monitor (monitor);
logical_monitor_layout = meta_logical_monitor_get_layout (logical_monitor);
for (l = meta_renderer_get_views (renderer); l; l = l->next)
{
MetaRendererView *view = l->data;
MetaRectangle view_layout;
MetaRectangle damage;
clutter_stage_view_get_layout (CLUTTER_STAGE_VIEW (view), &view_layout);
if (!meta_rectangle_overlap (&logical_monitor_layout, &view_layout))
continue;
damage = (cairo_rectangle_int_t) {
.x = view_layout.x,
.y = view_layout.y,
.width = 1,
.height = 1,
};
clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (stage), &damage);
}
}
static void
meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *src,
struct spa_meta_cursor *spa_meta_cursor)
@@ -622,12 +583,9 @@ meta_screen_cast_monitor_stream_src_class_init (MetaScreenCastMonitorStreamSrcCl
src_class->get_specs = meta_screen_cast_monitor_stream_src_get_specs;
src_class->enable = meta_screen_cast_monitor_stream_src_enable;
src_class->disable = meta_screen_cast_monitor_stream_src_disable;
src_class->record_to_buffer =
meta_screen_cast_monitor_stream_src_record_to_buffer;
src_class->record_to_framebuffer =
meta_screen_cast_monitor_stream_src_record_to_framebuffer;
src_class->record_follow_up =
meta_screen_cast_monitor_stream_record_follow_up;
src_class->record_frame = meta_screen_cast_monitor_stream_src_record_frame;
src_class->blit_to_framebuffer =
meta_screen_cast_monitor_stream_src_blit_to_framebuffer;
src_class->set_cursor_metadata =
meta_screen_cast_monitor_stream_src_set_cursor_metadata;
}

View File

@@ -91,8 +91,7 @@ typedef struct _MetaScreenCastStreamSrcPrivate
struct spa_video_info_raw video_format;
int video_stride;
int64_t last_frame_timestamp_us;
guint follow_up_frame_source_id;
uint64_t last_frame_timestamp_us;
GHashTable *dmabuf_handles;
@@ -136,34 +135,23 @@ meta_screen_cast_stream_src_get_videocrop (MetaScreenCastStreamSrc *src,
}
static gboolean
meta_screen_cast_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src,
uint8_t *data,
GError **error)
meta_screen_cast_stream_src_record_frame (MetaScreenCastStreamSrc *src,
uint8_t *data)
{
MetaScreenCastStreamSrcClass *klass =
META_SCREEN_CAST_STREAM_SRC_GET_CLASS (src);
return klass->record_to_buffer (src, data, error);
return klass->record_frame (src, data);
}
static gboolean
meta_screen_cast_stream_src_record_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer,
GError **error)
meta_screen_cast_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer)
{
MetaScreenCastStreamSrcClass *klass =
META_SCREEN_CAST_STREAM_SRC_GET_CLASS (src);
return klass->record_to_framebuffer (src, framebuffer, error);
}
static void
meta_screen_cast_stream_src_record_follow_up (MetaScreenCastStreamSrc *src)
{
MetaScreenCastStreamSrcClass *klass =
META_SCREEN_CAST_STREAM_SRC_GET_CLASS (src);
klass->record_follow_up (src);
return klass->blit_to_framebuffer (src, framebuffer);
}
static void
@@ -421,10 +409,9 @@ maybe_record_cursor (MetaScreenCastStreamSrc *src,
}
static gboolean
do_record_frame (MetaScreenCastStreamSrc *src,
struct spa_buffer *spa_buffer,
uint8_t *data,
GError **error)
do_record_frame (MetaScreenCastStreamSrc *src,
struct spa_buffer *spa_buffer,
uint8_t *data)
{
MetaScreenCastStreamSrcPrivate *priv =
meta_screen_cast_stream_src_get_instance_private (src);
@@ -432,7 +419,7 @@ do_record_frame (MetaScreenCastStreamSrc *src,
if (spa_buffer->datas[0].data ||
spa_buffer->datas[0].type == SPA_DATA_MemFd)
{
return meta_screen_cast_stream_src_record_to_buffer (src, data, error);
return meta_screen_cast_stream_src_record_frame (src, data);
}
else if (spa_buffer->datas[0].type == SPA_DATA_DmaBuf)
{
@@ -442,56 +429,14 @@ do_record_frame (MetaScreenCastStreamSrc *src,
CoglFramebuffer *dmabuf_fbo =
cogl_dma_buf_handle_get_framebuffer (dmabuf_handle);
return meta_screen_cast_stream_src_record_to_framebuffer (src,
dmabuf_fbo,
error);
return meta_screen_cast_stream_src_blit_to_framebuffer (src, dmabuf_fbo);
}
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Unknown SPA buffer type %u", spa_buffer->datas[0].type);
return FALSE;
}
gboolean
meta_screen_cast_stream_src_pending_follow_up_frame (MetaScreenCastStreamSrc *src)
{
MetaScreenCastStreamSrcPrivate *priv =
meta_screen_cast_stream_src_get_instance_private (src);
return priv->follow_up_frame_source_id != 0;
}
static gboolean
follow_up_frame_cb (gpointer user_data)
{
MetaScreenCastStreamSrc *src = user_data;
MetaScreenCastStreamSrcPrivate *priv =
meta_screen_cast_stream_src_get_instance_private (src);
priv->follow_up_frame_source_id = 0;
meta_screen_cast_stream_src_record_follow_up (src);
return G_SOURCE_REMOVE;
}
static void
maybe_schedule_follow_up_frame (MetaScreenCastStreamSrc *src,
int64_t timeout_us)
{
MetaScreenCastStreamSrcPrivate *priv =
meta_screen_cast_stream_src_get_instance_private (src);
if (priv->follow_up_frame_source_id)
return;
priv->follow_up_frame_source_id = g_timeout_add (us2ms (timeout_us),
follow_up_frame_cb,
src);
}
void
meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
MetaScreenCastRecordFlag flags)
meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src)
{
MetaScreenCastStreamSrcPrivate *priv =
meta_screen_cast_stream_src_get_instance_private (src);
@@ -500,29 +445,14 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
struct spa_buffer *spa_buffer;
uint8_t *data = NULL;
uint64_t now_us;
g_autoptr (GError) error = NULL;
now_us = g_get_monotonic_time ();
if (priv->video_format.max_framerate.num > 0 &&
priv->last_frame_timestamp_us != 0)
{
int64_t min_interval_us;
int64_t time_since_last_frame_us;
min_interval_us =
((G_USEC_PER_SEC * priv->video_format.max_framerate.denom) /
priv->video_format.max_framerate.num);
time_since_last_frame_us = now_us - priv->last_frame_timestamp_us;
if (time_since_last_frame_us < min_interval_us)
{
int64_t timeout_us;
timeout_us = min_interval_us - time_since_last_frame_us;
maybe_schedule_follow_up_frame (src, timeout_us);
return;
}
}
priv->last_frame_timestamp_us != 0 &&
(now_us - priv->last_frame_timestamp_us <
((1000000 * priv->video_format.max_framerate.denom) /
priv->video_format.max_framerate.num)))
return;
if (!priv->pipewire_stream)
return;
@@ -540,42 +470,33 @@ meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
return;
}
if (!(flags & META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY))
if (do_record_frame (src, spa_buffer, data))
{
g_clear_handle_id (&priv->follow_up_frame_source_id, g_source_remove);
if (do_record_frame (src, spa_buffer, data, &error))
struct spa_meta_region *spa_meta_video_crop;
spa_buffer->datas[0].chunk->size = spa_buffer->datas[0].maxsize;
spa_buffer->datas[0].chunk->stride = priv->video_stride;
/* Update VideoCrop if needed */
spa_meta_video_crop =
spa_buffer_find_meta_data (spa_buffer, SPA_META_VideoCrop,
sizeof (*spa_meta_video_crop));
if (spa_meta_video_crop)
{
struct spa_meta_region *spa_meta_video_crop;
spa_buffer->datas[0].chunk->size = spa_buffer->datas[0].maxsize;
spa_buffer->datas[0].chunk->stride = priv->video_stride;
/* Update VideoCrop if needed */
spa_meta_video_crop =
spa_buffer_find_meta_data (spa_buffer, SPA_META_VideoCrop,
sizeof (*spa_meta_video_crop));
if (spa_meta_video_crop)
if (meta_screen_cast_stream_src_get_videocrop (src, &crop_rect))
{
if (meta_screen_cast_stream_src_get_videocrop (src, &crop_rect))
{
spa_meta_video_crop->region.position.x = crop_rect.x;
spa_meta_video_crop->region.position.y = crop_rect.y;
spa_meta_video_crop->region.size.width = crop_rect.width;
spa_meta_video_crop->region.size.height = crop_rect.height;
}
else
{
spa_meta_video_crop->region.position.x = 0;
spa_meta_video_crop->region.position.y = 0;
spa_meta_video_crop->region.size.width = priv->stream_width;
spa_meta_video_crop->region.size.height = priv->stream_height;
}
spa_meta_video_crop->region.position.x = crop_rect.x;
spa_meta_video_crop->region.position.y = crop_rect.y;
spa_meta_video_crop->region.size.width = crop_rect.width;
spa_meta_video_crop->region.size.height = crop_rect.height;
}
else
{
spa_meta_video_crop->region.position.x = 0;
spa_meta_video_crop->region.position.y = 0;
spa_meta_video_crop->region.size.width = priv->stream_width;
spa_meta_video_crop->region.size.height = priv->stream_height;
}
}
else
{
g_warning ("Failed to record screen cast frame: %s", error->message);
spa_buffer->datas[0].chunk->size = 0;
}
}
else
@@ -618,8 +539,6 @@ meta_screen_cast_stream_src_disable (MetaScreenCastStreamSrc *src)
META_SCREEN_CAST_STREAM_SRC_GET_CLASS (src)->disable (src);
g_clear_handle_id (&priv->follow_up_frame_source_id, g_source_remove);
priv->is_enabled = FALSE;
}

View File

@@ -37,12 +37,6 @@
typedef struct _MetaScreenCastStream MetaScreenCastStream;
typedef enum _MetaScreenCastRecordFlag
{
META_SCREEN_CAST_RECORD_FLAG_NONE = 0,
META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY = 1 << 0,
} MetaScreenCastRecordFlag;
#define META_TYPE_SCREEN_CAST_STREAM_SRC (meta_screen_cast_stream_src_get_type ())
G_DECLARE_DERIVABLE_TYPE (MetaScreenCastStreamSrc,
meta_screen_cast_stream_src,
@@ -59,24 +53,17 @@ struct _MetaScreenCastStreamSrcClass
float *frame_rate);
void (* enable) (MetaScreenCastStreamSrc *src);
void (* disable) (MetaScreenCastStreamSrc *src);
gboolean (* record_to_buffer) (MetaScreenCastStreamSrc *src,
uint8_t *data,
GError **error);
gboolean (* record_to_framebuffer) (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer,
GError **error);
void (* record_follow_up) (MetaScreenCastStreamSrc *src);
gboolean (* record_frame) (MetaScreenCastStreamSrc *src,
uint8_t *data);
gboolean (* blit_to_framebuffer) (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer);
gboolean (* get_videocrop) (MetaScreenCastStreamSrc *src,
MetaRectangle *crop_rect);
void (* set_cursor_metadata) (MetaScreenCastStreamSrc *src,
struct spa_meta_cursor *spa_meta_cursor);
};
void meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
MetaScreenCastRecordFlag flags);
gboolean meta_screen_cast_stream_src_pending_follow_up_frame (MetaScreenCastStreamSrc *src);
void meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src);
int meta_screen_cast_stream_src_get_stride (MetaScreenCastStreamSrc *src);

View File

@@ -327,10 +327,8 @@ screen_cast_window_damaged (MetaWindowActor *actor,
MetaScreenCastWindowStreamSrc *window_src)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (window_src);
MetaScreenCastRecordFlag flags;
flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
meta_screen_cast_stream_src_maybe_record_frame (src);
}
static void
@@ -367,7 +365,6 @@ static void
sync_cursor_state (MetaScreenCastWindowStreamSrc *window_src)
{
MetaScreenCastStreamSrc *src = META_SCREEN_CAST_STREAM_SRC (window_src);
MetaScreenCastRecordFlag flags;
if (!is_cursor_in_stream (window_src))
return;
@@ -375,8 +372,7 @@ sync_cursor_state (MetaScreenCastWindowStreamSrc *window_src)
if (meta_screen_cast_window_has_damage (window_src->screen_cast_window))
return;
flags = META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
meta_screen_cast_stream_src_maybe_record_frame (src);
}
static void
@@ -405,7 +401,6 @@ meta_screen_cast_window_stream_src_enable (MetaScreenCastStreamSrc *src)
MetaCursorTracker *cursor_tracker = meta_backend_get_cursor_tracker (backend);
MetaWindowActor *window_actor;
MetaScreenCastStream *stream;
MetaScreenCastRecordFlag flags;
window_actor = meta_window_actor_from_window (get_window (window_src));
if (!window_actor)
@@ -443,8 +438,7 @@ meta_screen_cast_window_stream_src_enable (MetaScreenCastStreamSrc *src)
break;
}
flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
meta_screen_cast_stream_src_maybe_record_frame (src);
}
static void
@@ -457,9 +451,8 @@ meta_screen_cast_window_stream_src_disable (MetaScreenCastStreamSrc *src)
}
static gboolean
meta_screen_cast_window_stream_src_record_to_buffer (MetaScreenCastStreamSrc *src,
uint8_t *data,
GError **error)
meta_screen_cast_window_stream_src_record_frame (MetaScreenCastStreamSrc *src,
uint8_t *data)
{
MetaScreenCastWindowStreamSrc *window_src =
META_SCREEN_CAST_WINDOW_STREAM_SRC (src);
@@ -470,9 +463,8 @@ meta_screen_cast_window_stream_src_record_to_buffer (MetaScreenCastStreamSrc *s
}
static gboolean
meta_screen_cast_window_stream_src_record_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer,
GError **error)
meta_screen_cast_window_stream_src_blit_to_framebuffer (MetaScreenCastStreamSrc *src,
CoglFramebuffer *framebuffer)
{
MetaScreenCastWindowStreamSrc *window_src =
META_SCREEN_CAST_WINDOW_STREAM_SRC (src);
@@ -485,13 +477,9 @@ meta_screen_cast_window_stream_src_record_to_framebuffer (MetaScreenCastStreamSr
stream_rect.height = get_stream_height (window_src);
if (!meta_screen_cast_window_blit_to_framebuffer (window_src->screen_cast_window,
&stream_rect,
framebuffer))
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Failed to blit window content to framebuffer");
return FALSE;
}
&stream_rect,
framebuffer))
return FALSE;
stream = meta_screen_cast_stream_src_get_stream (src);
switch (meta_screen_cast_stream_get_cursor_mode (stream))
@@ -509,15 +497,6 @@ meta_screen_cast_window_stream_src_record_to_framebuffer (MetaScreenCastStreamSr
return TRUE;
}
static void
meta_screen_cast_window_stream_record_follow_up (MetaScreenCastStreamSrc *src)
{
MetaScreenCastRecordFlag flags;
flags = META_SCREEN_CAST_RECORD_FLAG_NONE;
meta_screen_cast_stream_src_maybe_record_frame (src, flags);
}
static void
meta_screen_cast_window_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc *src,
struct spa_meta_cursor *spa_meta_cursor)
@@ -601,12 +580,9 @@ meta_screen_cast_window_stream_src_class_init (MetaScreenCastWindowStreamSrcClas
src_class->get_specs = meta_screen_cast_window_stream_src_get_specs;
src_class->enable = meta_screen_cast_window_stream_src_enable;
src_class->disable = meta_screen_cast_window_stream_src_disable;
src_class->record_to_buffer =
meta_screen_cast_window_stream_src_record_to_buffer;
src_class->record_to_framebuffer =
meta_screen_cast_window_stream_src_record_to_framebuffer;
src_class->record_follow_up =
meta_screen_cast_window_stream_record_follow_up;
src_class->record_frame = meta_screen_cast_window_stream_src_record_frame;
src_class->blit_to_framebuffer =
meta_screen_cast_window_stream_src_blit_to_framebuffer;
src_class->get_videocrop = meta_screen_cast_window_stream_src_get_videocrop;
src_class->set_cursor_metadata = meta_screen_cast_window_stream_src_set_cursor_metadata;
}

View File

@@ -140,24 +140,6 @@ meta_input_settings_native_set_tap_and_drag_enabled (MetaInputSettings *setting
LIBINPUT_CONFIG_DRAG_DISABLED);
}
static void
meta_input_settings_native_set_tap_and_drag_lock_enabled (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
struct libinput_device *libinput_device;
libinput_device = meta_input_device_native_get_libinput_device (device);
if (!libinput_device)
return;
if (libinput_device_config_tap_get_finger_count (libinput_device) > 0)
libinput_device_config_tap_set_drag_lock_enabled (libinput_device,
enabled ?
LIBINPUT_CONFIG_DRAG_LOCK_ENABLED :
LIBINPUT_CONFIG_DRAG_LOCK_DISABLED);
}
static void
meta_input_settings_native_set_disable_while_typing (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -211,15 +193,6 @@ device_set_click_method (struct libinput_device *libinput_device,
return status == LIBINPUT_CONFIG_STATUS_SUCCESS;
}
static gboolean
device_set_tap_button_map (struct libinput_device *libinput_device,
enum libinput_config_tap_button_map map)
{
enum libinput_config_status status =
libinput_device_config_tap_set_button_map (libinput_device, map);
return status == LIBINPUT_CONFIG_STATUS_SUCCESS;
}
static void
meta_input_settings_native_set_edge_scroll (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -336,40 +309,6 @@ meta_input_settings_native_set_click_method (MetaInputSettings *settin
device_set_click_method (libinput_device, click_method);
}
static void
meta_input_settings_native_set_tap_button_map (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadTapButtonMap mode)
{
enum libinput_config_tap_button_map button_map = 0;
struct libinput_device *libinput_device;
libinput_device = meta_input_device_native_get_libinput_device (device);
if (!libinput_device)
return;
if (libinput_device_config_tap_get_finger_count (libinput_device) == 0)
return;
switch (mode)
{
case G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_DEFAULT:
button_map = libinput_device_config_tap_get_default_button_map (libinput_device);
break;
case G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_LRM:
button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
break;
case G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_LMR:
button_map = LIBINPUT_CONFIG_TAP_MAP_LMR;
break;
default:
g_assert_not_reached ();
return;
}
device_set_tap_button_map (libinput_device, button_map);
}
static void
meta_input_settings_native_set_keyboard_repeat (MetaInputSettings *settings,
gboolean enabled,
@@ -694,10 +633,7 @@ meta_input_settings_native_class_init (MetaInputSettingsNativeClass *klass)
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_button_map = meta_input_settings_native_set_tap_button_map;
input_settings_class->set_tap_and_drag_enabled = meta_input_settings_native_set_tap_and_drag_enabled;
input_settings_class->set_tap_and_drag_lock_enabled =
meta_input_settings_native_set_tap_and_drag_lock_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;

View File

@@ -319,8 +319,6 @@ typedef struct _RetryPageFlipData
MetaKmsPageFlipData *page_flip_data;
float refresh_rate;
uint64_t retry_time_us;
MetaKmsCustomPageFlipFunc custom_page_flip_func;
gpointer custom_page_flip_user_data;
} RetryPageFlipData;
static void
@@ -372,7 +370,6 @@ retry_page_flips (gpointer user_data)
int fd;
int ret;
MetaKmsPageFlipData *page_flip_data;
MetaKmsCustomPageFlipFunc custom_page_flip_func;
if (is_timestamp_earlier_than (now_us,
retry_page_flip_data->retry_time_us))
@@ -381,22 +378,12 @@ retry_page_flips (gpointer user_data)
continue;
}
custom_page_flip_func = retry_page_flip_data->custom_page_flip_func;
if (custom_page_flip_func)
{
ret = custom_page_flip_func (retry_page_flip_data->custom_page_flip_user_data,
retry_page_flip_data->page_flip_data);
}
else
{
fd = meta_kms_impl_device_get_fd (impl_device);
ret = drmModePageFlip (fd,
meta_kms_crtc_get_id (crtc),
retry_page_flip_data->fb_id,
DRM_MODE_PAGE_FLIP_EVENT,
retry_page_flip_data->page_flip_data);
}
fd = meta_kms_impl_device_get_fd (impl_device);
ret = drmModePageFlip (fd,
meta_kms_crtc_get_id (crtc),
retry_page_flip_data->fb_id,
DRM_MODE_PAGE_FLIP_EVENT,
retry_page_flip_data->page_flip_data);
if (ret == -EBUSY)
{
float refresh_rate;
@@ -464,13 +451,11 @@ retry_page_flips (gpointer user_data)
}
static void
schedule_retry_page_flip (MetaKmsImplSimple *impl_simple,
MetaKmsCrtc *crtc,
uint32_t fb_id,
float refresh_rate,
MetaKmsPageFlipData *page_flip_data,
MetaKmsCustomPageFlipFunc custom_page_flip_func,
gpointer custom_page_flip_user_data)
schedule_retry_page_flip (MetaKmsImplSimple *impl_simple,
MetaKmsCrtc *crtc,
uint32_t fb_id,
float refresh_rate,
MetaKmsPageFlipData *page_flip_data)
{
RetryPageFlipData *retry_page_flip_data;
uint64_t now_us;
@@ -486,8 +471,6 @@ schedule_retry_page_flip (MetaKmsImplSimple *impl_simple,
.page_flip_data = meta_kms_page_flip_data_ref (page_flip_data),
.refresh_rate = refresh_rate,
.retry_time_us = retry_time_us,
.custom_page_flip_func = custom_page_flip_func,
.custom_page_flip_user_data = custom_page_flip_user_data,
};
if (!impl_simple->retry_page_flips_source)
@@ -694,12 +677,9 @@ process_page_flip (MetaKmsImpl *impl,
refresh_rate = meta_calculate_drm_mode_refresh_rate (drm_mode);
schedule_retry_page_flip (impl_simple,
crtc,
plane_assignment ?
plane_assignment->fb_id : 0,
plane_assignment->fb_id,
refresh_rate,
page_flip_data,
custom_page_flip_func,
page_flip->custom_page_flip_user_data);
page_flip_data);
}
else
{

View File

@@ -289,17 +289,6 @@ meta_input_settings_x11_set_tap_and_drag_enabled (MetaInputSettings *settings,
XA_INTEGER, 8, &value, 1);
}
static void
meta_input_settings_x11_set_tap_and_drag_lock_enabled (MetaInputSettings *settings,
ClutterInputDevice *device,
gboolean enabled)
{
guchar value = (enabled) ? 1 : 0;
change_property (device, "libinput Tapping Drag Lock Enabled",
XA_INTEGER, 8, &value, 1);
}
static void
meta_input_settings_x11_set_invert_scroll (MetaInputSettings *settings,
ClutterInputDevice *device,
@@ -440,40 +429,6 @@ meta_input_settings_x11_set_click_method (MetaInputSettings *settings,
meta_XFree(available);
}
static void
meta_input_settings_x11_set_tap_button_map (MetaInputSettings *settings,
ClutterInputDevice *device,
GDesktopTouchpadTapButtonMap mode)
{
guchar values[2] = { 0 }; /* lrm, lmr */
guchar *defaults;
switch (mode)
{
case G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_DEFAULT:
defaults = get_property (device, "libinput Tapping Button Mapping Default",
XA_INTEGER, 8, 2);
if (!defaults)
break;
memcpy (values, defaults, 2);
meta_XFree (defaults);
break;
case G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_LRM:
values[0] = 1;
break;
case G_DESKTOP_TOUCHPAD_BUTTON_TAP_MAP_LMR:
values[1] = 1;
break;
default:
g_assert_not_reached ();
return;
}
if (values[0] || values[1])
change_property (device, "libinput Tapping Button Mapping Enabled",
XA_INTEGER, 8, &values, 2);
}
static void
meta_input_settings_x11_set_keyboard_repeat (MetaInputSettings *settings,
gboolean enabled,
@@ -939,10 +894,7 @@ meta_input_settings_x11_class_init (MetaInputSettingsX11Class *klass)
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_button_map = meta_input_settings_x11_set_tap_button_map;
input_settings_class->set_tap_and_drag_enabled = meta_input_settings_x11_set_tap_and_drag_enabled;
input_settings_class->set_tap_and_drag_lock_enabled =
meta_input_settings_x11_set_tap_and_drag_lock_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;

View File

@@ -163,7 +163,7 @@ struct _MetaBackgroundContent
CoglPipeline *pipeline;
PipelineFlags pipeline_flags;
cairo_rectangle_int_t texture_area;
int texture_width, texture_height;
gboolean force_bilinear;
cairo_region_t *clip_region;
cairo_region_t *unobscured_region;
@@ -336,17 +336,9 @@ setup_pipeline (MetaBackgroundContent *self,
self->monitor,
&self->texture_area,
&wrap_mode);
if (texture)
{
self->texture_width = cogl_texture_get_width (texture);
self->texture_height = cogl_texture_get_height (texture);
}
else
{
self->texture_width = 0;
self->texture_height = 0;
}
self->force_bilinear = texture &&
(self->texture_area.width != (int)cogl_texture_get_width (texture) ||
self->texture_area.height != (int)cogl_texture_get_height (texture));
cogl_pipeline_set_layer_texture (self->pipeline, 0, texture);
cogl_pipeline_set_layer_wrap_mode (self->pipeline, 0, wrap_mode);
@@ -409,11 +401,12 @@ setup_pipeline (MetaBackgroundContent *self,
opacity / 255.);
fb = clutter_paint_context_get_framebuffer (paint_context);
if (meta_actor_painting_untransformed (fb,
if (!self->force_bilinear &&
meta_actor_painting_untransformed (fb,
actor_pixel_rect->width,
actor_pixel_rect->height,
actor_pixel_rect->width,
actor_pixel_rect->height,
self->texture_width,
self->texture_height,
NULL, NULL))
{
min_filter = COGL_PIPELINE_FILTER_NEAREST;

View File

@@ -34,6 +34,7 @@
#include "core/frame.h"
#include "core/main-private.h"
#include "core/meta-workspace-manager-private.h"
#include "core/workspace-private.h"
#include "core/window-private.h"
#include "meta/group.h"
#include "meta/prefs.h"
@@ -1016,7 +1017,8 @@ window_contains_point (MetaWindow *window,
}
static gboolean
window_can_get_default_focus (MetaWindow *window)
window_can_get_default_focus (MetaWindow *window,
MetaWorkspace *workspace)
{
if (window->unmaps_pending > 0)
return FALSE;
@@ -1027,7 +1029,10 @@ window_can_get_default_focus (MetaWindow *window)
if (!meta_window_is_focusable (window))
return FALSE;
if (!meta_window_should_be_showing (window))
if (!meta_window_showing_on_its_workspace (window))
return FALSE;
if (!meta_window_located_on_workspace (window, workspace))
return FALSE;
if (window->type == META_WINDOW_DOCK)
@@ -1063,7 +1068,7 @@ get_default_focus_window (MetaStack *stack,
if (window == not_this_one)
continue;
if (!window_can_get_default_focus (window))
if (!window_can_get_default_focus (window, workspace))
continue;
if (must_be_at_point && !window_contains_point (window, root_x, root_y))
@@ -1134,7 +1139,7 @@ meta_stack_get_default_focus_candidates (MetaStack *stack,
{
GList *next = l->next;
if (!window_can_get_default_focus (l->data))
if (!window_can_get_default_focus (l->data, workspace))
windows = g_list_delete_link (windows, l);
l = next;

View File

@@ -550,6 +550,9 @@ struct _MetaWindow
guint unmanage_idle_id;
pid_t client_pid;
/* Prevent blinking when focusing */
gboolean focusing;
};
struct _MetaWindowClass
@@ -704,6 +707,8 @@ void meta_window_get_session_geometry (MetaWindow *window,
void meta_window_update_unfocused_button_grabs (MetaWindow *window);
void meta_window_appears_focused_changed (MetaWindow *window);
void meta_window_set_focused_internal (MetaWindow *window,
gboolean focused);

View File

@@ -251,6 +251,10 @@ prefs_changed_callback (MetaPreference pref,
meta_window_recalc_features (window);
meta_window_queue (window, META_QUEUE_MOVE_RESIZE);
}
else if (pref == META_PREF_FOCUS_MODE)
{
meta_window_appears_focused_changed (window);
}
}
static void
@@ -4778,6 +4782,10 @@ meta_window_focus (MetaWindow *window,
window = modal_transient;
}
/* If the window was already appearing focused, but didn't have has_focus set,
* it will now briefly appear unfocused on X11. Set a flag to prevent that. */
window->focusing = TRUE;
meta_window_flush_calc_showing (window);
if ((!window->mapped || window->hidden) && !window->shaded)
@@ -4785,6 +4793,7 @@ meta_window_focus (MetaWindow *window,
meta_topic (META_DEBUG_FOCUS,
"Window %s is not showing, not focusing after all\n",
window->desc);
window->focusing = FALSE;
return;
}
@@ -4872,6 +4881,9 @@ set_workspace_state (MetaWindow *window,
}
}
if (!window->constructing)
meta_window_appears_focused_changed (window);
/* queue a move_resize since changing workspaces may change
* the relevant struts
*/
@@ -5171,7 +5183,7 @@ meta_window_change_workspace_by_index (MetaWindow *window,
meta_window_change_workspace (window, workspace);
}
static void
void
meta_window_appears_focused_changed (MetaWindow *window)
{
set_net_wm_state (window);
@@ -5267,6 +5279,8 @@ meta_window_set_focused_internal (MetaWindow *window,
{
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
window->focusing = FALSE;
if (focused)
{
window->has_focus = TRUE;
@@ -7255,7 +7269,17 @@ meta_window_get_frame (MetaWindow *window)
gboolean
meta_window_appears_focused (MetaWindow *window)
{
return window->has_focus || (window->attached_focus_window != NULL);
MetaWorkspaceManager *workspace_manager;
MetaWorkspace *workspace;
MetaWindow *default_window = NULL;
workspace_manager = window->display->workspace_manager;
workspace = meta_window_get_workspace (window);
if (workspace && workspace != workspace_manager->active_workspace)
default_window = meta_workspace_get_default_focus_window (workspace);
return window->has_focus || window->focusing || (window->attached_focus_window != NULL) || (window == default_window);
}
gboolean

View File

@@ -92,6 +92,7 @@ GList* meta_workspace_get_onscreen_region (MetaWorkspace *workspace);
GList * meta_workspace_get_onmonitor_region (MetaWorkspace *workspace,
MetaLogicalMonitor *logical_monitor);
MetaWindow* meta_workspace_get_default_focus_window (MetaWorkspace *workspace);
void meta_workspace_focus_default_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,
guint32 timestamp);

View File

@@ -365,10 +365,27 @@ meta_workspace_remove (MetaWorkspace *workspace)
*/
}
static void
workspace_default_focus_changed (MetaWorkspace *workspace,
MetaWindow *not_this_one)
{
GSList *windows, *l;
windows = meta_display_list_windows (workspace->display, META_LIST_DEFAULT);
for (l = windows; l; l = l->next) {
MetaWindow *window = META_WINDOW (l->data);
if (meta_window_located_on_workspace (window, workspace) && window != not_this_one)
meta_window_appears_focused_changed (window);
}
}
void
meta_workspace_add_window (MetaWorkspace *workspace,
MetaWindow *window)
{
MetaWorkspaceManager *manager = workspace->display->workspace_manager;
COGL_TRACE_BEGIN_SCOPED (MetaWorkspaceAddWindow,
"Workspace (add window)");
@@ -385,6 +402,9 @@ meta_workspace_add_window (MetaWorkspace *workspace,
meta_workspace_invalidate_work_area (workspace);
}
if (workspace != manager->active_workspace)
workspace_default_focus_changed (workspace, window);
g_signal_emit (workspace, signals[WINDOW_ADDED], 0, window);
g_object_notify_by_pspec (G_OBJECT (workspace), obj_props[PROP_N_WINDOWS]);
}
@@ -393,6 +413,8 @@ void
meta_workspace_remove_window (MetaWorkspace *workspace,
MetaWindow *window)
{
MetaWorkspaceManager *manager = workspace->display->workspace_manager;
COGL_TRACE_BEGIN_SCOPED (MetaWorkspaceRemoveWindow,
"Workspace (remove window)");
@@ -409,6 +431,9 @@ meta_workspace_remove_window (MetaWorkspace *workspace,
meta_workspace_invalidate_work_area (workspace);
}
if (workspace != manager->active_workspace)
workspace_default_focus_changed (workspace, window);
g_signal_emit (workspace, signals[WINDOW_REMOVED], 0, window);
g_object_notify (G_OBJECT (workspace), "n-windows");
}
@@ -657,6 +682,7 @@ meta_workspace_activate_with_focus (MetaWorkspace *workspace,
if (focus_this)
{
meta_window_activate (focus_this, timestamp);
workspace_default_focus_changed (workspace, focus_this);
}
else if (move_window)
{
@@ -1281,6 +1307,15 @@ meta_workspace_get_name (MetaWorkspace *workspace)
return meta_prefs_get_workspace_name (meta_workspace_index (workspace));
}
MetaWindow *
meta_workspace_get_default_focus_window (MetaWorkspace *workspace)
{
if (meta_prefs_get_focus_mode () == G_DESKTOP_FOCUS_MODE_CLICK)
return meta_stack_get_default_focus_window (workspace->display->stack, workspace, NULL);
return NULL;
}
void
meta_workspace_focus_default_window (MetaWorkspace *workspace,
MetaWindow *not_this_one,

View File

@@ -21,7 +21,7 @@
#ifndef META_BACKGROUND_ACTOR_H
#define META_BACKGROUND_ACTOR_H
#include <gdesktop-enums.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
#include "clutter/clutter.h"
#include "meta/meta-background.h"

View File

@@ -21,7 +21,7 @@
#ifndef META_BACKGROUND_CONTENT_H
#define META_BACKGROUND_CONTENT_H
#include <gdesktop-enums.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
#include "clutter/clutter.h"
#include "meta/meta-background.h"

View File

@@ -21,7 +21,7 @@
#ifndef META_BACKGROUND_H
#define META_BACKGROUND_H
#include <gdesktop-enums.h>
#include <gsettings-desktop-schemas/gdesktop-enums.h>
#include "clutter/clutter.h"
#include "meta/display.h"