mirror of
https://github.com/elementary/gala.git
synced 2024-12-24 17:53:19 +03:00
* Nvidia drivers: Refresh background and screen corners (#21) * Fix merge artifacts * Remove unused GL_VENDOR constant * Remove unused logind constants * Cleanup: Turn refresh_backgrounds method into a closure
This commit is contained in:
parent
fe9f48ae09
commit
a1bad2672b
@ -71,10 +71,18 @@ namespace Gala.Plugins.MaskCorners
|
||||
screen.in_fullscreen_changed.connect (fullscreen_changed);
|
||||
|
||||
screen.monitors_changed.connect (resetup_cornermasks);
|
||||
|
||||
#if HAS_MUTTER322
|
||||
screen.get_display ().gl_video_memory_purged.connect (resetup_cornermasks);
|
||||
#endif
|
||||
}
|
||||
|
||||
void destroy_cornermasks ()
|
||||
{
|
||||
#if HAS_MUTTER322
|
||||
screen.get_display ().gl_video_memory_purged.disconnect (resetup_cornermasks);
|
||||
#endif
|
||||
|
||||
screen.monitors_changed.disconnect (resetup_cornermasks);
|
||||
screen.in_fullscreen_changed.disconnect (fullscreen_changed);
|
||||
|
||||
|
@ -60,6 +60,16 @@ namespace Gala
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static void refresh ()
|
||||
{
|
||||
// Meta.Background.refresh_all does not refresh backgrounds with the WALLPAPER style.
|
||||
// (Last tested with mutter 3.28)
|
||||
// As a workaround, re-apply the current color again to force the wallpaper texture
|
||||
// to be rendered from scratch.
|
||||
if (system_background != null)
|
||||
system_background.set_color (DEFAULT_BACKGROUND_COLOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,30 +28,8 @@ namespace Gala
|
||||
public abstract async void show_window_menu (WindowFlags flags, int x, int y) throws Error;
|
||||
}
|
||||
|
||||
[DBus (name = "org.freedesktop.login1.Manager")]
|
||||
public interface LoginDRemote : GLib.Object
|
||||
{
|
||||
public signal void prepare_for_sleep (bool suspending);
|
||||
}
|
||||
|
||||
public class WindowManagerGala : Meta.Plugin, WindowManager
|
||||
{
|
||||
const uint GL_VENDOR = 0x1F00;
|
||||
const string LOGIND_DBUS_NAME = "org.freedesktop.login1";
|
||||
const string LOGIND_DBUS_OBJECT_PATH = "/org/freedesktop/login1";
|
||||
|
||||
delegate unowned string? GlQueryFunc (uint id);
|
||||
|
||||
static bool is_nvidia ()
|
||||
{
|
||||
var gl_get_string = (GlQueryFunc) Cogl.get_proc_address ("glGetString");
|
||||
if (gl_get_string == null)
|
||||
return false;
|
||||
|
||||
unowned string? vendor = gl_get_string (GL_VENDOR);
|
||||
return (vendor != null && vendor.contains ("NVIDIA Corporation"));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@ -91,7 +69,6 @@ namespace Gala
|
||||
|
||||
Window? moving; //place for the window that is being moved over
|
||||
|
||||
LoginDRemote? logind_proxy = null;
|
||||
Daemon? daemon_proxy = null;
|
||||
|
||||
Gee.LinkedList<ModalProxy> modal_stack = new Gee.LinkedList<ModalProxy> ();
|
||||
@ -121,18 +98,12 @@ namespace Gala
|
||||
{
|
||||
Util.later_add (LaterType.BEFORE_REDRAW, show_stage);
|
||||
|
||||
// Handle FBO issue with nvidia blob
|
||||
if (logind_proxy == null
|
||||
&& is_nvidia ()) {
|
||||
try {
|
||||
logind_proxy = Bus.get_proxy_sync (BusType.SYSTEM, LOGIND_DBUS_NAME, LOGIND_DBUS_OBJECT_PATH);
|
||||
logind_proxy.prepare_for_sleep.connect (prepare_for_sleep);
|
||||
} catch (Error e) {
|
||||
warning ("Failed to get LoginD proxy: %s", e.message);
|
||||
}
|
||||
}
|
||||
|
||||
Bus.watch_name (BusType.SESSION, DAEMON_DBUS_NAME, BusNameWatcherFlags.NONE, daemon_appeared, lost_daemon);
|
||||
#if HAS_MUTTER322
|
||||
get_screen ().get_display ().gl_video_memory_purged.connect (() => {
|
||||
Meta.Background.refresh_all ();
|
||||
SystemBackground.refresh ();
|
||||
});
|
||||
#endif
|
||||
}
|
||||
|
||||
void on_menu_get (GLib.Object? o, GLib.AsyncResult? res)
|
||||
@ -156,14 +127,6 @@ namespace Gala
|
||||
}
|
||||
}
|
||||
|
||||
void prepare_for_sleep (bool suspending)
|
||||
{
|
||||
if (suspending)
|
||||
return;
|
||||
|
||||
Meta.Background.refresh_all ();
|
||||
}
|
||||
|
||||
bool show_stage ()
|
||||
{
|
||||
var screen = get_screen ();
|
||||
|
Loading…
Reference in New Issue
Block a user