mirror of
https://github.com/elementary/gala.git
synced 2024-11-25 03:06:14 +01:00
Unify notifications check (#2050)
This commit is contained in:
parent
481fa89841
commit
a3a3c446a0
@ -17,8 +17,8 @@
|
||||
*/
|
||||
|
||||
public class Gala.NotificationStack : Object {
|
||||
public const string TRANSITION_ENTRY_NAME = "entry";
|
||||
public const string TRANSITION_MOVE_STACK_ID = "move-stack";
|
||||
private const string TRANSITION_ENTRY_NAME = "entry";
|
||||
private const string TRANSITION_MOVE_STACK_ID = "move-stack";
|
||||
|
||||
// we need to keep a small offset to the top, because we clip the container to
|
||||
// its allocations and the close button would be off for the first notification
|
||||
@ -207,4 +207,8 @@ public class Gala.NotificationStack : Object {
|
||||
rect = window.get_buffer_rect ();
|
||||
actor.set_position (rect.x - ((actor.width - rect.width) / 2), rect.y - ((actor.height - rect.height) / 2));
|
||||
}
|
||||
|
||||
public static bool is_notification (Meta.Window window) {
|
||||
return window.window_type == NOTIFICATION || window.get_data (NOTIFICATION_DATA_KEY);
|
||||
}
|
||||
}
|
||||
|
@ -799,7 +799,7 @@ namespace Gala {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (window.get_data (NOTIFICATION_DATA_KEY)) {
|
||||
if (NotificationStack.is_notification (window)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -76,8 +76,7 @@ public class Gala.WindowOverview : Clutter.Actor, ActivatableComponent {
|
||||
var windows = new List<Meta.Window> ();
|
||||
foreach (var workspace in workspaces) {
|
||||
foreach (unowned var window in workspace.list_windows ()) {
|
||||
if (window.window_type == Meta.WindowType.DOCK
|
||||
|| window.window_type == Meta.WindowType.NOTIFICATION) {
|
||||
if (window.window_type == Meta.WindowType.DOCK || NotificationStack.is_notification (window) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -204,8 +203,7 @@ public class Gala.WindowOverview : Clutter.Actor, ActivatableComponent {
|
||||
if (!visible) {
|
||||
return;
|
||||
}
|
||||
if (window.window_type == Meta.WindowType.DOCK
|
||||
|| window.window_type == Meta.WindowType.NOTIFICATION) {
|
||||
if (window.window_type == Meta.WindowType.DOCK || NotificationStack.is_notification (window)) {
|
||||
return;
|
||||
}
|
||||
if (window.window_type != Meta.WindowType.NORMAL &&
|
||||
|
@ -1098,7 +1098,7 @@ namespace Gala {
|
||||
public override void show_window_menu (Meta.Window window, Meta.WindowMenuType menu, int x, int y) {
|
||||
switch (menu) {
|
||||
case Meta.WindowMenuType.WM:
|
||||
if (window.get_window_type () == Meta.WindowType.NOTIFICATION) {
|
||||
if (NotificationStack.is_notification (window)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1528,7 +1528,7 @@ namespace Gala {
|
||||
|
||||
// Notifications are a special case and have to be always be handled
|
||||
// (also regardless of the animation setting)
|
||||
if (window.get_data (NOTIFICATION_DATA_KEY) || window.window_type == NOTIFICATION) {
|
||||
if (NotificationStack.is_notification (window)) {
|
||||
clutter_actor_reparent (actor, notification_group);
|
||||
notification_stack.show_notification (actor, enable_animations);
|
||||
|
||||
@ -1656,7 +1656,7 @@ namespace Gala {
|
||||
|
||||
actor.remove_all_transitions ();
|
||||
|
||||
if (window.get_data (NOTIFICATION_DATA_KEY) || window.window_type == NOTIFICATION) {
|
||||
if (NotificationStack.is_notification (window)) {
|
||||
if (enable_animations) {
|
||||
destroying.add (actor);
|
||||
}
|
||||
@ -2054,7 +2054,7 @@ namespace Gala {
|
||||
|
||||
if (window.on_all_workspaces) {
|
||||
// notifications use their own group and are always on top
|
||||
if (window.window_type == NOTIFICATION) {
|
||||
if (NotificationStack.is_notification (window)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -2165,7 +2165,7 @@ namespace Gala {
|
||||
// while a workspace is being switched mutter doesn't map windows
|
||||
// TODO: currently only notifications are handled here, other windows should be too
|
||||
switch_workspace_window_created_id = window_created.connect ((window) => {
|
||||
if (window.window_type == Meta.WindowType.NOTIFICATION) {
|
||||
if (NotificationStack.is_notification (window)) {
|
||||
unowned var actor = (Meta.WindowActor) window.get_compositor_private ();
|
||||
clutter_actor_reparent (actor, notification_group);
|
||||
notification_stack.show_notification (actor, enable_animations);
|
||||
|
Loading…
Reference in New Issue
Block a user