58 lines
2.1 KiB
Diff
58 lines
2.1 KiB
Diff
|
--- a/src/proximity.c 2021-03-04 10:51:32.765179000 +0100
|
||
|
+++ b/src/proximity.c 2021-03-04 12:01:32.618475761 +0100
|
||
|
@@ -148,24 +148,24 @@ on_proximity_near_changed (PhoshProximit
|
||
|
PhoshSensorProxyManager *sensor)
|
||
|
{
|
||
|
gboolean near;
|
||
|
+ int ps_mode;
|
||
|
+ PhoshShell *shell = phosh_shell_get_default ();
|
||
|
+ PhoshMonitor *monitor = phosh_shell_get_builtin_monitor (shell);
|
||
|
|
||
|
near = phosh_dbus_sensor_proxy_get_proximity_near (
|
||
|
PHOSH_DBUS_SENSOR_PROXY (self->sensor_proxy_manager));
|
||
|
|
||
|
g_debug ("Proximity near changed: %d", near);
|
||
|
+
|
||
|
if (near) {
|
||
|
- PhoshShell *shell = phosh_shell_get_default ();
|
||
|
- PhoshWayland *wl = phosh_wayland_get_default ();
|
||
|
- PhoshMonitor *monitor = phosh_shell_get_builtin_monitor (shell);
|
||
|
-
|
||
|
- if (!self->fader) {
|
||
|
- self->fader = phosh_fader_new (phosh_wayland_get_zwlr_layer_shell_v1 (wl),
|
||
|
- monitor->wl_output);
|
||
|
- gtk_widget_show (GTK_WIDGET (self->fader));
|
||
|
- }
|
||
|
+ ps_mode = PHOSH_MONITOR_POWER_SAVE_MODE_OFF;
|
||
|
+ g_object_set(monitor, "proximity", TRUE, NULL);
|
||
|
} else {
|
||
|
- g_clear_pointer (&self->fader, phosh_cp_widget_destroy);
|
||
|
+ ps_mode = PHOSH_MONITOR_POWER_SAVE_MODE_ON;
|
||
|
+ g_object_set(monitor, "proximity", FALSE, NULL);
|
||
|
}
|
||
|
+
|
||
|
+ phosh_monitor_set_power_save_mode (monitor, ps_mode);
|
||
|
}
|
||
|
|
||
|
static void
|
||
|
--- a/src/shell.c 2021-03-04 15:50:24.291677177 +0100
|
||
|
+++ b/src/shell.c 2021-03-04 15:50:54.228343514 +0100
|
||
|
@@ -529,13 +533,15 @@ static void
|
||
|
on_builtin_monitor_power_mode_changed (PhoshShell *self, GParamSpec *pspec, PhoshMonitor *monitor)
|
||
|
{
|
||
|
PhoshMonitorPowerSaveMode mode;
|
||
|
+ gboolean proximity;
|
||
|
|
||
|
g_return_if_fail (PHOSH_IS_SHELL (self));
|
||
|
g_return_if_fail (PHOSH_IS_MONITOR (monitor));
|
||
|
|
||
|
+ g_object_get (monitor, "proximity", &proximity, NULL);
|
||
|
g_object_get (monitor, "power-mode", &mode, NULL);
|
||
|
- if (mode == PHOSH_MONITOR_POWER_SAVE_MODE_OFF)
|
||
|
- phosh_shell_lock (self);
|
||
|
+ if (!proximity && mode == PHOSH_MONITOR_POWER_SAVE_MODE_OFF)
|
||
|
+ //phosh_shell_lock (self);
|
||
|
|
||
|
phosh_shell_set_state (self, PHOSH_STATE_BLANKED, mode == PHOSH_MONITOR_POWER_SAVE_MODE_OFF);
|
||
|
}
|