show background when nautilus isn't drawing the desktop.
If window with type Meta.WindowType.DESKTOP doesn't exist, then draw background. https://bugzilla.gnome.org/show_bug.cgi?id=591912
This commit is contained in:
parent
9afb09128b
commit
86515f3943
@ -46,6 +46,10 @@ let modalActorFocusStack = [];
|
|||||||
let _errorLogStack = [];
|
let _errorLogStack = [];
|
||||||
let _startDate;
|
let _startDate;
|
||||||
|
|
||||||
|
let background = null;
|
||||||
|
let _windowAddedSignalId = null;
|
||||||
|
let _windowRemovedSignalId = null;
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
// Add a binding for "global" in the global JS namespace; (gjs
|
// Add a binding for "global" in the global JS namespace; (gjs
|
||||||
// keeps the web browser convention of having that namespace be
|
// keeps the web browser convention of having that namespace be
|
||||||
@ -134,7 +138,12 @@ function start() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
_relayout();
|
background = global.create_root_pixmap_actor();
|
||||||
|
global.screen.connect('workspace-switched', _onWorkspaceSwitched);
|
||||||
|
global.stage.add_actor(background);
|
||||||
|
background.lower_bottom();
|
||||||
|
_onWorkspaceSwitched(global.screen, -1);
|
||||||
|
|
||||||
global.connect('screen-size-changed', _relayout);
|
global.connect('screen-size-changed', _relayout);
|
||||||
|
|
||||||
ExtensionSystem.init();
|
ExtensionSystem.init();
|
||||||
@ -195,12 +204,53 @@ function _getAndClearErrorStack() {
|
|||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showBackground() {
|
||||||
|
background.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
function hideBackground() {
|
||||||
|
background.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
function _onWorkspaceSwitched(screen, from) {
|
||||||
|
let workspace = screen.get_active_workspace();
|
||||||
|
|
||||||
|
if (from != -1) {
|
||||||
|
let old_workspace = screen.get_workspace_by_index(from);
|
||||||
|
|
||||||
|
if (_windowAddedSignalId !== null)
|
||||||
|
old_workspace.disconnect(_windowAddedSignalId);
|
||||||
|
if (background.windowRemovedSignalId !== null)
|
||||||
|
old_workspace.disconnect(_windowRemovedSignalId);
|
||||||
|
}
|
||||||
|
|
||||||
|
_windowAddedSignalId = workspace.connect('window-added', function(win) {
|
||||||
|
if (win.window_type == Meta.WindowType.DESKTOP)
|
||||||
|
hideBackground();
|
||||||
|
});
|
||||||
|
_windowRemovedSignalId = workspace.connect('window-removed', function(win) {
|
||||||
|
if (win.window_type == Meta.WindowType.DESKTOP)
|
||||||
|
showBackground();
|
||||||
|
});
|
||||||
|
|
||||||
|
function _isDesktop(win) {
|
||||||
|
return win.window_type == Meta.WindowType.DESKTOP;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (workspace.list_windows().some(_isDesktop))
|
||||||
|
hideBackground();
|
||||||
|
else
|
||||||
|
showBackground();
|
||||||
|
}
|
||||||
|
|
||||||
function _relayout() {
|
function _relayout() {
|
||||||
let primary = global.get_primary_monitor();
|
let primary = global.get_primary_monitor();
|
||||||
panel.actor.set_position(primary.x, primary.y);
|
panel.actor.set_position(primary.x, primary.y);
|
||||||
panel.actor.set_size(primary.width, Panel.PANEL_HEIGHT);
|
panel.actor.set_size(primary.width, Panel.PANEL_HEIGHT);
|
||||||
overview.relayout();
|
overview.relayout();
|
||||||
|
|
||||||
|
background.set_size(global.screen_width, global.screen_height);
|
||||||
|
|
||||||
// To avoid updating the position and size of the workspaces
|
// To avoid updating the position and size of the workspaces
|
||||||
// in the overview, we just hide the overview. The positions
|
// in the overview, we just hide the overview. The positions
|
||||||
// will be updated when it is next shown. We do the same for
|
// will be updated when it is next shown. We do the same for
|
||||||
|
@ -287,10 +287,10 @@ DesktopClone.prototype = {
|
|||||||
this.actor = new Clutter.Clone({ source: window.get_texture(),
|
this.actor = new Clutter.Clone({ source: window.get_texture(),
|
||||||
reactive: true });
|
reactive: true });
|
||||||
} else {
|
} else {
|
||||||
this.actor = new Clutter.Rectangle({ color: global.stage.color,
|
this.actor = new Clutter.Clone({ source: Main.background.source,
|
||||||
reactive: true,
|
reactive: true,
|
||||||
width: global.screen_width,
|
width: global.screen_width,
|
||||||
height: global.screen_height });
|
height: global.screen_height });
|
||||||
}
|
}
|
||||||
|
|
||||||
this.actor.connect('button-release-event',
|
this.actor.connect('button-release-event',
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
#define SHELL_DBUS_SERVICE "org.gnome.Shell"
|
#define SHELL_DBUS_SERVICE "org.gnome.Shell"
|
||||||
|
|
||||||
static void grab_notify (GtkWidget *widget, gboolean is_grab, gpointer user_data);
|
static void grab_notify (GtkWidget *widget, gboolean is_grab, gpointer user_data);
|
||||||
|
static void update_root_window_pixmap (ShellGlobal *global);
|
||||||
|
|
||||||
struct _ShellGlobal {
|
struct _ShellGlobal {
|
||||||
GObject parent;
|
GObject parent;
|
||||||
@ -481,11 +482,7 @@ global_stage_notify_width (GObject *gobject,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
ShellGlobal *global = SHELL_GLOBAL (data);
|
ShellGlobal *global = SHELL_GLOBAL (data);
|
||||||
ClutterActor *stage = CLUTTER_ACTOR (gobject);
|
|
||||||
|
|
||||||
if (global->root_pixmap)
|
|
||||||
clutter_actor_set_width (CLUTTER_ACTOR (global->root_pixmap),
|
|
||||||
clutter_actor_get_width (stage));
|
|
||||||
g_object_notify (G_OBJECT (global), "screen-width");
|
g_object_notify (G_OBJECT (global), "screen-width");
|
||||||
|
|
||||||
meta_later_add (META_LATER_BEFORE_REDRAW,
|
meta_later_add (META_LATER_BEFORE_REDRAW,
|
||||||
@ -500,11 +497,7 @@ global_stage_notify_height (GObject *gobject,
|
|||||||
gpointer data)
|
gpointer data)
|
||||||
{
|
{
|
||||||
ShellGlobal *global = SHELL_GLOBAL (data);
|
ShellGlobal *global = SHELL_GLOBAL (data);
|
||||||
ClutterActor *stage = CLUTTER_ACTOR (gobject);
|
|
||||||
|
|
||||||
if (global->root_pixmap)
|
|
||||||
clutter_actor_set_height (CLUTTER_ACTOR (global->root_pixmap),
|
|
||||||
clutter_actor_get_height (stage));
|
|
||||||
g_object_notify (G_OBJECT (global), "screen-height");
|
g_object_notify (G_OBJECT (global), "screen-height");
|
||||||
|
|
||||||
meta_later_add (META_LATER_BEFORE_REDRAW,
|
meta_later_add (META_LATER_BEFORE_REDRAW,
|
||||||
@ -1042,6 +1035,9 @@ shell_global_create_root_pixmap_actor (ShellGlobal *global)
|
|||||||
{
|
{
|
||||||
global->root_pixmap = clutter_glx_texture_pixmap_new ();
|
global->root_pixmap = clutter_glx_texture_pixmap_new ();
|
||||||
|
|
||||||
|
clutter_texture_set_repeat (CLUTTER_TEXTURE (global->root_pixmap),
|
||||||
|
TRUE, TRUE);
|
||||||
|
|
||||||
/* The low and medium quality filters give nearest-neighbor resizing. */
|
/* The low and medium quality filters give nearest-neighbor resizing. */
|
||||||
clutter_texture_set_filter_quality (CLUTTER_TEXTURE (global->root_pixmap),
|
clutter_texture_set_filter_quality (CLUTTER_TEXTURE (global->root_pixmap),
|
||||||
CLUTTER_TEXTURE_QUALITY_HIGH);
|
CLUTTER_TEXTURE_QUALITY_HIGH);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user