Compare commits
11 Commits
wip/smcv/i
...
gbsneto/ea
Author | SHA1 | Date | |
---|---|---|---|
966d4b164c | |||
a3cf41734a | |||
76811b4ebc | |||
2721c306af | |||
402fd8ec29 | |||
fbe2e30f38 | |||
fb6ead2881 | |||
7ff7fb5d3b | |||
8030d9ad32 | |||
45bc850715 | |||
51a913730e |
@ -1,7 +1,7 @@
|
|||||||
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
// -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
|
||||||
/* exported ExtensionState, ExtensionType, getCurrentExtension,
|
/* exported ExtensionState, ExtensionType, getCurrentExtension,
|
||||||
getSettings, initTranslations, isOutOfDate, installImporter,
|
getSettings, initTranslations, openPrefs, isOutOfDate,
|
||||||
serializeExtension, deserializeExtension */
|
installImporter, serializeExtension, deserializeExtension */
|
||||||
|
|
||||||
// Common utils for the extension system and the extension
|
// Common utils for the extension system and the extension
|
||||||
// preferences tool
|
// preferences tool
|
||||||
@ -153,6 +153,27 @@ function getSettings(schema) {
|
|||||||
return new Gio.Settings({ settings_schema: schemaObj });
|
return new Gio.Settings({ settings_schema: schemaObj });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* openPrefs:
|
||||||
|
*
|
||||||
|
* Open the preference dialog of the current extension
|
||||||
|
*/
|
||||||
|
function openPrefs() {
|
||||||
|
const extension = getCurrentExtension();
|
||||||
|
|
||||||
|
if (!extension)
|
||||||
|
throw new Error('openPrefs() can only be called from extensions');
|
||||||
|
|
||||||
|
try {
|
||||||
|
const extensionManager = imports.ui.main.extensionManager;
|
||||||
|
extensionManager.openExtensionPrefs(extension.uuid, '', {});
|
||||||
|
} catch (e) {
|
||||||
|
if (e.name === 'ImportError')
|
||||||
|
throw new Error('openPrefs() cannot be called from preferences');
|
||||||
|
logError(e, 'Failed to open extension preferences');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* versionCheck:
|
* versionCheck:
|
||||||
* @param {string[]} required - an array of versions we're compatible with
|
* @param {string[]} required - an array of versions we're compatible with
|
||||||
|
@ -1376,12 +1376,12 @@ class FolderView extends BaseAppView {
|
|||||||
});
|
});
|
||||||
layout.hookup_style(icon);
|
layout.hookup_style(icon);
|
||||||
let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size);
|
let subSize = Math.floor(FOLDER_SUBICON_FRACTION * size);
|
||||||
let scale = St.ThemeContext.get_for_stage(global.stage).scale_factor;
|
|
||||||
|
|
||||||
let numItems = this._orderedItems.length;
|
let numItems = this._orderedItems.length;
|
||||||
let rtl = icon.get_text_direction() == Clutter.TextDirection.RTL;
|
let rtl = icon.get_text_direction() == Clutter.TextDirection.RTL;
|
||||||
for (let i = 0; i < 4; i++) {
|
for (let i = 0; i < 4; i++) {
|
||||||
let bin = new St.Bin({ width: subSize * scale, height: subSize * scale });
|
const style = 'width: %dpx; height: %dpx;'.format(subSize, subSize);
|
||||||
|
let bin = new St.Bin({ style });
|
||||||
if (i < numItems)
|
if (i < numItems)
|
||||||
bin.child = this._orderedItems[i].app.create_icon_texture(subSize);
|
bin.child = this._orderedItems[i].app.create_icon_texture(subSize);
|
||||||
layout.attach(bin, rtl ? (i + 1) % 2 : i % 2, Math.floor(i / 2), 1, 1);
|
layout.attach(bin, rtl ? (i + 1) % 2 : i % 2, Math.floor(i / 2), 1, 1);
|
||||||
|
@ -215,6 +215,24 @@ var ExtensionManager = class {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openExtensionPrefs(uuid, parentWindow, options) {
|
||||||
|
const extension = this.lookup(uuid);
|
||||||
|
if (!extension || !extension.hasPrefs)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
Gio.DBus.session.call(
|
||||||
|
'org.gnome.Shell.Extensions',
|
||||||
|
'/org/gnome/Shell/Extensions',
|
||||||
|
'org.gnome.Shell.Extensions',
|
||||||
|
'OpenExtensionPrefs',
|
||||||
|
new GLib.Variant('(ssa{sv})', [uuid, parentWindow, options]),
|
||||||
|
null,
|
||||||
|
Gio.DBusCallFlags.NONE,
|
||||||
|
-1,
|
||||||
|
null);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
notifyExtensionUpdate(uuid) {
|
notifyExtensionUpdate(uuid) {
|
||||||
let extension = this.lookup(uuid);
|
let extension = this.lookup(uuid);
|
||||||
if (!extension)
|
if (!extension)
|
||||||
|
@ -114,8 +114,11 @@ class BaseIcon extends St.Bin {
|
|||||||
if (this._setSizeManually) {
|
if (this._setSizeManually) {
|
||||||
size = this.iconSize;
|
size = this.iconSize;
|
||||||
} else {
|
} else {
|
||||||
|
const { scaleFactor } =
|
||||||
|
St.ThemeContext.get_for_stage(global.stage);
|
||||||
|
|
||||||
let [found, len] = node.lookup_length('icon-size', false);
|
let [found, len] = node.lookup_length('icon-size', false);
|
||||||
size = found ? len : ICON_SIZE;
|
size = found ? len / scaleFactor : ICON_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.iconSize == size && this._iconBin.child)
|
if (this.iconSize == size && this._iconBin.child)
|
||||||
|
@ -498,6 +498,8 @@ var ScreenShield = class {
|
|||||||
if (Main.sessionMode.currentMode == 'unlock-dialog')
|
if (Main.sessionMode.currentMode == 'unlock-dialog')
|
||||||
Main.sessionMode.popMode('unlock-dialog');
|
Main.sessionMode.popMode('unlock-dialog');
|
||||||
|
|
||||||
|
this.emit('wake-up-screen');
|
||||||
|
|
||||||
if (this._isGreeter) {
|
if (this._isGreeter) {
|
||||||
// We don't want to "deactivate" any more than
|
// We don't want to "deactivate" any more than
|
||||||
// this. In particular, we don't want to drop
|
// this. In particular, we don't want to drop
|
||||||
@ -519,6 +521,9 @@ var ScreenShield = class {
|
|||||||
this._isModal = false;
|
this._isModal = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._longLightbox.lightOff();
|
||||||
|
this._shortLightbox.lightOff();
|
||||||
|
|
||||||
this._lockDialogGroup.ease({
|
this._lockDialogGroup.ease({
|
||||||
translation_y: -global.screen_height,
|
translation_y: -global.screen_height,
|
||||||
duration: Overview.ANIMATION_TIME,
|
duration: Overview.ANIMATION_TIME,
|
||||||
@ -533,8 +538,6 @@ var ScreenShield = class {
|
|||||||
this._dialog = null;
|
this._dialog = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._longLightbox.lightOff();
|
|
||||||
this._shortLightbox.lightOff();
|
|
||||||
this.actor.hide();
|
this.actor.hide();
|
||||||
|
|
||||||
if (this._becameActiveId != 0) {
|
if (this._becameActiveId != 0) {
|
||||||
|
@ -316,16 +316,7 @@ var GnomeShellExtensions = class {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OpenExtensionPrefs(uuid, parentWindow, options) {
|
OpenExtensionPrefs(uuid, parentWindow, options) {
|
||||||
Gio.DBus.session.call(
|
Main.extensionManager.openExtensionPrefs(uuid, parentWindow, options);
|
||||||
'org.gnome.Shell.Extensions',
|
|
||||||
'/org/gnome/Shell/Extensions',
|
|
||||||
'org.gnome.Shell.Extensions',
|
|
||||||
'OpenExtensionPrefs',
|
|
||||||
new GLib.Variant('(ssa{sv})', [uuid, parentWindow, options]),
|
|
||||||
null,
|
|
||||||
Gio.DBusCallFlags.NONE,
|
|
||||||
-1,
|
|
||||||
null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ReloadExtensionAsync(params, invocation) {
|
ReloadExtensionAsync(params, invocation) {
|
||||||
|
@ -404,7 +404,7 @@ var WindowClone = GObject.registerClass({
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.key_press_event(keyEvent);
|
return super.vfunc_key_press_event(keyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
_onClicked() {
|
_onClicked() {
|
||||||
|
@ -418,6 +418,9 @@ st_icon_update (StIcon *icon)
|
|||||||
priv->opacity_handler_id = 0;
|
priv->opacity_handler_id = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (priv->gicon == NULL && priv->fallback_gicon == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (!st_widget_get_resource_scale (ST_WIDGET (icon), &resource_scale))
|
if (!st_widget_get_resource_scale (ST_WIDGET (icon), &resource_scale))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1619,3 +1619,18 @@ st_texture_cache_rescan_icon_theme (StTextureCache *cache)
|
|||||||
|
|
||||||
return gtk_icon_theme_rescan_if_needed (priv->icon_theme);
|
return gtk_icon_theme_rescan_if_needed (priv->icon_theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* st_texture_cache_invalidate:
|
||||||
|
* @cache: a #StTextureCache
|
||||||
|
*
|
||||||
|
* Invalidates the texture cache, and evicts all icons.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
st_texture_cache_invalidate (StTextureCache *cache)
|
||||||
|
{
|
||||||
|
g_return_if_fail (ST_IS_TEXTURE_CACHE (cache));
|
||||||
|
|
||||||
|
st_texture_cache_evict_icons (cache);
|
||||||
|
}
|
||||||
|
@ -115,4 +115,6 @@ CoglTexture * st_texture_cache_load (StTextureCache *cache,
|
|||||||
|
|
||||||
gboolean st_texture_cache_rescan_icon_theme (StTextureCache *cache);
|
gboolean st_texture_cache_rescan_icon_theme (StTextureCache *cache);
|
||||||
|
|
||||||
|
void st_texture_cache_invalidate (StTextureCache *cache);
|
||||||
|
|
||||||
#endif /* __ST_TEXTURE_CACHE_H__ */
|
#endif /* __ST_TEXTURE_CACHE_H__ */
|
||||||
|
@ -176,7 +176,11 @@ st_theme_context_set_property (GObject *object,
|
|||||||
int scale_factor = g_value_get_int (value);
|
int scale_factor = g_value_get_int (value);
|
||||||
if (scale_factor != context->scale_factor)
|
if (scale_factor != context->scale_factor)
|
||||||
{
|
{
|
||||||
|
StTextureCache *cache = st_texture_cache_get_default ();
|
||||||
|
|
||||||
context->scale_factor = scale_factor;
|
context->scale_factor = scale_factor;
|
||||||
|
|
||||||
|
st_texture_cache_invalidate (cache);
|
||||||
st_theme_context_changed (context);
|
st_theme_context_changed (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,6 +117,8 @@ struct _StThemeNode {
|
|||||||
CoglPipeline *color_pipeline;
|
CoglPipeline *color_pipeline;
|
||||||
|
|
||||||
StThemeNodePaintState cached_state;
|
StThemeNodePaintState cached_state;
|
||||||
|
|
||||||
|
int scale_factor;
|
||||||
};
|
};
|
||||||
|
|
||||||
void _st_theme_node_ensure_background (StThemeNode *node);
|
void _st_theme_node_ensure_background (StThemeNode *node);
|
||||||
|
@ -219,6 +219,8 @@ st_theme_node_new (StThemeContext *context,
|
|||||||
if (theme == NULL && parent_node != NULL)
|
if (theme == NULL && parent_node != NULL)
|
||||||
theme = parent_node->theme;
|
theme = parent_node->theme;
|
||||||
|
|
||||||
|
g_object_get (context, "scale-factor", &node->scale_factor, NULL);
|
||||||
|
|
||||||
g_set_object (&node->theme, theme);
|
g_set_object (&node->theme, theme);
|
||||||
node->element_type = element_type;
|
node->element_type = element_type;
|
||||||
node->element_id = g_strdup (element_id);
|
node->element_id = g_strdup (element_id);
|
||||||
@ -345,6 +347,7 @@ st_theme_node_equal (StThemeNode *node_a, StThemeNode *node_b)
|
|||||||
node_a->context != node_b->context ||
|
node_a->context != node_b->context ||
|
||||||
node_a->theme != node_b->theme ||
|
node_a->theme != node_b->theme ||
|
||||||
node_a->element_type != node_b->element_type ||
|
node_a->element_type != node_b->element_type ||
|
||||||
|
node_a->scale_factor != node_b->scale_factor ||
|
||||||
g_strcmp0 (node_a->element_id, node_b->element_id) ||
|
g_strcmp0 (node_a->element_id, node_b->element_id) ||
|
||||||
g_strcmp0 (node_a->inline_style, node_b->inline_style))
|
g_strcmp0 (node_a->inline_style, node_b->inline_style))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -396,6 +399,7 @@ st_theme_node_hash (StThemeNode *node)
|
|||||||
hash = hash * 33 + GPOINTER_TO_UINT (node->context);
|
hash = hash * 33 + GPOINTER_TO_UINT (node->context);
|
||||||
hash = hash * 33 + GPOINTER_TO_UINT (node->theme);
|
hash = hash * 33 + GPOINTER_TO_UINT (node->theme);
|
||||||
hash = hash * 33 + ((guint) node->element_type);
|
hash = hash * 33 + ((guint) node->element_type);
|
||||||
|
hash = hash * 33 + ((guint) node->scale_factor);
|
||||||
|
|
||||||
if (node->element_id != NULL)
|
if (node->element_id != NULL)
|
||||||
hash = hash * 33 + g_str_hash (node->element_id);
|
hash = hash * 33 + g_str_hash (node->element_id);
|
||||||
@ -975,9 +979,7 @@ get_length_from_term (StThemeNode *node,
|
|||||||
} type = ABSOLUTE;
|
} type = ABSOLUTE;
|
||||||
|
|
||||||
double multiplier = 1.0;
|
double multiplier = 1.0;
|
||||||
int scale_factor;
|
|
||||||
|
|
||||||
g_object_get (node->context, "scale-factor", &scale_factor, NULL);
|
|
||||||
|
|
||||||
if (term->type != TERM_NUMBER)
|
if (term->type != TERM_NUMBER)
|
||||||
{
|
{
|
||||||
@ -992,7 +994,7 @@ get_length_from_term (StThemeNode *node,
|
|||||||
{
|
{
|
||||||
case NUM_LENGTH_PX:
|
case NUM_LENGTH_PX:
|
||||||
type = ABSOLUTE;
|
type = ABSOLUTE;
|
||||||
multiplier = 1 * scale_factor;
|
multiplier = 1 * node->scale_factor;
|
||||||
break;
|
break;
|
||||||
case NUM_LENGTH_PT:
|
case NUM_LENGTH_PT:
|
||||||
type = POINTS;
|
type = POINTS;
|
||||||
@ -1123,14 +1125,10 @@ get_length_from_term_int (StThemeNode *node,
|
|||||||
{
|
{
|
||||||
double value;
|
double value;
|
||||||
GetFromTermResult result;
|
GetFromTermResult result;
|
||||||
int scale_factor;
|
|
||||||
|
|
||||||
result = get_length_from_term (node, term, use_parent_font, &value);
|
result = get_length_from_term (node, term, use_parent_font, &value);
|
||||||
if (result == VALUE_FOUND)
|
if (result == VALUE_FOUND)
|
||||||
{
|
*length = (int) ((value / node->scale_factor) + 0.5) * node->scale_factor;
|
||||||
g_object_get (node->context, "scale-factor", &scale_factor, NULL);
|
|
||||||
*length = (int) ((value / scale_factor) + 0.5) * scale_factor;
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3012,7 +3010,6 @@ StBorderImage *
|
|||||||
st_theme_node_get_border_image (StThemeNode *node)
|
st_theme_node_get_border_image (StThemeNode *node)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int scale_factor;
|
|
||||||
|
|
||||||
if (node->border_image_computed)
|
if (node->border_image_computed)
|
||||||
return node->border_image;
|
return node->border_image;
|
||||||
@ -3021,7 +3018,6 @@ st_theme_node_get_border_image (StThemeNode *node)
|
|||||||
node->border_image_computed = TRUE;
|
node->border_image_computed = TRUE;
|
||||||
|
|
||||||
ensure_properties (node);
|
ensure_properties (node);
|
||||||
g_object_get (node->context, "scale-factor", &scale_factor, NULL);
|
|
||||||
|
|
||||||
for (i = node->n_properties - 1; i >= 0; i--)
|
for (i = node->n_properties - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
@ -3126,7 +3122,7 @@ st_theme_node_get_border_image (StThemeNode *node)
|
|||||||
|
|
||||||
node->border_image = st_border_image_new (file,
|
node->border_image = st_border_image_new (file,
|
||||||
border_top, border_right, border_bottom, border_left,
|
border_top, border_right, border_bottom, border_left,
|
||||||
scale_factor);
|
node->scale_factor);
|
||||||
|
|
||||||
g_object_unref (file);
|
g_object_unref (file);
|
||||||
|
|
||||||
@ -3967,6 +3963,9 @@ st_theme_node_geometry_equal (StThemeNode *node,
|
|||||||
|
|
||||||
g_return_val_if_fail (ST_IS_THEME_NODE (other), FALSE);
|
g_return_val_if_fail (ST_IS_THEME_NODE (other), FALSE);
|
||||||
|
|
||||||
|
if (node->scale_factor != other->scale_factor)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
_st_theme_node_ensure_geometry (node);
|
_st_theme_node_ensure_geometry (node);
|
||||||
_st_theme_node_ensure_geometry (other);
|
_st_theme_node_ensure_geometry (other);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user