Compare commits

...

26 Commits

Author SHA1 Message Date
Carlos Garnacho
7f66aede01 keyboard: Fix warnings on destroyed actors
Trying to hide a page gets hard when the page was previouly destroyed.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1281
2019-05-10 00:09:23 +02:00
Carlos Garnacho
bd5a1121d6 keyboard: Rename variable to JS style
This variable has been there since the OSK origins, and nothing guaranteed
the need for renaming it. It's enough of an eye sore though.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1281
2019-05-10 00:08:56 +02:00
Dylan McCall
03117d65b2 panel: Drag topmost maximized window
This makes it possible to drag a window which appears connected with the
panel, even if it is not in focus. As a result, it should be easier to
manipulate side-by-side windows.

https://bugzilla.gnome.org/show_bug.cgi?id=679290
2019-05-04 13:50:04 -07:00
Florian Müllner
5520bb3890 texture-cache: Keep aspect ratio for content images
Images are loaded either with a supplied fixed size, or using the "native"
dimensions of the file. When creating a content image from the loaded data,
we currently simply apply this directly to the preferred size.

This works usually fine: GdkPixbuf will always keep the aspect ratio, so
if only one dimension is provided, the other will be adjusted accordingly:

Loading a 200x200 image with a requested size of (100, -1) will result in
a 100x100 content image.

There is a catch though: GdkPixbuf will only scale *down* to the requested
size, no up. That is, loading a 100x100 image with a requested size of
(200, -1) will result in a 100x100 pixbuf. But as we assume that the pixbuf
size matches the requested size, the image content ends up with 200x100.

Fix this by explicitly handling the case where only one size was supplied,
and make the other dimension take the aspect ratio into account

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/525
2019-05-04 00:50:31 +00:00
Jonas Dreßler
4e6b2eb72a windowManager: Fix fullscreen windows in ws switching animations
To prevent a small gap between windows in the workspace switching
animation, we temporarily shift windows up or down by the height of the
panel. This obviously breaks the animation for fullscreen windows, those
will overlap with the ones on the other workspace since there is no
panel shown in that case.

Fix this by checking whether the old or new workspace includes a
fullscreen window and don't shift the windows if there is one.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/757

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/322
2019-05-03 22:14:04 +00:00
Marco Trevisan (Treviño)
2e5295b3a9 dialog: Use object's set to assign properties
We can just assign a properties object to a GObject using the set() method
instead of using Object.assign.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/531
2019-05-03 15:34:06 -05:00
Marco Trevisan (Treviño)
3121c9aa29 dialog: Really set ellipsize mode in subtitle and body
Dialog's subtitle or body could not be properly wrapped, while it's ellipsized
when the text's width doesn't exceed the container size.

Clutter text has an `ellipsize` property, however in dialog's subtitle and body
we have been setting the `ellipsize-mode` property to Pango.EllipsizeMode.NONE
that is not present in the underlying GObject.

Not being an error in javascript, gjs didn't warn us about this, while at the
same time the St.Label's default Pango.EllipsizeMode.END was used.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/922

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/531
2019-05-03 15:34:05 -05:00
Carlos Garnacho
1ebbd7c768 st: Reimplement StClipboard on top of MetaSelection
And stop using X11/gdk for this.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/331
2019-05-02 15:58:51 +00:00
Carmen Bianca BAKKER
8572bb97c7 Update Esperanto translation 2019-05-01 19:54:12 +00:00
Florian Müllner
d5ebd8c816 dashSpacer: Don't trigger allocations from size negotiations
If an actor's allocation is outdated, clutter_actor_get_allocation_box()
will queue a relayout. That's why it's advised to not use the function
unless the allocation is known to be valid (namely during paint), but
in particular not from within get_preferred_width/height vfuncs.

Using the :allocation property (which may be outdated) would be better,
but in this case we can simply delegate the request to the correct actor.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1065
2019-04-30 20:59:28 +00:00
Carlos Garnacho
ed999ce926 keyboard: Destroy old layout actors when regenerating keyboard groups
We were cleaning up self._groups, but the actors for all previous
groups/layers/modes would remain attached to the aspect container,
simply hidden.

Under some circumstances this can really make the amount of actors
in the shell stage to quickly ramp up, it's not just a "leak" but
also has potential side effects on performance.

We should destroy all child actors of this._aspectContainer, except
the static ones (emoji and keypad).

While at it, fix this._groups re-initialization, as it's actually an
object, not an array.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/523
Closes?: https://gitlab.gnome.org/GNOME/mutter/issues/556
2019-04-30 21:33:02 +02:00
Florian Müllner
50b7739076 worldClocks: Ignore locations with unknown timezone
We currently assume that every location has an associated timezone.
While this is sound in the real world, in practise it depends on
whether or not libgweather can find a corresponding timezone DB
entry.

This used to be a fringe case, but has become more likely when commit
https://gitlab.gnome.org/GNOME/libgweather/commit/d7682676ac9 moved
weather stations from cities to countries - the station itself is un-
likely to have a timezone entry, and the country may be part of more
than a single timezone.

It would be good for libgweather to return a timezone for those
locations again, but we should defend against the case anyway.
We cannot tell what time it is at a particular location without
knowing the timezone, so simply filter them out.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1062
2019-04-30 16:15:27 +00:00
Carlos Garnacho
94995e9c1e st: Reload icon on style changes only if necessary
The parameters that may affect the icon on ::style-changed are more size
related than visual (we listen to icon theme changes for the latter). It
makes sense to just update the icon if the size came out different.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/524
2019-04-30 15:02:37 +02:00
Carlos Garnacho
fb04dafb0b st: Use g_signal_handler_disconnect() to disconnect from StTheme
With a high enough amount of actors, there may be enough theme nodes and
signal connections on StTheme::custom-stylesheets-changed that
g_signal_handlers_disconnect_by*() on dispose becomes expensive, this may
become a surprisingly hot spot in StWidget::style-changed.

Keep the handler ID around and use g_signal_handler_disconnect() to avoid
linear lookups for the matching func/data.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/524
2019-04-30 15:02:29 +02:00
Florian Müllner
d57234bec9 panel: Don't chain up to parent's allocate
The top bar handles allocating all its children itself, so there's
little value in chaining up to st_widget_allocate() and get the
default layout manager allocating all children again (and possibly
differently).

If this happens, we end up with an infinite allocation cycle with
corresponding performance penalty. Fix this by just doing and what
Shell.GenericContainer did before commit 286ffbe2b6 replaced it,
and not chain up to StWidget.

Thanks to Robert Mader for debugging the issue.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1054
2019-04-29 18:29:14 +00:00
Carlos Garnacho
38da54fb02 padOsd: Use non-deprecated librsvg API to create handle
On one hand, we were using a path instead of an URI on
rsvg_handle_set_base_uri(). This broke at some point in librsvg
(presumably for the best, handling paths there sounds non-standard)
leaving a blank svg (As the base image wouldn't be accessed).

On the other hand, we use this with the deprecated rsvg_handle_write()
which we should drift away from.

Using rsvg_handle_new_from_stream_sync() neatly solves both. We use
newer API based on input streams and GFiles, and it internally does
the right thing, bringing the pad OSD back to life.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/issues/1220
2019-04-27 05:50:08 +00:00
Marco Trevisan (Treviño)
bbd3275dad js: Check for this.constructor type instead of new.target
Use more ES6-inspired check for classes initializations.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
2019-04-26 20:48:52 -05:00
Marco Trevisan (Treviño)
3a3f9aa008 CyclerPopup: Check for type using constructor
Classes that are sub-classes of GObject don't use a constructor per se, so we
can't check for new.target (as this is undefined) in _init.

Then compare the current constructor name instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
2019-04-26 20:48:52 -05:00
Marco Trevisan (Treviño)
3c54e863e6 SwitcherPopup: Check for type using constructor
Classes that are sub-classes of GObject don't use a constructor per se, so we
can't check for new.target (as this is undefined) in _init.

Then compare the current constructor name instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/503
2019-04-26 20:48:52 -05:00
Florian Müllner
a63ba61194 keyboard: Disable emoji support on X11
Unlike regular keys that generate key events from a virtual device,
emoji keys rely on the input method to insert the character. However
as the compositor cannot inject IM events into ibus, this only works
in the shell's own entries on X11.

We shouldn't expose mostly broken functionality to the user, so limit
the feature to the wayland session.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/1172
2019-04-26 22:33:28 +00:00
Florian Müllner
ab9710ee7b ci: Improve script output
git-fetch's -q flag doesn't suppress warnings, so it's not a full
replacement of the redirection that was removed in commit 8cefd919.
Shut up the cryptic warning and replace it with a clearer log message
instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/511
2019-04-26 21:32:51 +02:00
Florian Müllner
43cef45229 ci: Try harder to find a matching mutter branch
Depending on how gitlab's CI checks out gnome-shell, the shell branch
may not have a local reference like "gnome-3-32", but only a remote
one like "remotes/origin/gnome-3-32".

Consider that case as well when looking for a corresponding mutter branch.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/511
2019-04-26 21:32:51 +02:00
Florian Müllner
8db4f3c67f ci: Handle merge requests for non-master branches
If we don't find a branch that matches the branch used in the merge
request, we currently fall back to the non-merge-request matching,
i.e. first try the current shell branch, then fall back to master.

This should work for commits to upstream branches, but not for merge
requests to a stable branch. For those, the target branch name is
a better fallback.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/509
2019-04-26 21:32:51 +02:00
Florian Müllner
594a070029 ci: Fix checking out mutter for stable branches
Remote branches always start with the remote itself, so just looking
for "gnome-3-32" etc. won't produce a match.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/509
2019-04-26 21:32:51 +02:00
Florian Müllner
c2e04e3cfa ci: Silence some warnings
... as suggested by Jonas in mutter!548.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/509
2019-04-26 21:32:51 +02:00
Jonas Dreßler
293f50e8e5 accessibility: Add settings changed signal handler after creating widget
Move the signal handlers for changed settings to be connected after the
creation of the menu items to make sure a reference to the item is set.

While it also worked fine before, this solution certainly looks cleaner.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/512
2019-04-26 18:47:45 +00:00
25 changed files with 311 additions and 417 deletions

View File

@@ -17,15 +17,19 @@ if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
merge_request_branch=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
echo Looking for $merge_request_branch on remote ...
if git fetch $merge_request_remote $merge_request_branch >/dev/null 2>&1; then
if git fetch -q $merge_request_remote $merge_request_branch 2>/dev/null; then
mutter_target=FETCH_HEAD
else
mutter_target=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME
echo Using $mutter_target instead
fi
fi
if [ -z "$mutter_target" ]; then
mutter_target=$(git branch -r -l $shell_branch)
mutter_target=$(git branch -r -l origin/$shell_branch)
mutter_target=${mutter_target:-$(git branch -r -l ${shell_branch#remotes/})}
mutter_target=${mutter_target:-origin/master}
echo Using $mutter_target instead
fi
git checkout $mutter_target
git checkout -q $mutter_target

View File

@@ -477,8 +477,8 @@ var CyclerList = GObject.registerClass({
var CyclerPopup = GObject.registerClass(
class CyclerPopup extends SwitcherPopup.SwitcherPopup {
_init() {
if (new.target === CyclerPopup)
throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
if (this.constructor.name === CyclerPopup.prototype.constructor.name)
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
super._init();

View File

@@ -98,8 +98,8 @@ function clamp(value, min, max) {
class BaseAppView {
constructor(params, gridParams) {
if (new.target === BaseAppView)
throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
if (this.constructor === BaseAppView)
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
gridParams = Params.parse(gridParams, { xAlign: St.Align.MIDDLE,
columnLimit: MAX_COLUMNS,

View File

@@ -118,7 +118,7 @@ var WorldClocksSection = class WorldClocksSection {
if (!clocks[i].location)
continue;
let l = world.deserialize(clocks[i].location);
if (l)
if (l && l.get_timezone() != null)
this._locations.push({ location: l });
}

View File

@@ -175,10 +175,10 @@ var MessageDialogContent = GObject.registerClass({
this[`_${prop}`].add_style_class_name(`message-dialog-${prop}`);
});
let textProps = { ellipsize_mode: Pango.EllipsizeMode.NONE,
let textProps = { ellipsize: Pango.EllipsizeMode.NONE,
line_wrap: true };
Object.assign(this._subtitle.clutter_text, textProps);
Object.assign(this._body.clutter_text, textProps);
this._subtitle.clutter_text.set(textProps);
this._body.clutter_text.set(textProps);
if (!params.hasOwnProperty('style_class'))
params.style_class = 'message-dialog-main-layout';

View File

@@ -1049,7 +1049,7 @@ var Keyboard = class Keyboard {
this._a11yApplicationsSettings.connect('changed', this._syncEnabled.bind(this));
this._lastDeviceId = null;
this._suggestions = null;
this._emojiKeyVisible = true;
this._emojiKeyVisible = Meta.is_wayland_compositor();
this._focusTracker = new FocusTracker();
this._focusTracker.connect('position-changed', this._onFocusPositionChanged.bind(this));
@@ -1162,7 +1162,7 @@ var Keyboard = class Keyboard {
this._keyboardController = new KeyboardController();
this._groups = {};
this._current_page = null;
this._currentPage = null;
this._suggestions = new Suggestions();
this.actor.add(this._suggestions.actor,
@@ -1202,10 +1202,12 @@ var Keyboard = class Keyboard {
this._keyboardNotifyId = this._keyboardController.connect('active-group', this._onGroupChanged.bind(this));
this._keyboardGroupsChangedId = this._keyboardController.connect('groups-changed', this._onKeyboardGroupsChanged.bind(this));
this._keyboardStateId = this._keyboardController.connect('panel-state', this._onKeyboardStateChanged.bind(this));
this._emojiKeyVisibleId = this._keyboardController.connect('emoji-visible', this._onEmojiKeyVisible.bind(this));
this._keypadVisibleId = this._keyboardController.connect('keypad-visible', this._onKeypadVisible.bind(this));
this._focusNotifyId = global.stage.connect('notify::key-focus', this._onKeyFocusChanged.bind(this));
if (Meta.is_wayland_compositor())
this._emojiKeyVisibleId = this._keyboardController.connect('emoji-visible', this._onEmojiKeyVisible.bind(this));
this._relayout();
}
@@ -1353,7 +1355,7 @@ var Keyboard = class Keyboard {
} else if (switchToLevel == 1) {
extraButton.connect('long-press', () => {
this._latched = true;
this._setCurrentLevelLatched(this._current_page, this._latched);
this._setCurrentLevelLatched(this._currentPage, this._latched);
});
}
@@ -1380,8 +1382,8 @@ var Keyboard = class Keyboard {
}
_updateCurrentPageVisible() {
if (this._current_page)
this._current_page.visible = !this._emojiActive && !this._keypadVisible;
if (this._currentPage)
this._currentPage.visible = !this._emojiActive && !this._keypadVisible;
}
_setEmojiActive(active) {
@@ -1440,7 +1442,7 @@ var Keyboard = class Keyboard {
_getGridSlots() {
let numOfHorizSlots = 0, numOfVertSlots;
let rows = this._current_page.get_children();
let rows = this._currentPage.get_children();
numOfVertSlots = rows.length;
for (let i = 0; i < rows.length; ++i) {
@@ -1470,7 +1472,13 @@ var Keyboard = class Keyboard {
}
_onKeyboardGroupsChanged(keyboard) {
this._groups = [];
let nonGroupActors = [this._emojiSelection.actor, this._keypad.actor];
this._aspectContainer.get_children().filter(c => !nonGroupActors.includes(c)).forEach(c => {
c.destroy();
});
this._currentPage = null;
this._groups = {};
this._onGroupChanged();
}
@@ -1513,12 +1521,12 @@ var Keyboard = class Keyboard {
let activeGroupName = this._keyboardController.getCurrentGroup();
let layers = this._groups[activeGroupName];
if (this._current_page != null) {
this._setCurrentLevelLatched(this._current_page, false);
this._current_page.hide();
if (this._currentPage != null) {
this._setCurrentLevelLatched(this._currentPage, false);
this._currentPage.hide();
}
this._current_page = layers[activeLevel];
this._currentPage = layers[activeLevel];
this._updateCurrentPageVisible();
}

View File

@@ -369,17 +369,15 @@ class DashSpacer extends St.Widget {
}
vfunc_get_preferred_width(forHeight) {
let box = this.get_allocation_box();
let minWidth = super.vfunc_get_preferred_width(forHeight)[0];
let natWidth = box.x2 - box.x1;
return [minWidth, natWidth];
if (this._bindConstraint)
return this._bindConstraint.source.get_preferred_width(forHeight);
return super.vfunc_get_preferred_width(forHeight);
}
vfunc_get_preferred_height(forWidth) {
let box = this.get_allocation_box();
let minHeight = super.vfunc_get_preferred_height(forWidth)[0];
let natHeight = box.y2 - box.y1;
return [minHeight, natHeight];
if (this._bindConstraint)
return this._bindConstraint.source.get_preferred_height(forWidth);
return super.vfunc_get_preferred_height(forWidth);
}
});

View File

@@ -374,12 +374,12 @@ var PadDiagram = GObject.registerClass({
svgData += this._cssString();
svgData += this._wrappingSvgFooter();
let handle = new Rsvg.Handle();
handle.set_base_uri(GLib.path_get_dirname(this._imagePath));
handle.write(svgData);
handle.close();
let istream = new Gio.MemoryInputStream();
istream.add_bytes(new GLib.Bytes(svgData));
return handle;
return Rsvg.Handle.new_from_stream_sync(istream,
Gio.File.new_for_path(this._imagePath),
0, null);
}
_updateDiagramScale() {

View File

@@ -877,7 +877,7 @@ class Panel extends St.Widget {
}
vfunc_allocate(box, flags) {
super.vfunc_allocate(box, flags);
this.set_allocation(box, flags);
let allocWidth = box.x2 - box.x1;
let allocHeight = box.y2 - box.y1;
@@ -971,22 +971,11 @@ class Panel extends St.Widget {
if (isPress && button != 1)
return Clutter.EVENT_PROPAGATE;
let focusWindow = global.display.focus_window;
if (!focusWindow)
return Clutter.EVENT_PROPAGATE;
let dragWindow = focusWindow.is_attached_dialog() ? focusWindow.get_transient_for()
: focusWindow;
if (!dragWindow)
return Clutter.EVENT_PROPAGATE;
let rect = dragWindow.get_frame_rect();
let [stageX, stageY] = event.get_coords();
let allowDrag = dragWindow.maximized_vertically &&
stageX > rect.x && stageX < rect.x + rect.width;
let dragWindow = this._getDraggableWindowForPosition(stageX);
if (!allowDrag)
if (!dragWindow)
return Clutter.EVENT_PROPAGATE;
global.display.begin_grab_op(dragWindow,
@@ -1196,4 +1185,21 @@ class Panel extends St.Widget {
Main.messageTray.bannerBlocked = isOpen;
});
}
_getDraggableWindowForPosition(stageX) {
let workspaceManager = global.workspace_manager;
let workspace = workspaceManager.get_active_workspace()
let allWindowsByStacking = global.display.sort_windows_by_stacking(
workspace.list_windows()
).reverse();
return allWindowsByStacking.find(metaWindow => {
let rect = metaWindow.get_frame_rect();
return metaWindow.is_on_primary_monitor() &&
metaWindow.showing_on_its_workspace() &&
metaWindow.get_window_type() != Meta.WindowType.DESKTOP &&
metaWindow.maximized_vertically &&
stageX > rect.x && stageX < rect.x + rect.width
});
}
});

View File

@@ -397,8 +397,8 @@ var PopupImageMenuItem = class extends PopupBaseMenuItem {
var PopupMenuBase = class {
constructor(sourceActor, styleClass) {
if (new.target === PopupMenuBase)
throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
if (this.constructor === PopupMenuBase)
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
this.sourceActor = sourceActor;
this._parent = null;

View File

@@ -112,38 +112,22 @@ class ATIndicator extends PanelMenu.Button {
_buildItem(string, schema, key) {
let settings = new Gio.Settings({ schema_id: schema });
settings.connect('changed::'+key, () => {
let widget = this._buildItemExtended(string,
settings.get_boolean(key),
settings.is_writable(key),
enabled => settings.set_boolean(key, enabled));
settings.connect('changed::' + key, () => {
widget.setToggleState(settings.get_boolean(key));
this._queueSyncMenuVisibility();
});
let widget = this._buildItemExtended(string,
settings.get_boolean(key),
settings.is_writable(key),
enabled => settings.set_boolean(key, enabled));
return widget;
}
_buildHCItem() {
let interfaceSettings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
interfaceSettings.connect('changed::' + KEY_GTK_THEME, () => {
let value = interfaceSettings.get_string(KEY_GTK_THEME);
if (value == HIGH_CONTRAST_THEME) {
highContrast.setToggleState(true);
} else {
highContrast.setToggleState(false);
gtkTheme = value;
}
this._queueSyncMenuVisibility();
});
interfaceSettings.connect('changed::' + KEY_ICON_THEME, () => {
let value = interfaceSettings.get_string(KEY_ICON_THEME);
if (value != HIGH_CONTRAST_THEME)
iconTheme = value;
});
let gtkTheme = interfaceSettings.get_string(KEY_GTK_THEME);
let iconTheme = interfaceSettings.get_string(KEY_ICON_THEME);
let hasHC = (gtkTheme == HIGH_CONTRAST_THEME);
@@ -164,19 +148,30 @@ class ATIndicator extends PanelMenu.Button {
interfaceSettings.reset(KEY_ICON_THEME);
}
});
interfaceSettings.connect('changed::' + KEY_GTK_THEME, () => {
let value = interfaceSettings.get_string(KEY_GTK_THEME);
if (value == HIGH_CONTRAST_THEME) {
highContrast.setToggleState(true);
} else {
highContrast.setToggleState(false);
gtkTheme = value;
}
this._queueSyncMenuVisibility();
});
interfaceSettings.connect('changed::' + KEY_ICON_THEME, () => {
let value = interfaceSettings.get_string(KEY_ICON_THEME);
if (value != HIGH_CONTRAST_THEME)
iconTheme = value;
});
return highContrast;
}
_buildFontItem() {
let settings = new Gio.Settings({ schema_id: DESKTOP_INTERFACE_SCHEMA });
settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, () => {
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let active = (factor > 1.0);
widget.setToggleState(active);
this._queueSyncMenuVisibility();
});
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let initial_setting = (factor > 1.0);
let widget = this._buildItemExtended(_("Large Text"),
@@ -189,6 +184,15 @@ class ATIndicator extends PanelMenu.Button {
else
settings.reset(KEY_TEXT_SCALING_FACTOR);
});
settings.connect('changed::' + KEY_TEXT_SCALING_FACTOR, () => {
let factor = settings.get_double(KEY_TEXT_SCALING_FACTOR);
let active = (factor > 1.0);
widget.setToggleState(active);
this._queueSyncMenuVisibility();
});
return widget;
}
});

View File

@@ -125,8 +125,8 @@ class InputSourceSwitcher extends SwitcherPopup.SwitcherList {
var InputSourceSettings = class {
constructor() {
if (new.target === InputSourceSettings)
throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
if (this.constructor === InputSourceSettings)
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
}
_emitInputSourcesChanged() {

View File

@@ -167,10 +167,10 @@ var NMConnectionItem = class {
};
Signals.addSignalMethods(NMConnectionItem.prototype);
var NMConnectionSection = class {
var NMConnectionSection = class NMConnectionSection {
constructor(client) {
if (new.target === NMConnectionSection)
throw new TypeError('Cannot instantiate abstract type ' + new.target.name);
if (this.constructor === NMConnectionSection)
throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`);
this._client = client;
@@ -297,12 +297,13 @@ var NMConnectionSection = class {
};
Signals.addSignalMethods(NMConnectionSection.prototype);
var NMConnectionDevice = class extends NMConnectionSection {
var NMConnectionDevice = class NMConnectionDevice extends NMConnectionSection {
constructor(client, device) {
if (new.target === NMConnectionDevice)
throw new TypeError('Cannot instantiate abstract type ' + new.target.name);
super(client);
if (this.constructor === NMConnectionDevice)
throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`);
this._device = device;
this._description = '';

View File

@@ -33,8 +33,8 @@ function primaryModifier(mask) {
var SwitcherPopup = GObject.registerClass(
class SwitcherPopup extends St.Widget {
_init(items) {
if (new.target === SwitcherPopup)
throw new TypeError('Cannot instantiate abstract class ' + new.target.name);
if (this.constructor.name === SwitcherPopup.prototype.constructor.name)
throw new TypeError(`Cannot instantiate abstract class ${this.constructor.name}`);
super._init({ style_class: 'switcher-popup',
reactive: true,

View File

@@ -1870,17 +1870,25 @@ var WindowManager = class {
}
}
_getPositionForDirection(direction) {
_getPositionForDirection(direction, fromWs, toWs) {
let xDest = 0, yDest = 0;
let oldWsIsFullscreen = fromWs.list_windows().some(w => w.is_fullscreen());
let newWsIsFullscreen = toWs.list_windows().some(w => w.is_fullscreen());
// We have to shift windows up or down by the height of the panel to prevent having a
// visible gap between the windows while switching workspaces. Since fullscreen windows
// hide the panel, they don't need to be shifted up or down.
let shiftHeight = Main.panel.height;
if (direction == Meta.MotionDirection.UP ||
direction == Meta.MotionDirection.UP_LEFT ||
direction == Meta.MotionDirection.UP_RIGHT)
yDest = -global.screen_height + Main.panel.height;
yDest = -global.screen_height + (oldWsIsFullscreen ? 0 : shiftHeight);
else if (direction == Meta.MotionDirection.DOWN ||
direction == Meta.MotionDirection.DOWN_LEFT ||
direction == Meta.MotionDirection.DOWN_RIGHT)
yDest = global.screen_height - Main.panel.height;
yDest = global.screen_height - (newWsIsFullscreen ? 0 : shiftHeight);
if (direction == Meta.MotionDirection.LEFT ||
direction == Meta.MotionDirection.UP_LEFT ||
@@ -1938,7 +1946,7 @@ var WindowManager = class {
switchData.container.add_actor(info.actor);
info.actor.raise_top();
let [x, y] = this._getPositionForDirection(dir);
let [x, y] = this._getPositionForDirection(dir, curWs, ws);
info.actor.set_position(x, y);
}
@@ -2024,7 +2032,11 @@ var WindowManager = class {
this._switchData.inProgress = true;
let [xDest, yDest] = this._getPositionForDirection(direction);
let workspaceManager = global.workspace_manager;
let fromWs = workspaceManager.get_workspace_by_index(from);
let toWs = workspaceManager.get_workspace_by_index(to);
let [xDest, yDest] = this._getPositionForDirection(direction, fromWs, toWs);
/* @direction is the direction that the "camera" moves, so the
* screen contents have to move one screen's worth in the

View File

@@ -786,8 +786,8 @@ var WindowPositionFlags = {
var LayoutStrategy = class {
constructor(monitor, rowSpacing, columnSpacing) {
if (new.target === LayoutStrategy)
throw new TypeError('Cannot instantiate abstract type ' + new.target.name);
if (this.constructor === LayoutStrategy)
throw new TypeError(`Cannot instantiate abstract type ${this.constructor.name}`);
this._monitor = monitor;
this._rowSpacing = rowSpacing;

View File

@@ -6,22 +6,22 @@
# Daniel PUENTES <blatberk@openmailbox.org>, 2015.
# Nicolas MAIA < >, 2015.
# Kristjan SCHMIDT <kristjan.schmidt@googlemail.com>, 2011, 2012, 2015, 2016, 2018.
# Carmen Bianca BAKKER <carmen@carmenbianca.eu>, 2018, 2019.
# Carmen Bianca BAKKER <carmen@carmenbianca.eu>, 2018-2019.
#
msgid ""
msgstr ""
"Project-Id-Version: gnome-shell master\n"
"Report-Msgid-Bugs-To: https://gitlab.gnome.org/GNOME/gnome-shell/issues\n"
"POT-Creation-Date: 2019-03-24 17:37+0000\n"
"PO-Revision-Date: 2019-03-31 00:14+0100\n"
"Last-Translator: Carmen Bianca Bakker <carmen@carmenbianca.eu>\n"
"POT-Creation-Date: 2019-04-17 19:29+0000\n"
"PO-Revision-Date: 2019-05-01 16:29+0200\n"
"Last-Translator: Carmen Bianca BAKKER <carmen@carmenbianca.eu>\n"
"Language-Team: Esperanto <gnome-eo-list@gnome.org>\n"
"Language: eo\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.2.1\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"X-Generator: Gtranslator 3.32.0\n"
"X-DamnedLies-Scope: partial\n"
"X-Project-Style: gnome\n"
@@ -681,32 +681,38 @@ msgstr "Oftaj"
msgid "All"
msgstr "Ĉiuj"
#: js/ui/appDisplay.js:1737 js/ui/panel.js:83
#. Translators: This is the heading of a list of open windows
#: js/ui/appDisplay.js:1713 js/ui/panel.js:79
#| msgid "Windows"
msgid "Open Windows"
msgstr "Malfermaj fenestroj"
#: js/ui/appDisplay.js:1732 js/ui/panel.js:86
msgid "New Window"
msgstr "Nova fenestro"
#: js/ui/appDisplay.js:1751
#: js/ui/appDisplay.js:1746
msgid "Launch using Dedicated Graphics Card"
msgstr "Lanĉi uzante dediĉitan vidkarton"
#: js/ui/appDisplay.js:1778 js/ui/dash.js:239
#: js/ui/appDisplay.js:1773 js/ui/dash.js:239
msgid "Remove from Favorites"
msgstr "Forigi el preferataj"
#: js/ui/appDisplay.js:1784
#: js/ui/appDisplay.js:1779
msgid "Add to Favorites"
msgstr "Aldoni al preferataj"
#: js/ui/appDisplay.js:1794 js/ui/panel.js:94
#: js/ui/appDisplay.js:1789 js/ui/panel.js:97
msgid "Show Details"
msgstr "Montri detalojn"
#: js/ui/appFavorites.js:141
#: js/ui/appFavorites.js:149
#, javascript-format
msgid "%s has been added to your favorites."
msgstr "%s estas aldonita de via preferataj aplikaĵoj."
#: js/ui/appFavorites.js:175
#: js/ui/appFavorites.js:183
#, javascript-format
msgid "%s has been removed from your favorites."
msgstr "%s estas forigita de via preferataj aplikaĵoj."
@@ -1060,23 +1066,23 @@ msgstr "Aldoni mondajn horloĝojn…"
msgid "World Clocks"
msgstr "Mondaj horloĝoj"
#: js/ui/dateMenu.js:222
#: js/ui/dateMenu.js:228
msgid "Weather"
msgstr "Vetero"
#: js/ui/dateMenu.js:305
#: js/ui/dateMenu.js:311
msgid "Select a location…"
msgstr "Elekti lokon…"
#: js/ui/dateMenu.js:313
#: js/ui/dateMenu.js:319
msgid "Loading…"
msgstr "Ŝargante…"
#: js/ui/dateMenu.js:323
#: js/ui/dateMenu.js:329
msgid "Go online for weather information"
msgstr "Enretigi por veterinformoj"
#: js/ui/dateMenu.js:325
#: js/ui/dateMenu.js:331
msgid "Weather information is currently unavailable"
msgstr "Veterinformoj ĉimomente nehaveblas"
@@ -1452,34 +1458,25 @@ msgstr "Premu Esk-klavon por ĉesi"
msgid "Press any key to exit"
msgstr "Premu iun ajn klavon por ĉesi"
#: js/ui/panel.js:108
#: js/ui/panel.js:113
msgid "Quit"
msgstr "Ĉesi"
#. Translators: If there is no suitable word for "Activities"
#. in your language, you can use the word for "Overview".
#: js/ui/panel.js:471
#: js/ui/panel.js:468
msgid "Activities"
msgstr "Aktivecoj"
#: js/ui/panel.js:746
#: js/ui/panel.js:743
msgctxt "System menu in the top bar"
msgid "System"
msgstr "Sistemo"
#: js/ui/panel.js:867
#: js/ui/panel.js:864
msgid "Top Bar"
msgstr "Supra breto"
#. Translators: this MUST be either "toggle-switch-us"
#. (for toggle switches containing the English words
#. "ON" and "OFF") or "toggle-switch-intl" (for toggle
#. switches containing "◯" and "|"). Other values will
#. simply result in invisible toggle switches.
#: js/ui/popupMenu.js:285
msgid "toggle-switch-us"
msgstr "toggle-switch-intl"
#: js/ui/runDialog.js:64
msgid "Enter a Command"
msgstr "Enigu komandon"
@@ -1889,11 +1886,11 @@ msgid_plural "%s Modem Connections"
msgstr[0] "%s modema konekto"
msgstr[1] "%s modemaj konektoj"
#: js/ui/status/network.js:1701
#: js/ui/status/network.js:1705
msgid "Connection failed"
msgstr "Konekto malsukcesis"
#: js/ui/status/network.js:1702
#: js/ui/status/network.js:1706
msgid "Activation of network connection failed"
msgstr "Aktivigo de reto-konekto malsukcesis"
@@ -2098,7 +2095,7 @@ msgstr[1] "Agordaj ŝanĝoj malfaritos post %d sekundoj"
#. Translators: This represents the size of a window. The first number is
#. * the width of the window and the second is the height.
#: js/ui/windowManager.js:662
#: js/ui/windowManager.js:677
#, javascript-format
msgid "%d × %d"
msgstr "%d × %d"
@@ -2231,6 +2228,9 @@ msgstr[1] "%u enigoj"
msgid "System Sounds"
msgstr "Sistemsonoj"
#~ msgid "toggle-switch-us"
#~ msgstr "toggle-switch-intl"
#~ msgid "network-workgroup"
#~ msgstr "network-workgroup"

View File

@@ -863,6 +863,7 @@ _shell_global_set_plugin (ShellGlobal *global,
}
st_entry_set_cursor_func (entry_cursor_func, global);
st_clipboard_set_selection (meta_display_get_selection (display));
g_signal_connect (global->stage, "notify::width",
G_CALLBACK (global_stage_notify_width), global);

View File

@@ -125,7 +125,7 @@ st_cflags = [
libst = shared_library('st-1.0',
sources: st_gir_sources + st_non_gir_sources,
c_args: st_cflags,
dependencies: [clutter_dep, gtk_dep, croco_dep, x11_dep, m_dep],
dependencies: [clutter_dep, gtk_dep, croco_dep, mutter_dep, m_dep],
build_rpath: mutter_typelibdir,
install_rpath: mutter_typelibdir,
install_dir: pkglibdir,
@@ -152,7 +152,7 @@ libst_gir = gnome.generate_gir(libst,
sources: st_gir_sources,
nsversion: '1.0',
namespace: 'St',
includes: ['Clutter-' + mutter_api_version, 'Cally-' + mutter_api_version, 'Gtk-3.0'],
includes: ['Clutter-' + mutter_api_version, 'Cally-' + mutter_api_version, 'Meta-' + mutter_api_version, 'Gtk-3.0'],
dependencies: [mutter_dep],
include_directories: include_directories('..'),
extra_args: ['-DST_COMPILATION', '--quiet'],

View File

@@ -19,251 +19,49 @@
/**
* SECTION:st-clipboard
* @short_description: a simple representation of the X clipboard
* @short_description: a simple representation of the clipboard
*
* #StCliboard is a very simple object representation of the clipboard
* available to applications. Text is always assumed to be UTF-8 and non-text
* items are not handled.
*/
#include "config.h"
#include "st-clipboard.h"
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <string.h>
struct _StClipboardPrivate
{
Window clipboard_window;
gchar *clipboard_text;
#include <meta/display.h>
#include <meta/meta-selection-source-memory.h>
#include <meta/meta-selection.h>
Atom *supported_targets;
gint n_targets;
};
G_DEFINE_TYPE (StClipboard, st_clipboard, G_TYPE_OBJECT)
G_DEFINE_TYPE_WITH_PRIVATE (StClipboard, st_clipboard, G_TYPE_OBJECT)
typedef struct _EventFilterData EventFilterData;
struct _EventFilterData
typedef struct _TransferData TransferData;
struct _TransferData
{
StClipboard *clipboard;
StClipboardCallbackFunc callback;
gpointer user_data;
GOutputStream *stream;
};
static Atom __atom_primary = None;
static Atom __atom_clip = None;
static Atom __utf8_string = None;
static Atom __atom_targets = None;
static void
st_clipboard_dispose (GObject *object)
{
G_OBJECT_CLASS (st_clipboard_parent_class)->dispose (object);
}
static void
st_clipboard_finalize (GObject *object)
{
StClipboardPrivate *priv = ((StClipboard *) object)->priv;
g_free (priv->clipboard_text);
priv->clipboard_text = NULL;
g_free (priv->supported_targets);
priv->supported_targets = NULL;
priv->n_targets = 0;
G_OBJECT_CLASS (st_clipboard_parent_class)->finalize (object);
}
static GdkFilterReturn
st_clipboard_provider (GdkXEvent *xevent_p,
GdkEvent *gev,
void *user_data)
{
StClipboard *clipboard = user_data;
XEvent *xev = (XEvent *) xevent_p;
XSelectionEvent notify_event;
XSelectionRequestEvent *req_event;
GdkDisplay *display = gdk_display_get_default ();
if (xev->type != SelectionRequest ||
xev->xany.window != clipboard->priv->clipboard_window ||
!clipboard->priv->clipboard_text)
return GDK_FILTER_CONTINUE;
req_event = &xev->xselectionrequest;
gdk_x11_display_error_trap_push (display);
if (req_event->target == __atom_targets)
{
XChangeProperty (req_event->display,
req_event->requestor,
req_event->property,
XA_ATOM,
32,
PropModeReplace,
(guchar*) clipboard->priv->supported_targets,
clipboard->priv->n_targets);
}
else
{
XChangeProperty (req_event->display,
req_event->requestor,
req_event->property,
req_event->target,
8,
PropModeReplace,
(guchar*) clipboard->priv->clipboard_text,
strlen (clipboard->priv->clipboard_text));
}
notify_event.type = SelectionNotify;
notify_event.display = req_event->display;
notify_event.requestor = req_event->requestor;
notify_event.selection = req_event->selection;
notify_event.target = req_event->target;
notify_event.time = req_event->time;
if (req_event->property == None)
notify_event.property = req_event->target;
else
notify_event.property = req_event->property;
/* notify the requestor that they have a copy of the selection */
XSendEvent (req_event->display, req_event->requestor, False, 0,
(XEvent *) &notify_event);
/* Make it happen non async */
XSync (GDK_DISPLAY_XDISPLAY (display), FALSE);
if (gdk_x11_display_error_trap_pop (display))
{
/* FIXME: Warn here on fail ? */
}
return GDK_FILTER_REMOVE;
}
const char *supported_mimetypes[] = {
"text/plain;charset=utf-8",
"UTF8_STRING",
"text/plain",
"STRING",
};
static MetaSelection *meta_selection = NULL;
static void
st_clipboard_class_init (StClipboardClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = st_clipboard_dispose;
object_class->finalize = st_clipboard_finalize;
}
static void
st_clipboard_init (StClipboard *self)
{
GdkDisplay *gdk_display;
Display *dpy;
StClipboardPrivate *priv;
priv = self->priv = st_clipboard_get_instance_private (self);
gdk_display = gdk_display_get_default ();
dpy = GDK_DISPLAY_XDISPLAY (gdk_display);
priv->clipboard_window =
XCreateSimpleWindow (dpy,
gdk_x11_get_default_root_xwindow (),
-1, -1, 1, 1, 0, 0, 0);
/* Only create once */
if (__atom_primary == None)
__atom_primary = XInternAtom (dpy, "PRIMARY", 0);
if (__atom_clip == None)
__atom_clip = XInternAtom (dpy, "CLIPBOARD", 0);
if (__utf8_string == None)
__utf8_string = XInternAtom (dpy, "UTF8_STRING", 0);
if (__atom_targets == None)
__atom_targets = XInternAtom (dpy, "TARGETS", 0);
priv->n_targets = 2;
priv->supported_targets = g_new (Atom, priv->n_targets);
priv->supported_targets[0] = __utf8_string;
priv->supported_targets[1] = __atom_targets;
gdk_window_add_filter (NULL, /* all windows */
st_clipboard_provider,
self);
}
static GdkFilterReturn
st_clipboard_x11_event_filter (GdkXEvent *xevent_p,
GdkEvent *gev,
void *user_data)
{
XEvent *xev = (XEvent *) xevent_p;
EventFilterData *filter_data = user_data;
StClipboardPrivate *priv = filter_data->clipboard->priv;
Atom actual_type;
int actual_format, result;
unsigned long nitems, bytes_after;
unsigned char *data = NULL;
GdkDisplay *display = gdk_display_get_default ();
if(xev->type != SelectionNotify ||
xev->xany.window != priv->clipboard_window)
return GDK_FILTER_CONTINUE;
if (xev->xselection.property == None)
{
/* clipboard empty */
filter_data->callback (filter_data->clipboard,
NULL,
filter_data->user_data);
gdk_window_remove_filter (NULL,
st_clipboard_x11_event_filter,
filter_data);
g_free (filter_data);
return GDK_FILTER_REMOVE;
}
gdk_x11_display_error_trap_push (display);
result = XGetWindowProperty (xev->xselection.display,
xev->xselection.requestor,
xev->xselection.property,
0L, G_MAXINT,
True,
AnyPropertyType,
&actual_type,
&actual_format,
&nitems,
&bytes_after,
&data);
if (gdk_x11_display_error_trap_pop (display) || result != Success)
{
/* FIXME: handle failure better */
g_warning ("Clipboard: prop retrival failed");
}
filter_data->callback (filter_data->clipboard, (char*) data,
filter_data->user_data);
gdk_window_remove_filter (NULL,
st_clipboard_x11_event_filter,
filter_data);
g_free (filter_data);
if (data)
XFree (data);
return GDK_FILTER_REMOVE;
}
/**
@@ -287,10 +85,57 @@ st_clipboard_get_default (void)
return default_clipboard;
}
static Atom
atom_for_clipboard_type (StClipboardType type)
static gboolean
convert_type (StClipboardType type,
MetaSelectionType *type_out)
{
return type == ST_CLIPBOARD_TYPE_CLIPBOARD ? __atom_clip : __atom_primary;
if (type == ST_CLIPBOARD_TYPE_PRIMARY)
*type_out = META_SELECTION_PRIMARY;
else if (type == ST_CLIPBOARD_TYPE_CLIPBOARD)
*type_out = META_SELECTION_CLIPBOARD;
else
return FALSE;
return TRUE;
}
static const char *
pick_mimetype (MetaSelection *meta_selection,
MetaSelectionType selection_type)
{
const char *selected_mimetype = NULL;
GList *mimetypes;
int i;
mimetypes = meta_selection_get_mimetypes (meta_selection, selection_type);
for (i = 0; i < G_N_ELEMENTS (supported_mimetypes); i++)
{
if (g_list_find_custom (mimetypes, supported_mimetypes[i],
(GCompareFunc) g_strcmp0))
{
selected_mimetype = supported_mimetypes[i];
break;
}
}
g_list_free_full (mimetypes, g_free);
return selected_mimetype;
}
static void
transfer_cb (MetaSelection *selection,
GAsyncResult *res,
TransferData *data)
{
const gchar *text = NULL;
if (meta_selection_transfer_finish (selection, res, NULL))
text = g_memory_output_stream_get_data (G_MEMORY_OUTPUT_STREAM (data->stream));
data->callback (data->clipboard, text, data->user_data);
g_object_unref (data->stream);
g_free (data);
}
/**
@@ -310,37 +155,35 @@ st_clipboard_get_text (StClipboard *clipboard,
StClipboardCallbackFunc callback,
gpointer user_data)
{
EventFilterData *data;
GdkDisplay *gdk_display;
Display *dpy;
MetaSelectionType selection_type;
TransferData *data;
const char *mimetype = NULL;
g_return_if_fail (ST_IS_CLIPBOARD (clipboard));
g_return_if_fail (meta_selection != NULL);
g_return_if_fail (callback != NULL);
data = g_new0 (EventFilterData, 1);
if (convert_type (type, &selection_type))
mimetype = pick_mimetype (meta_selection, selection_type);
if (!mimetype)
{
callback (clipboard, NULL, user_data);
return;
}
data = g_new0 (TransferData, 1);
data->clipboard = clipboard;
data->callback = callback;
data->user_data = user_data;
data->stream = g_memory_output_stream_new_resizable ();
gdk_window_add_filter (NULL, /* all windows */
st_clipboard_x11_event_filter,
data);
gdk_display = gdk_display_get_default ();
dpy = GDK_DISPLAY_XDISPLAY (gdk_display);
gdk_x11_display_error_trap_push (gdk_display);
XConvertSelection (dpy,
atom_for_clipboard_type (type),
__utf8_string, __utf8_string,
clipboard->priv->clipboard_window,
CurrentTime);
if (gdk_x11_display_error_trap_pop (gdk_display))
{
/* FIXME */
}
meta_selection_transfer_async (meta_selection,
selection_type,
mimetype, -1,
data->stream, NULL,
(GAsyncReadyCallback) transfer_cb,
data);
}
/**
@@ -356,31 +199,26 @@ st_clipboard_set_text (StClipboard *clipboard,
StClipboardType type,
const gchar *text)
{
StClipboardPrivate *priv;
GdkDisplay *gdk_display;
Display *dpy;
MetaSelectionType selection_type;
MetaSelectionSource *source;
GBytes *bytes;
g_return_if_fail (ST_IS_CLIPBOARD (clipboard));
g_return_if_fail (meta_selection != NULL);
g_return_if_fail (text != NULL);
priv = clipboard->priv;
if (!convert_type (type, &selection_type))
return;
/* make a copy of the text */
g_free (priv->clipboard_text);
priv->clipboard_text = g_strdup (text);
bytes = g_bytes_new_take (g_strdup (text), strlen (text));
source = meta_selection_source_memory_new ("text/plain;charset=utf-8", bytes);
g_bytes_unref (bytes);
/* tell X we own the clipboard selection */
gdk_display = gdk_display_get_default ();
dpy = GDK_DISPLAY_XDISPLAY (gdk_display);
gdk_x11_display_error_trap_push (gdk_display);
XSetSelectionOwner (dpy, atom_for_clipboard_type (type), priv->clipboard_window, CurrentTime);
XSync (dpy, FALSE);
if (gdk_x11_display_error_trap_pop (gdk_display))
{
/* FIXME */
}
meta_selection_set_owner (meta_selection, selection_type, source);
}
void
st_clipboard_set_selection (MetaSelection *selection)
{
meta_selection = selection;
}

View File

@@ -25,6 +25,7 @@
#define _ST_CLIPBOARD_H
#include <glib-object.h>
#include <meta/meta-selection.h>
G_BEGIN_DECLS
@@ -32,7 +33,6 @@ G_BEGIN_DECLS
G_DECLARE_FINAL_TYPE (StClipboard, st_clipboard, ST, CLIPBOARD, GObject)
typedef struct _StClipboard StClipboard;
typedef struct _StClipboardPrivate StClipboardPrivate;
/**
* StClipboard:
@@ -44,7 +44,6 @@ struct _StClipboard
{
/*< private >*/
GObject parent;
StClipboardPrivate *priv;
};
typedef enum {
@@ -74,6 +73,8 @@ void st_clipboard_set_text (StClipboard *clipboard,
StClipboardType type,
const gchar *text);
void st_clipboard_set_selection (MetaSelection *selection);
G_END_DECLS
#endif /* _ST_CLIPBOARD_H */

View File

@@ -206,8 +206,8 @@ st_icon_style_changed (StWidget *widget)
}
priv->theme_icon_size = (int)(0.5 + st_theme_node_get_length (theme_node, "icon-size"));
st_icon_update_icon_size (self);
st_icon_update (self);
if (st_icon_update_icon_size (self))
st_icon_update (self);
}
static void

View File

@@ -496,15 +496,31 @@ pixbuf_to_st_content_image (GdkPixbuf *pixbuf,
ClutterContent *image;
g_autoptr(GError) error = NULL;
if (width < 0)
width = ceilf (gdk_pixbuf_get_width (pixbuf) / resource_scale);
else
width *= paint_scale;
float native_width, native_height;
if (height < 0)
height = ceilf (gdk_pixbuf_get_height (pixbuf) / resource_scale);
native_width = ceilf (gdk_pixbuf_get_width (pixbuf) / resource_scale);
native_height = ceilf (gdk_pixbuf_get_height (pixbuf) / resource_scale);
if (width < 0 && height < 0)
{
width = native_width;
height = native_height;
}
else if (width < 0)
{
height *= paint_scale;
width = native_width * (height / native_height);
}
else if (height < 0)
{
width *= paint_scale;
height = native_height * (width / native_width);
}
else
height *= paint_scale;
{
width *= paint_scale;
height *= paint_scale;
}
image = st_image_content_new_with_preferred_size (width, height);
clutter_image_set_data (CLUTTER_IMAGE (image),

View File

@@ -107,6 +107,8 @@ struct _StThemeNode {
int box_shadow_min_width;
int box_shadow_min_height;
guint stylesheets_changed_id;
CoglPipeline *border_slices_texture;
CoglPipeline *border_slices_pipeline;
CoglPipeline *background_texture;

View File

@@ -111,9 +111,11 @@ st_theme_node_dispose (GObject *gobject)
node->icon_colors = NULL;
}
if (node->theme)
g_signal_handlers_disconnect_by_func (node->theme,
on_custom_stylesheets_changed, node);
if (node->theme && node->stylesheets_changed_id)
{
g_signal_handler_disconnect (node->theme, node->stylesheets_changed_id);
node->stylesheets_changed_id = 0;
}
st_theme_node_paint_state_free (&node->cached_state);
@@ -230,8 +232,9 @@ st_theme_node_new (StThemeContext *context,
if (theme != NULL)
{
node->theme = g_object_ref (theme);
g_signal_connect (node->theme, "custom-stylesheets-changed",
G_CALLBACK (on_custom_stylesheets_changed), node);
node->stylesheets_changed_id =
g_signal_connect (node->theme, "custom-stylesheets-changed",
G_CALLBACK (on_custom_stylesheets_changed), node);
}
node->element_type = element_type;