diff --git a/config.h.meson b/config.h.meson index a357e1c1f74f50092c04d10c3fb53fdf66240a22..b0be35d25e7269fe1324cc4d7e50d7cd7b92475d 100644 --- a/config.h.meson +++ b/config.h.meson @@ -40,8 +40,5 @@ /* Define to 1 if the and header file exist. */ #mesondefine HAVE_EXE_INTROSPECTION -/* Whether GNOME Shell is built with X11 support */ -#mesondefine HAVE_X11 - -/* Whether GNOME Shell is built with X11 clients support */ -#mesondefine HAVE_X11_CLIENT +/* Whether GNOME Shell is built with XWayland support */ +#mesondefine HAVE_XWAYLAND diff --git a/data/meson.build b/data/meson.build index cc7b5e2a1fe6dbc2245ea718d19a62f6a8db43f6..0378910b2fa36bbe6d0cbc3b77451791002ba2f4 100644 --- a/data/meson.build +++ b/data/meson.build @@ -115,15 +115,6 @@ if have_systemd unitconf = configuration_data() unitconf.set('bindir', bindir) supported_sessions = ['wayland'] - if have_x11 - configure_file( - input: 'org.gnome.Shell@x11.service.in', - output: 'org.gnome.Shell@x11.service', - configuration: unitconf, - install_dir: systemduserunitdir - ) - supported_sessions += ['x11'] - endif configure_file( input: 'org.gnome.Shell@wayland.service.in', diff --git a/data/org.gnome.Shell@x11.service.in b/data/org.gnome.Shell@x11.service.in deleted file mode 100644 index 63a014f14144c0dfb594b040ed8a09c990ddbc21..0000000000000000000000000000000000000000 --- a/data/org.gnome.Shell@x11.service.in +++ /dev/null @@ -1,39 +0,0 @@ -[Unit] -Description=GNOME Shell on X11 -# On X11, try to show the GNOME Session Failed screen -OnFailure=org.gnome.Shell-disable-extensions.service gnome-session-failed.target -OnFailureJobMode=replace -CollectMode=inactive-or-failed -RefuseManualStart=on -RefuseManualStop=on - -After=gnome-session-manager.target - -Requisite=gnome-session-initialized.target -PartOf=gnome-session-initialized.target -Before=gnome-session-initialized.target - -ConditionEnvironment=XDG_SESSION_TYPE=%I - -# Limit startup frequency more than the default -StartLimitIntervalSec=15s -StartLimitBurst=3 - -[Service] -Slice=session.slice -Type=notify -ExecStart=@bindir@/gnome-shell -# Exit code 1 means we are probably *not* dealing with an extension failure -SuccessExitStatus=1 - -# On X11 we do not need to unset any variables - -# On X11 we want to restart on-success (Alt+F2 + r) and on-failure. -Restart=always -# Do not wait before restarting the shell -RestartSec=0ms -# Kill any stubborn child processes after this long -TimeoutStopSec=5 - -# Lower down gnome-shell's OOM score to avoid being killed by OOM-killer too early -OOMScoreAdjust=-1000 diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js index 3635fd30ef95182097c196fc876e8f16a0bc4541..0bd282b80c744276715cdd68c71414b0d129f95b 100644 --- a/js/misc/ibusManager.js +++ b/js/misc/ibusManager.js @@ -1,7 +1,6 @@ import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import IBus from 'gi://IBus'; -import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import * as Signals from './signals.js'; @@ -98,7 +97,7 @@ class IBusManager extends Signals.EventEmitter { async _queueSpawn() { const isSystemdService = await this._ibusSystemdServiceExists(); if (!isSystemdService) - this._spawn(Meta.is_wayland_compositor() ? [] : ['--xim']); + this._spawn([]); } _tryAppendEnv(env, varname) { diff --git a/js/ui/closeDialog.js b/js/ui/closeDialog.js index 7e48a3fae4075778c0c7384931d5f33990f13161..85a391ee23806126a42fdbbf3cb46c2a284655c3 100644 --- a/js/ui/closeDialog.js +++ b/js/ui/closeDialog.js @@ -6,7 +6,6 @@ import Shell from 'gi://Shell'; import St from 'gi://St'; import * as Dialog from './dialog.js'; -import * as Main from './main.js'; const FROZEN_WINDOW_BRIGHTNESS = -0.3; const DIALOG_TRANSITION_TIME = 150; @@ -22,7 +21,6 @@ export const CloseDialog = GObject.registerClass({ super._init(); this._window = window; this._dialog = null; - this._tracked = undefined; this._timeoutId = 0; } @@ -111,38 +109,6 @@ export const CloseDialog = GObject.registerClass({ this.response(Meta.CloseDialogResponse.FORCE_CLOSE); } - _onFocusChanged() { - if (Meta.is_wayland_compositor()) - return; - - const focusWindow = global.display.focus_window; - const keyFocus = global.stage.key_focus; - - let shouldTrack; - if (focusWindow != null) - shouldTrack = focusWindow === this._window; - else - shouldTrack = keyFocus && this._dialog.contains(keyFocus); - - if (this._tracked === shouldTrack) - return; - - if (shouldTrack) { - Main.layoutManager.trackChrome(this._dialog, - {affectsInputRegion: true}); - } else { - Main.layoutManager.untrackChrome(this._dialog); - } - - // The buttons are broken when they aren't added to the input region, - // so disable them properly in that case - this._dialog.buttonLayout.get_children().forEach(b => { - b.reactive = shouldTrack; - }); - - this._tracked = shouldTrack; - } - vfunc_show() { if (this._dialog != null) return; @@ -155,12 +121,6 @@ export const CloseDialog = GObject.registerClass({ return GLib.SOURCE_CONTINUE; }); - global.display.connectObject( - 'notify::focus-window', this._onFocusChanged.bind(this), this); - - global.stage.connectObject( - 'notify::key-focus', this._onFocusChanged.bind(this), this); - this._addWindowEffect(); this._initDialog(); @@ -176,7 +136,6 @@ export const CloseDialog = GObject.registerClass({ scale_y: 1, mode: Clutter.AnimationMode.EASE_OUT_BACK, duration: DIALOG_TRANSITION_TIME, - onComplete: this._onFocusChanged.bind(this), }); } diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index 06f92513360c63adbd3fbbccfd7770f3af953461..a228db696aa8faf797853258a7d4aac92b131dd4 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -398,16 +398,6 @@ const Key = GObject.registerClass({ return Clutter.EVENT_STOP; }); button.connect('touch-event', (actor, event) => { - // We only handle touch events here on wayland. On X11 - // we do get emulated pointer events, which already works - // for single-touch cases. Besides, the X11 passive touch grab - // set up by Mutter will make us see first the touch events - // and later the pointer events, so it will look like two - // unrelated series of events, we want to avoid double handling - // in these cases. - if (!Meta.is_wayland_compositor()) - return Clutter.EVENT_PROPAGATE; - const slot = event.get_event_sequence().get_slot(); if (!this._touchPressSlot && @@ -1215,16 +1205,6 @@ export const Keyboard = GObject.registerClass({ this._windowMovedId = this._focusTracker.connect('window-moved', this._onFocusWindowMoving.bind(this)); - // Valid only for X11 - if (!Meta.is_wayland_compositor()) { - this._focusTracker.connectObject('focus-changed', (_tracker, focused) => { - if (focused) - this.open(Main.layoutManager.focusIndex); - else - this.close(); - }, this); - } - this._showIdleId = 0; this._keyboardVisible = false; @@ -1449,11 +1429,10 @@ export const Keyboard = GObject.registerClass({ return; } - const emojiVisible = Meta.is_wayland_compositor() && - (purpose === Clutter.InputContentPurpose.NORMAL || - purpose === Clutter.InputContentPurpose.ALPHA || - purpose === Clutter.InputContentPurpose.PASSWORD || - purpose === Clutter.InputContentPurpose.TERMINAL); + const emojiVisible = purpose === Clutter.InputContentPurpose.NORMAL || + purpose === Clutter.InputContentPurpose.ALPHA || + purpose === Clutter.InputContentPurpose.PASSWORD || + purpose === Clutter.InputContentPurpose.TERMINAL; keyboardModel.getLevels().forEach(currentLevel => { const levelLayout = new KeyContainer(); @@ -1816,12 +1795,6 @@ export const Keyboard = GObject.registerClass({ this._keyboardHeightNotifyId = keyboardBox.connect('notify::height', () => { this.translation_y = -this.height; }); - - // Toggle visibility so the keyboardBox can update its chrome region. - if (!Meta.is_wayland_compositor()) { - keyboardBox.hide(); - keyboardBox.show(); - } } _animateHide() { diff --git a/js/ui/layout.js b/js/ui/layout.js index 3978bbefe14743ff055eaf5347f45682150065da..a13ba6205a2db7edfa6fc93c22358cf37ddf2829 100644 --- a/js/ui/layout.js +++ b/js/ui/layout.js @@ -184,7 +184,6 @@ class UiActor extends St.Widget { const defaultParams = { trackFullscreen: false, affectsStruts: false, - affectsInputRegion: true, }; export const LayoutManager = GObject.registerClass({ @@ -730,9 +729,7 @@ export const LayoutManager = GObject.registerClass({ // windows restore to the right size. this._updateRegions(); - if (Meta.is_restart()) { - // On restart, we don't do an animation. - } else if (Main.sessionMode.isGreeter) { + if (Main.sessionMode.isGreeter) { this.panelBox.translation_y = -this.panelBox.height; } else { this.keyboardBox.hide(); @@ -769,9 +766,6 @@ export const LayoutManager = GObject.registerClass({ } async _startupAnimation() { - if (Meta.is_restart()) - return; - if (Main.sessionMode.isGreeter) await this._startupAnimationGreeter(); else @@ -846,8 +840,7 @@ export const LayoutManager = GObject.registerClass({ // @actor: an actor to add to the chrome // @params: (optional) additional params // - // Adds @actor to the chrome, and (unless %affectsInputRegion in - // @params is %false) extends the input region to include it. + // Adds @actor to the chrome. // Changes in @actor's size, position, and visibility will // automatically result in appropriate changes to the input // region. @@ -1056,17 +1049,12 @@ export const LayoutManager = GObject.registerClass({ delete this._updateRegionIdle; } - const rects = [], struts = []; + const struts = []; const isPopupMenuVisible = global.top_window_group.get_children().some(isPopupMetaWindow); - const wantsInputRegion = - !this._startingUp && - !isPopupMenuVisible && - Main.modalCount === 0 && - !Meta.is_wayland_compositor(); for (let i = 0; i < this._trackedActors.length; i++) { const actorData = this._trackedActors[i]; - if (!(actorData.affectsInputRegion && wantsInputRegion) && !actorData.affectsStruts) + if (!actorData.affectsStruts) continue; let [x, y] = actorData.actor.get_transformed_position(); @@ -1076,9 +1064,6 @@ export const LayoutManager = GObject.registerClass({ w = Math.round(w); h = Math.round(h); - if (actorData.affectsInputRegion && wantsInputRegion && actorData.actor.get_paint_visibility()) - rects.push(new Mtk.Rectangle({x, y, width: w, height: h})); - let monitor = null; if (actorData.affectsStruts) monitor = this.findMonitorForActor(actorData.actor); @@ -1133,9 +1118,6 @@ export const LayoutManager = GObject.registerClass({ } } - if (wantsInputRegion) - global.set_stage_input_region(rects); - this._isPopupWindowVisible = isPopupMenuVisible; const workspaceManager = global.workspace_manager; diff --git a/js/ui/main.js b/js/ui/main.js index c8cf0c9bb5842b8455018151f81a48227e54af04..c911ab21724c4d1d1d4cf1b7d926f9e581d725c0 100644 --- a/js/ui/main.js +++ b/js/ui/main.js @@ -1,4 +1,3 @@ -import Clutter from 'gi://Clutter'; import Gio from 'gi://Gio'; import GioUnix from 'gi://GioUnix'; import GLib from 'gi://GLib'; @@ -21,7 +20,6 @@ import * as InputMethod from '../misc/inputMethod.js'; import * as Introspect from '../misc/introspect.js'; import * as Keyboard from './keyboard.js'; import * as MessageTray from './messageTray.js'; -import * as ModalDialog from './modalDialog.js'; import * as OsdWindow from './osdWindow.js'; import * as OsdMonitorLabeler from './osdMonitorLabeler.js'; import * as Overview from './overview.js'; @@ -288,16 +286,6 @@ async function _initializeUI() { locatePointer.show(); }); - global.display.connect('show-restart-message', (display, message) => { - showRestartMessage(message); - return true; - }); - - global.display.connect('restart', () => { - global.reexec_self(); - return true; - }); - global.display.connect('gl-video-memory-purged', loadTheme); global.context.connect('notify::unsafe-mode', () => { @@ -1019,32 +1007,6 @@ export function queueDeferredWork(workId) { } } -const RestartMessage = GObject.registerClass( -class RestartMessage extends ModalDialog.ModalDialog { - _init(message) { - super._init({ - shellReactive: true, - styleClass: 'restart-message', - shouldFadeIn: false, - destroyOnClose: true, - }); - - const label = new St.Label({ - text: message, - x_align: Clutter.ActorAlign.CENTER, - y_align: Clutter.ActorAlign.CENTER, - }); - - this.contentLayout.add_child(label); - this.buttonLayout.hide(); - } -}); - -function showRestartMessage(message) { - const restartMessage = new RestartMessage(message); - restartMessage.open(); -} - class AnimationsSettings { constructor() { this._animationsEnabled = true; diff --git a/js/ui/messageTray.js b/js/ui/messageTray.js index 86946011c44c363466af9eadec7a88a4326d1026..76c3cf9897e405f182215217f1d5608b53b5d125 100644 --- a/js/ui/messageTray.js +++ b/js/ui/messageTray.js @@ -757,8 +757,8 @@ export const MessageTray = GObject.registerClass({ this._notificationTimeoutId = 0; this._notificationRemoved = false; - Main.layoutManager.addChrome(this, {affectsInputRegion: false}); - Main.layoutManager.trackChrome(this._bannerBin, {affectsInputRegion: true}); + Main.layoutManager.addChrome(this); + Main.layoutManager.trackChrome(this._bannerBin); global.display.connect('in-fullscreen-changed', this._updateState.bind(this)); diff --git a/js/ui/runDialog.js b/js/ui/runDialog.js index 9c347ed3cbe8fc6e8a36ba6432816bc7ce24970e..2d6c717047bcb0ad5a274c57e04523d1033d6da4 100644 --- a/js/ui/runDialog.js +++ b/js/ui/runDialog.js @@ -2,7 +2,6 @@ import Clutter from 'gi://Clutter'; import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; -import Meta from 'gi://Meta'; import Shell from 'gi://Shell'; import St from 'gi://St'; @@ -40,11 +39,6 @@ class RunDialog extends ModalDialog.ModalDialog { this._internalCommands = { 'lg': () => Main.createLookingGlass().open(), - 'r': this._restart.bind(this), - - // Developer brain backwards compatibility - 'restart': this._restart.bind(this), - 'debugexit': () => global.context.terminate(), // rt is short for "reload theme" @@ -251,15 +245,6 @@ class RunDialog extends ModalDialog.ModalDialog { this._descriptionLabel.set_text(message); } - _restart() { - if (Meta.is_wayland_compositor()) { - this._showError(_('Restart is not available on Wayland')); - return; - } - this._shouldFadeOut = false; - this.close(); - Meta.restart(_('Restarting…'), global.context); - } open() { this._history.lastItem(); diff --git a/js/ui/screenShield.js b/js/ui/screenShield.js index 706d5a7b45711b630eb4ec2ef20f8b77047849f6..a99bd58b98a611e8592f3d3bf6b79769834f25fc 100644 --- a/js/ui/screenShield.js +++ b/js/ui/screenShield.js @@ -633,11 +633,6 @@ export class ScreenShield extends Signals.EventEmitter { animateLockScreen: animate, fadeToBlack: true, }); - // On wayland, a crash brings down the entire session, so we don't - // need to defend against being restarted unlocked - if (!Meta.is_wayland_compositor()) - global.set_runtime_state(LOCKED_STATE_STR, GLib.Variant.new('b', true)); - // We used to set isActive and emit active-changed here, // but now we do that from lockScreenShown, which means // there is a 0.3 seconds window during which the lock diff --git a/js/ui/status/remoteAccess.js b/js/ui/status/remoteAccess.js index 99d7f94838ad4ea5c2f045f5b469802541a8d5cf..7974a1b062fc5e7ad7794a3ad26ef26c0be13a69 100644 --- a/js/ui/status/remoteAccess.js +++ b/js/ui/status/remoteAccess.js @@ -2,7 +2,6 @@ import Atk from 'gi://Atk'; import Clutter from 'gi://Clutter'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; -import Meta from 'gi://Meta'; import St from 'gi://St'; import * as Main from '../main.js'; @@ -169,13 +168,6 @@ export const ScreenSharingIndicator = GObject.registerClass({ } _onNewHandle(handle) { - // We can't possibly know about all types of screen sharing on X11, so - // showing these controls on X11 might give a false sense of security. - // Thus, only enable these controls when using Wayland, where we are - // in control of sharing. - if (!Meta.is_wayland_compositor()) - return; - if (handle.isRecording) return; diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index 66bbe66b0c85c6790828abbd5e4edf9c4ca4d677..51eefd298676f85e2a486586aab6cddcdf28ea37 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -897,9 +897,6 @@ export class WindowManager { return true; }); global.display.connect('x11-display-closing', () => { - if (!Meta.is_wayland_compositor()) - return; - this._stopX11Services(null); IBusManager.getIBusManager().restartDaemon(); diff --git a/man/gnome-shell.rst b/man/gnome-shell.rst index d90ea5f6c1b9740428254ad0697e1201dd590453..c577e91aaa333e9c0b43d3c9047dc20af345aa21 100644 --- a/man/gnome-shell.rst +++ b/man/gnome-shell.rst @@ -35,46 +35,14 @@ OPTIONS Run as a full display server, rather than nested -``--nested`` - - Run as a nested compositor - ``--no-x11`` Run wayland compositor without starting Xwayland -``--x11`` - - Run with X11 backend - ``--wayland-display``\ =\ *DISPLAY* Wayland display name to use -``-d``, ``--display``\ =\ *DISPLAY* - - X display to use - -``-r``, ``--replace`` - - Replace the running window manager - -``--sm-disable`` - - Disable connection to the session manager - -``--sm-client-id``\ =\ *ID* - - Specify session management *ID* - -``--sm-save-file``\ =\ *FILE* - - Initialize session from *FILE* - -``--sync`` - - Make X calls synchronous - ``--mode=MODE`` Use a specific mode, e.g. "gdm" for login screen diff --git a/meson.build b/meson.build index 0a07efd8a6b130d54b80dcc04678caa049fa52b0..9979e69906da85c4f954dc3475c145e9a28a1d81 100644 --- a/meson.build +++ b/meson.build @@ -88,9 +88,8 @@ gnome_desktop_dep = dependency('gnome-desktop-4', version: gnome_desktop_req) pango_dep = dependency('pango', version: pango_req) have_fonts = mutter_dep.get_variable('have_fonts') == 'true' -have_x11 = mutter_dep.get_variable('have_x11') == 'true' -have_x11_client = mutter_dep.get_variable('have_x11_client') == 'true' -if have_x11_client or have_x11 +have_xwayland = mutter_dep.get_variable('have_xwayland') == 'true' +if have_xwayland x11_dep = dependency('x11') xext_dep = dependency('xext') xfixes_dep = dependency('xfixes') @@ -157,8 +156,7 @@ cdata.set_quoted('PACKAGE_VERSION', meson.project_version()) cdata.set('HAVE_NETWORKMANAGER', have_networkmanager) cdata.set('HAVE_PIPEWIRE', have_pipewire) cdata.set('HAVE_SYSTEMD', have_systemd) -cdata.set('HAVE_X11', have_x11) -cdata.set('HAVE_X11_CLIENT', have_x11_client) +cdata.set('HAVE_XWAYLAND', have_xwayland) cdata.set('HAVE_FDWALK', cc.has_function('fdwalk')) cdata.set('HAVE_MALLINFO', cc.has_function('mallinfo')) @@ -318,7 +316,7 @@ subdir('js') subdir('src') subdir('po') -if get_option('tests') and have_x11_client +if get_option('tests') and have_xwayland subdir('tests') endif @@ -335,8 +333,7 @@ meson.add_dist_script('build-aux/generate-stylesheets.py') meson.add_dist_script('build-aux/check-version.py', meson.project_version(), 'NEWS') summary_options = { - 'x11': have_x11, - 'x11_client': have_x11_client, + 'have_xwayland': have_xwayland, 'camera_monitor': get_option('camera_monitor'), 'networkmanager': get_option('networkmanager'), 'systemd': get_option('systemd'), diff --git a/src/gnome-shell-test-tool.in b/src/gnome-shell-test-tool.in index 536409348def95c8f3827a633af63360f00b0088..b3197878bbd2837a954c98a65a94af60c075cf09 100755 --- a/src/gnome-shell-test-tool.in +++ b/src/gnome-shell-test-tool.in @@ -49,9 +49,6 @@ def start_shell(wrap=None, perf_output=None): args.append('--force-animations') - if options.replace: - args.append('--replace') - if options.wayland or options.nested or options.headless: args.append('--wayland') if options.nested: @@ -81,13 +78,6 @@ def run_shell(wrap=None, perf_output=None): shell.wait() return shell.returncode == 0 -def restore_shell(): - pid = os.fork() - if (pid == 0): - os.execlp("gnome-shell", "gnome-shell", "--replace") - else: - sys.exit(0) - def upload_performance_report(report_text): try: config_home = os.environ['XDG_CONFIG_HOME'] @@ -309,8 +299,6 @@ parser.add_argument("--version", action="version", parser.add_argument("--wrap") -parser.add_argument("-r", "--replace", action="store_true", - help="Replace the running window manager") parser.add_argument("-w", "--wayland", action="store_true", help="Run as a Wayland compositor") parser.add_argument("-n", "--nested", action="store_true", @@ -331,8 +319,5 @@ if options.script == 'hwtest': options.extra_filter.append('Gedit') normal_exit = run_performance_test(wrap=options.wrap) -if normal_exit: - if not options.hwtest and options.replace: - restore_shell() -else: +if not normal_exit: sys.exit(1) diff --git a/src/main.c b/src/main.c index 99eca3e3c977c882daea66abbff5f4827570aed8..2cef065f94d1f3b06a66fd43ba8ea252818a005a 100644 --- a/src/main.c +++ b/src/main.c @@ -82,7 +82,7 @@ shell_dbus_acquire_name (GDBusProxy *bus, } static void -shell_dbus_init (gboolean replace) +shell_dbus_init () { GDBusConnection *session; GDBusProxy *bus; @@ -113,8 +113,6 @@ shell_dbus_init (gboolean replace) } request_name_flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT; - if (replace) - request_name_flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE; shell_dbus_acquire_name (bus, request_name_flags, @@ -123,7 +121,7 @@ shell_dbus_init (gboolean replace) if (!(request_name_result == DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER || request_name_result == DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER)) { - g_printerr (SHELL_DBUS_SERVICE " already exists on bus and --replace not specified\n"); + g_printerr (SHELL_DBUS_SERVICE " already exists on bus\n"); exit (1); } @@ -668,7 +666,7 @@ main (int argc, char **argv) shell_init_debug (g_getenv ("SHELL_DEBUG")); - shell_dbus_init (meta_context_is_replacing (context)); + shell_dbus_init (); shell_a11y_init (); shell_perf_log_init (); shell_introspection_init (); @@ -677,8 +675,7 @@ main (int argc, char **argv) shell_profiler_init (); - if (meta_context_get_compositor_type (context) == META_COMPOSITOR_TYPE_WAYLAND) - meta_context_raise_rlimit_nofile (context, NULL); + meta_context_raise_rlimit_nofile (context, NULL); if (!meta_context_start (context, &error)) { diff --git a/src/meson.build b/src/meson.build index a4ce889eac4f7fecd524e9dc6fa9ca7cb9e150a0..8e45074c5e1168439faee3d7d2cd4edc836c87d1 100644 --- a/src/meson.build +++ b/src/meson.build @@ -13,7 +13,7 @@ introspection_common = { subdir('calendar-server') subdir('hotplug-sniffer') subdir('st') -if have_x11_client +if have_xwayland subdir('tray') endif @@ -77,7 +77,7 @@ gnome_shell_deps = [ pango_dep, ] -if have_x11_client +if have_xwayland gnome_shell_deps += x11_dep endif @@ -132,7 +132,7 @@ libshell_public_headers = [ 'shell-workspace-background.h' ] -if have_x11_client +if have_xwayland libshell_public_headers += [ 'shell-tray-icon.h', 'shell-tray-manager.h', @@ -152,7 +152,7 @@ libshell_private_headers = [ 'shell-wm-private.h' ] -if have_x11_client +if have_xwayland libshell_private_headers += [ 'shell-tray-icon-private.h', ] @@ -189,7 +189,7 @@ libshell_sources = [ 'shell-workspace-background.c' ] -if have_x11_client +if have_xwayland libshell_sources += [ 'shell-tray-icon.c', 'shell-tray-manager.c', @@ -233,7 +233,7 @@ dbus_generated += gnome.gdbus_codegen('switcheroo-control', libshell_no_gir_sources += dbus_generated libshell_link_with = [] -if have_x11_client +if have_xwayland libshell_link_with += [libtray] endif diff --git a/src/shell-global.c b/src/shell-global.c index 9a6de28e98f99d60c043eacd79631e7e2d4f2b42..95f4f36791f24e20f8f4307588f5a0cb42ce54c4 100644 --- a/src/shell-global.c +++ b/src/shell-global.c @@ -27,7 +27,7 @@ #include #include -#ifdef HAVE_X11 +#ifdef HAVE_XWAYLAND #include #endif @@ -685,50 +685,6 @@ _shell_global_destroy_gjs_context (ShellGlobal *self) g_clear_object (&self->js_context); } -/** - * shell_global_set_stage_input_region: - * @global: the #ShellGlobal - * @rectangles: (element-type Mtk.Rectangle): a list of #MtkRectangle - * describing the input region. - * - * Sets the area of the stage that is responsive to mouse clicks when - * we don't have a modal or grab. - */ -void -shell_global_set_stage_input_region (ShellGlobal *global, - GSList *rectangles) -{ -#ifdef HAVE_X11 - MtkRectangle *rect; - XRectangle *rects; - int nrects, i; - GSList *r; - MetaDisplay *display; - MetaX11Display *x11_display; - - g_return_if_fail (SHELL_IS_GLOBAL (global)); - - if (meta_is_wayland_compositor ()) - return; - - display = global->meta_display; - x11_display = meta_display_get_x11_display (display); - nrects = g_slist_length (rectangles); - rects = g_new (XRectangle, nrects); - for (r = rectangles, i = 0; r; r = r->next, i++) - { - rect = (MtkRectangle *)r->data; - rects[i].x = rect->x; - rects[i].y = rect->y; - rects[i].width = rect->width; - rects[i].height = rect->height; - } - - meta_x11_display_set_stage_input_region (x11_display, rects, nrects); - g_free (rects); -#endif -} - /** * shell_global_get_backend: * @@ -1010,7 +966,7 @@ entry_cursor_func (StEntry *entry, use_ibeam ? META_CURSOR_TEXT : META_CURSOR_DEFAULT); } -#ifdef HAVE_X11 +#ifdef HAVE_XWAYLAND static void on_x11_display_closed (MetaDisplay *display, ShellGlobal *global) @@ -1027,7 +983,7 @@ _shell_global_set_plugin (ShellGlobal *global, MetaDisplay *display; MetaBackend *backend; MetaSettings *settings; -#ifdef HAVE_X11 +#ifdef HAVE_XWAYLAND MetaX11Display *x11_display; #endif @@ -1080,7 +1036,7 @@ _shell_global_set_plugin (ShellGlobal *global, "End of frame, possibly including swap time", ""); -#ifdef HAVE_X11 +#ifdef HAVE_XWAYLAND x11_display = meta_display_get_x11_display (display); if (x11_display && meta_x11_display_get_xdisplay (x11_display)) g_signal_connect_object (global->meta_display, "x11-display-closing", @@ -1111,191 +1067,6 @@ _shell_global_get_gjs_context (ShellGlobal *global) * http://bugzilla.gnome.org/show_bug.cgi?id=357585 */ -static int -set_cloexec (void *data, gint fd) -{ - if (fd >= GPOINTER_TO_INT (data)) - fcntl (fd, F_SETFD, FD_CLOEXEC); - - return 0; -} - -#ifndef HAVE_FDWALK -static int -fdwalk (int (*cb)(void *data, int fd), void *data) -{ - gint open_max; - gint fd; - gint res = 0; - -#ifdef HAVE_SYS_RESOURCE_H - struct rlimit rl; -#endif - -#ifdef __linux__ - DIR *d; - - if ((d = opendir("/proc/self/fd"))) { - struct dirent *de; - - while ((de = readdir(d))) { - glong l; - gchar *e = NULL; - - if (de->d_name[0] == '.') - continue; - - errno = 0; - l = strtol(de->d_name, &e, 10); - if (errno != 0 || !e || *e) - continue; - - fd = (gint) l; - - if ((glong) fd != l) - continue; - - if (fd == dirfd(d)) - continue; - - if ((res = cb (data, fd)) != 0) - break; - } - - closedir(d); - return res; - } - - /* If /proc is not mounted or not accessible we fall back to the old - * rlimit trick */ - -#endif - -#ifdef HAVE_SYS_RESOURCE_H - if (getrlimit(RLIMIT_NOFILE, &rl) == 0 && rl.rlim_max != RLIM_INFINITY) - open_max = rl.rlim_max; - else -#endif - open_max = sysconf (_SC_OPEN_MAX); - - for (fd = 0; fd < open_max; fd++) - if ((res = cb (data, fd)) != 0) - break; - - return res; -} -#endif - -static void -pre_exec_close_fds(void) -{ - fdwalk (set_cloexec, GINT_TO_POINTER(3)); -} - -/** - * shell_global_reexec_self: - * @global: A #ShellGlobal - * - * Restart the current process. Only intended for development purposes. - */ -void -shell_global_reexec_self (ShellGlobal *global) -{ - GPtrArray *arr; - gsize len; - MetaContext *meta_context; - -#if defined __linux__ || defined __sun - char *buf; - char *buf_p; - char *buf_end; - g_autoptr (GError) error = NULL; - - if (!g_file_get_contents ("/proc/self/cmdline", &buf, &len, &error)) - { - g_warning ("failed to get /proc/self/cmdline: %s", error->message); - return; - } - - buf_end = buf+len; - arr = g_ptr_array_new (); - /* The cmdline file is NUL-separated */ - for (buf_p = buf; buf_p < buf_end; buf_p = buf_p + strlen (buf_p) + 1) - g_ptr_array_add (arr, buf_p); - - g_ptr_array_add (arr, NULL); -#elif defined __OpenBSD__ - gchar **args, **args_p; - gint mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV }; - - if (sysctl (mib, G_N_ELEMENTS (mib), NULL, &len, NULL, 0) == -1) - return; - - args = g_malloc0 (len); - - if (sysctl (mib, G_N_ELEMENTS (mib), args, &len, NULL, 0) == -1) { - g_warning ("failed to get command line args: %d", errno); - g_free (args); - return; - } - - arr = g_ptr_array_new (); - for (args_p = args; *args_p != NULL; args_p++) { - g_ptr_array_add (arr, *args_p); - } - - g_ptr_array_add (arr, NULL); -#elif defined __FreeBSD__ - char *buf; - char *buf_p; - char *buf_end; - gint mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, getpid() }; - - if (sysctl (mib, G_N_ELEMENTS (mib), NULL, &len, NULL, 0) == -1) - return; - - buf = g_malloc0 (len); - - if (sysctl (mib, G_N_ELEMENTS (mib), buf, &len, NULL, 0) == -1) { - g_warning ("failed to get command line args: %d", errno); - g_free (buf); - return; - } - - buf_end = buf+len; - arr = g_ptr_array_new (); - /* The value returned by sysctl is NUL-separated */ - for (buf_p = buf; buf_p < buf_end; buf_p = buf_p + strlen (buf_p) + 1) - g_ptr_array_add (arr, buf_p); - - g_ptr_array_add (arr, NULL); -#else - return; -#endif - - /* Close all file descriptors other than stdin/stdout/stderr, otherwise - * they will leak and stay open after the exec. In particular, this is - * important for file descriptors that represent mapped graphics buffer - * objects. - */ - pre_exec_close_fds (); - - meta_context = shell_global_get_context (global); - meta_context_restore_rlimit_nofile (meta_context, NULL); - - meta_display_close (shell_global_get_display (global), - shell_global_get_current_time (global)); - - execvp (arr->pdata[0], (char**)arr->pdata); - g_warning ("failed to reexec: %s", g_strerror (errno)); - g_ptr_array_free (arr, TRUE); -#if defined __linux__ || defined __FreeBSD__ - g_free (buf); -#elif defined __OpenBSD__ - g_free (args); -#endif -} - /** * shell_global_notify_error: * @global: a #ShellGlobal diff --git a/src/shell-global.h b/src/shell-global.h index ef07996585177fc461407173a3f2cb14d74413ff..3bbe3e0ab1e152b085037ff15d4044dc23f803df 100644 --- a/src/shell-global.h +++ b/src/shell-global.h @@ -46,9 +46,6 @@ void shell_global_set_force_animations (ShellGlobal *global, gboolean force); /* Input/event handling */ -void shell_global_set_stage_input_region (ShellGlobal *global, - GSList *rectangles); - void shell_global_get_pointer (ShellGlobal *global, int *x, int *y, @@ -93,8 +90,6 @@ void shell_global_notify_error (ShellGlobal *global, const char *msg, const char *details); -void shell_global_reexec_self (ShellGlobal *global); - const char * shell_global_get_session_mode (ShellGlobal *global); void shell_global_set_runtime_state (ShellGlobal *global, diff --git a/src/shell-screenshot.c b/src/shell-screenshot.c index fc1b2375b49853b1d0c75d36fd0f7f4048c63383..d1ded8c0b9deb9e5390a8d0bae5fd3190821b0e8 100644 --- a/src/shell-screenshot.c +++ b/src/shell-screenshot.c @@ -646,42 +646,6 @@ finish_screenshot (ShellScreenshot *screenshot, return TRUE; } -static void -on_after_paint (ClutterStage *stage, - ClutterStageView *view, - ClutterFrame *frame, - GTask *result) -{ - ShellScreenshot *screenshot = g_task_get_task_data (result); - MetaDisplay *display = shell_global_get_display (screenshot->global); - MetaCompositor *compositor = meta_display_get_compositor (display); - GTask *task; - - g_signal_handlers_disconnect_by_func (stage, on_after_paint, result); - - if (screenshot->mode == SHELL_SCREENSHOT_AREA) - { - do_grab_screenshot (screenshot, - screenshot->screenshot_area.x, - screenshot->screenshot_area.y, - screenshot->screenshot_area.width, - screenshot->screenshot_area.height, - screenshot->flags); - - task = g_task_new (screenshot, NULL, on_screenshot_written, result); - g_task_run_in_thread (task, write_screenshot_thread); - } - else - { - grab_screenshot (screenshot, screenshot->flags, result); - } - - g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0, - (MtkRectangle *) &screenshot->screenshot_area); - - meta_compositor_enable_unredirect (compositor); -} - /** * shell_screenshot_screenshot: * @screenshot: the #ShellScreenshot @@ -731,26 +695,10 @@ shell_screenshot_screenshot (ShellScreenshot *screenshot, if (include_cursor) flags |= SHELL_SCREENSHOT_FLAG_INCLUDE_CURSOR; - if (meta_is_wayland_compositor ()) - { - grab_screenshot (screenshot, flags, result); + grab_screenshot (screenshot, flags, result); - g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0, - (MtkRectangle *) &screenshot->screenshot_area); - } - else - { - MetaDisplay *display = shell_global_get_display (screenshot->global); - ClutterStage *stage = shell_global_get_stage (screenshot->global); - MetaCompositor *compositor = meta_display_get_compositor (display); - - meta_compositor_disable_unredirect (compositor); - clutter_actor_queue_redraw (CLUTTER_ACTOR (stage)); - screenshot->flags = flags; - screenshot->mode = SHELL_SCREENSHOT_SCREEN; - g_signal_connect (stage, "after-paint", - G_CALLBACK (on_after_paint), result); - } + g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0, + (MtkRectangle *) &screenshot->screenshot_area); } /** @@ -780,25 +728,6 @@ shell_screenshot_screenshot_finish (ShellScreenshot *screenshot, return finish_screenshot (screenshot, result, area, error); } -static void -screenshot_stage_to_content_on_after_paint (ClutterStage *stage, - ClutterStageView *view, - ClutterFrame *frame, - GTask *result) -{ - ShellScreenshot *screenshot = g_task_get_task_data (result); - MetaDisplay *display = shell_global_get_display (screenshot->global); - MetaCompositor *compositor = meta_display_get_compositor (display); - - g_signal_handlers_disconnect_by_func (stage, - screenshot_stage_to_content_on_after_paint, - result); - - meta_compositor_enable_unredirect (compositor); - - grab_screenshot_content (screenshot, result); -} - /** * shell_screenshot_screenshot_stage_to_content: * @screenshot: the #ShellScreenshot @@ -822,22 +751,7 @@ shell_screenshot_screenshot_stage_to_content (ShellScreenshot *screenshot, g_task_set_source_tag (result, shell_screenshot_screenshot_stage_to_content); g_task_set_task_data (result, screenshot, NULL); - if (meta_is_wayland_compositor ()) - { - grab_screenshot_content (screenshot, result); - } - else - { - MetaDisplay *display = shell_global_get_display (screenshot->global); - MetaCompositor *compositor = meta_display_get_compositor (display); - ClutterStage *stage = shell_global_get_stage (screenshot->global); - - meta_compositor_disable_unredirect (compositor); - clutter_actor_queue_redraw (CLUTTER_ACTOR (stage)); - g_signal_connect (stage, "after-paint", - G_CALLBACK (screenshot_stage_to_content_on_after_paint), - result); - } + grab_screenshot_content (screenshot, result); } /** @@ -950,35 +864,18 @@ shell_screenshot_screenshot_area (ShellScreenshot *screenshot, screenshot->screenshot_area.width = width; screenshot->screenshot_area.height = height; + do_grab_screenshot (screenshot, + screenshot->screenshot_area.x, + screenshot->screenshot_area.y, + screenshot->screenshot_area.width, + screenshot->screenshot_area.height, + SHELL_SCREENSHOT_FLAG_NONE); - if (meta_is_wayland_compositor ()) - { - do_grab_screenshot (screenshot, - screenshot->screenshot_area.x, - screenshot->screenshot_area.y, - screenshot->screenshot_area.width, - screenshot->screenshot_area.height, - SHELL_SCREENSHOT_FLAG_NONE); - - g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0, - (MtkRectangle *) &screenshot->screenshot_area); - - task = g_task_new (screenshot, NULL, on_screenshot_written, result); - g_task_run_in_thread (task, write_screenshot_thread); - } - else - { - MetaDisplay *display = shell_global_get_display (screenshot->global); - MetaCompositor *compositor = meta_display_get_compositor (display); - ClutterStage *stage = shell_global_get_stage (screenshot->global); - - meta_compositor_disable_unredirect (compositor); - clutter_actor_queue_redraw (CLUTTER_ACTOR (stage)); - screenshot->flags = SHELL_SCREENSHOT_FLAG_NONE; - screenshot->mode = SHELL_SCREENSHOT_AREA; - g_signal_connect (stage, "after-paint", - G_CALLBACK (on_after_paint), result); - } + g_signal_emit (screenshot, signals[SCREENSHOT_TAKEN], 0, + (MtkRectangle *) &screenshot->screenshot_area); + + task = g_task_new (screenshot, NULL, on_screenshot_written, result); + g_task_run_in_thread (task, write_screenshot_thread); } /** diff --git a/src/shell-util.c b/src/shell-util.c index a965c7148acb7084d2ff72a99352a40f4dd45241..da056a01522d66d0199c89895c4ebbcf8c24c52f 100644 --- a/src/shell-util.c +++ b/src/shell-util.c @@ -23,7 +23,7 @@ #include #include #include -#ifdef HAVE_X11_CLIENT +#ifdef HAVE_XWAYLAND #include #endif @@ -789,7 +789,7 @@ gboolean shell_util_has_x11_display_extension (MetaDisplay *display, const char *extension) { -#ifdef HAVE_X11_CLIENT +#ifdef HAVE_XWAYLAND MetaX11Display *x11_display; Display *xdisplay; int op, event, error; diff --git a/src/shell-window-tracker.c b/src/shell-window-tracker.c index 839f5244b8dba8f77e7172198893b9ca3d298893..1241764211a197862a8cc96afe33cf426b483567 100644 --- a/src/shell-window-tracker.c +++ b/src/shell-window-tracker.c @@ -10,7 +10,7 @@ #include #include #include -#ifdef HAVE_X11_CLIENT +#ifdef HAVE_XWAYLAND #include #endif @@ -302,7 +302,7 @@ static ShellApp* get_app_from_window_group (ShellWindowTracker *tracker, MetaWindow *window) { -#ifdef HAVE_X11_CLIENT +#ifdef HAVE_XWAYLAND ShellApp *result; GSList *group_windows; MetaGroup *group; diff --git a/src/st/meson.build b/src/st/meson.build index 693a143f4f6b8c877766cc778262ec21b37d2f04..772ace8421c8bdf6110d7ba259cd6af5bc05d585 100644 --- a/src/st/meson.build +++ b/src/st/meson.build @@ -213,7 +213,7 @@ libst_dep = declare_dependency( include_directories: [st_inc], ) -if get_option('tests') and have_x11_client +if get_option('tests') and have_xwayland mutter_test_dep = dependency(libmutter_test_pc, version: mutter_req) test_theme = executable('test-theme', sources: 'test-theme.c',