shell: Use MetaStartupNotification
This is "API compatible" with ShellStartupNotification, so only C changes are necessary.
This commit is contained in:
parent
4d2dce2c52
commit
10b3671a99
@ -5,9 +5,6 @@
|
|||||||
#include "shell-app.h"
|
#include "shell-app.h"
|
||||||
#include "shell-app-system.h"
|
#include "shell-app-system.h"
|
||||||
|
|
||||||
#define SN_API_NOT_YET_FROZEN 1
|
|
||||||
#include <libsn/sn.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
ShellApp* _shell_app_new_for_window (MetaWindow *window);
|
ShellApp* _shell_app_new_for_window (MetaWindow *window);
|
||||||
@ -16,7 +13,7 @@ ShellApp* _shell_app_new (GDesktopAppInfo *info);
|
|||||||
|
|
||||||
void _shell_app_set_app_info (ShellApp *app, GDesktopAppInfo *info);
|
void _shell_app_set_app_info (ShellApp *app, GDesktopAppInfo *info);
|
||||||
|
|
||||||
void _shell_app_handle_startup_sequence (ShellApp *app, SnStartupSequence *sequence);
|
void _shell_app_handle_startup_sequence (ShellApp *app, MetaStartupSequence *sequence);
|
||||||
|
|
||||||
void _shell_app_add_window (ShellApp *app, MetaWindow *window);
|
void _shell_app_add_window (ShellApp *app, MetaWindow *window);
|
||||||
|
|
||||||
|
@ -1143,9 +1143,9 @@ shell_app_get_pids (ShellApp *app)
|
|||||||
|
|
||||||
void
|
void
|
||||||
_shell_app_handle_startup_sequence (ShellApp *app,
|
_shell_app_handle_startup_sequence (ShellApp *app,
|
||||||
SnStartupSequence *sequence)
|
MetaStartupSequence *sequence)
|
||||||
{
|
{
|
||||||
gboolean starting = !sn_startup_sequence_get_completed (sequence);
|
gboolean starting = !meta_startup_sequence_get_completed (sequence);
|
||||||
|
|
||||||
/* The Shell design calls for on application launch, the app title
|
/* The Shell design calls for on application launch, the app title
|
||||||
* appears at top, and no X window is focused. So when we get
|
* appears at top, and no X window is focused. So when we get
|
||||||
@ -1160,8 +1160,8 @@ _shell_app_handle_startup_sequence (ShellApp *app,
|
|||||||
|
|
||||||
shell_app_state_transition (app, SHELL_APP_STATE_STARTING);
|
shell_app_state_transition (app, SHELL_APP_STATE_STARTING);
|
||||||
meta_x11_display_focus_the_no_focus_window (x11_display,
|
meta_x11_display_focus_the_no_focus_window (x11_display,
|
||||||
sn_startup_sequence_get_timestamp (sequence));
|
meta_startup_sequence_get_timestamp (sequence));
|
||||||
app->started_on_workspace = sn_startup_sequence_get_workspace (sequence);
|
app->started_on_workspace = meta_startup_sequence_get_workspace (sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!starting)
|
if (!starting)
|
||||||
|
@ -14,9 +14,7 @@
|
|||||||
#include <meta/util.h>
|
#include <meta/util.h>
|
||||||
#include <meta/window.h>
|
#include <meta/window.h>
|
||||||
#include <meta/meta-workspace-manager.h>
|
#include <meta/meta-workspace-manager.h>
|
||||||
|
#include <meta/meta-startup-notification.h>
|
||||||
#define SN_API_NOT_YET_FROZEN 1
|
|
||||||
#include <libsn/sn.h>
|
|
||||||
|
|
||||||
#include "shell-window-tracker-private.h"
|
#include "shell-window-tracker-private.h"
|
||||||
#include "shell-app-private.h"
|
#include "shell-app-private.h"
|
||||||
@ -115,7 +113,7 @@ shell_window_tracker_class_init (ShellWindowTrackerClass *klass)
|
|||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
0,
|
0,
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 1, SHELL_TYPE_STARTUP_SEQUENCE);
|
G_TYPE_NONE, 1, META_TYPE_STARTUP_SEQUENCE);
|
||||||
signals[TRACKED_WINDOWS_CHANGED] = g_signal_new ("tracked-windows-changed",
|
signals[TRACKED_WINDOWS_CHANGED] = g_signal_new ("tracked-windows-changed",
|
||||||
SHELL_TYPE_WINDOW_TRACKER,
|
SHELL_TYPE_WINDOW_TRACKER,
|
||||||
G_SIGNAL_RUN_LAST,
|
G_SIGNAL_RUN_LAST,
|
||||||
@ -430,8 +428,8 @@ get_app_for_window (ShellWindowTracker *tracker,
|
|||||||
sequences = shell_window_tracker_get_startup_sequences (tracker);
|
sequences = shell_window_tracker_get_startup_sequences (tracker);
|
||||||
for (iter = sequences; iter; iter = iter->next)
|
for (iter = sequences; iter; iter = iter->next)
|
||||||
{
|
{
|
||||||
ShellStartupSequence *sequence = iter->data;
|
MetaStartupSequence *sequence = iter->data;
|
||||||
const char *id = shell_startup_sequence_get_id (sequence);
|
const char *id = meta_startup_sequence_get_id (sequence);
|
||||||
if (strcmp (id, startup_id) != 0)
|
if (strcmp (id, startup_id) != 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -653,13 +651,13 @@ init_window_tracking (ShellWindowTracker *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_startup_sequence_changed (MetaDisplay *display,
|
on_startup_sequence_changed (MetaStartupNotification *sn,
|
||||||
SnStartupSequence *sequence,
|
MetaStartupSequence *sequence,
|
||||||
ShellWindowTracker *self)
|
ShellWindowTracker *self)
|
||||||
{
|
{
|
||||||
ShellApp *app;
|
ShellApp *app;
|
||||||
|
|
||||||
app = shell_startup_sequence_get_app ((ShellStartupSequence*)sequence);
|
app = shell_startup_sequence_get_app (sequence);
|
||||||
if (app)
|
if (app)
|
||||||
_shell_app_handle_startup_sequence (app, sequence);
|
_shell_app_handle_startup_sequence (app, sequence);
|
||||||
|
|
||||||
@ -670,12 +668,13 @@ static void
|
|||||||
shell_window_tracker_init (ShellWindowTracker *self)
|
shell_window_tracker_init (ShellWindowTracker *self)
|
||||||
{
|
{
|
||||||
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
MetaDisplay *display = shell_global_get_display (shell_global_get ());
|
||||||
|
MetaStartupNotification *sn = meta_display_get_startup_notification (display);
|
||||||
|
|
||||||
self->window_to_app = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
self->window_to_app = g_hash_table_new_full (g_direct_hash, g_direct_equal,
|
||||||
NULL, (GDestroyNotify) g_object_unref);
|
NULL, (GDestroyNotify) g_object_unref);
|
||||||
|
|
||||||
|
|
||||||
g_signal_connect (display, "startup-sequence-changed",
|
g_signal_connect (sn, "changed",
|
||||||
G_CALLBACK (on_startup_sequence_changed), self);
|
G_CALLBACK (on_startup_sequence_changed), self);
|
||||||
|
|
||||||
load_initial_windows (self);
|
load_initial_windows (self);
|
||||||
@ -786,60 +785,33 @@ on_focus_window_changed (MetaDisplay *display,
|
|||||||
* shell_window_tracker_get_startup_sequences:
|
* shell_window_tracker_get_startup_sequences:
|
||||||
* @tracker:
|
* @tracker:
|
||||||
*
|
*
|
||||||
* Returns: (transfer none) (element-type ShellStartupSequence): Currently active startup sequences
|
* Returns: (transfer none) (element-type MetaStartupSequence): Currently active startup sequences
|
||||||
*/
|
*/
|
||||||
GSList *
|
GSList *
|
||||||
shell_window_tracker_get_startup_sequences (ShellWindowTracker *self)
|
shell_window_tracker_get_startup_sequences (ShellWindowTracker *self)
|
||||||
{
|
{
|
||||||
ShellGlobal *global = shell_global_get ();
|
ShellGlobal *global = shell_global_get ();
|
||||||
MetaDisplay *display = shell_global_get_display (global);
|
MetaDisplay *display = shell_global_get_display (global);
|
||||||
|
MetaStartupNotification *sn = meta_display_get_startup_notification (display);
|
||||||
|
|
||||||
return meta_display_get_startup_sequences (display);
|
return meta_startup_notification_get_sequences (sn);
|
||||||
}
|
|
||||||
|
|
||||||
/* sn_startup_sequence_ref returns void, so make a
|
|
||||||
* wrapper which returns self */
|
|
||||||
static SnStartupSequence *
|
|
||||||
sequence_ref (SnStartupSequence *sequence)
|
|
||||||
{
|
|
||||||
sn_startup_sequence_ref (sequence);
|
|
||||||
return sequence;
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
shell_startup_sequence_get_type (void)
|
|
||||||
{
|
|
||||||
static GType gtype = G_TYPE_INVALID;
|
|
||||||
if (gtype == G_TYPE_INVALID)
|
|
||||||
{
|
|
||||||
gtype = g_boxed_type_register_static ("ShellStartupSequence",
|
|
||||||
(GBoxedCopyFunc)sequence_ref,
|
|
||||||
(GBoxedFreeFunc)sn_startup_sequence_unref);
|
|
||||||
}
|
|
||||||
return gtype;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *
|
|
||||||
shell_startup_sequence_get_id (ShellStartupSequence *sequence)
|
|
||||||
{
|
|
||||||
return sn_startup_sequence_get_id ((SnStartupSequence*)sequence);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shell_startup_sequence_get_app:
|
* shell_startup_sequence_get_app:
|
||||||
* @sequence: A #ShellStartupSequence
|
* @sequence: A #MetaStartupSequence
|
||||||
*
|
*
|
||||||
* Returns: (transfer none): The application being launched, or %NULL if unknown.
|
* Returns: (transfer none): The application being launched, or %NULL if unknown.
|
||||||
*/
|
*/
|
||||||
ShellApp *
|
ShellApp *
|
||||||
shell_startup_sequence_get_app (ShellStartupSequence *sequence)
|
shell_startup_sequence_get_app (MetaStartupSequence *sequence)
|
||||||
{
|
{
|
||||||
const char *appid;
|
const char *appid;
|
||||||
char *basename;
|
char *basename;
|
||||||
ShellAppSystem *appsys;
|
ShellAppSystem *appsys;
|
||||||
ShellApp *app;
|
ShellApp *app;
|
||||||
|
|
||||||
appid = sn_startup_sequence_get_application_id ((SnStartupSequence*)sequence);
|
appid = meta_startup_sequence_get_application_id (sequence);
|
||||||
if (!appid)
|
if (!appid)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -850,24 +822,6 @@ shell_startup_sequence_get_app (ShellStartupSequence *sequence)
|
|||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
|
||||||
shell_startup_sequence_get_name (ShellStartupSequence *sequence)
|
|
||||||
{
|
|
||||||
return sn_startup_sequence_get_name ((SnStartupSequence*)sequence);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
shell_startup_sequence_get_completed (ShellStartupSequence *sequence)
|
|
||||||
{
|
|
||||||
return sn_startup_sequence_get_completed ((SnStartupSequence*)sequence);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
shell_startup_sequence_get_workspace (ShellStartupSequence *sequence)
|
|
||||||
{
|
|
||||||
return sn_startup_sequence_get_workspace ((SnStartupSequence*)sequence);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* shell_startup_sequence_create_icon:
|
* shell_startup_sequence_create_icon:
|
||||||
* @sequence:
|
* @sequence:
|
||||||
@ -876,7 +830,8 @@ shell_startup_sequence_get_workspace (ShellStartupSequence *sequence)
|
|||||||
* Returns: (transfer none): A new #ClutterTexture containing an icon for the sequence
|
* Returns: (transfer none): A new #ClutterTexture containing an icon for the sequence
|
||||||
*/
|
*/
|
||||||
ClutterActor *
|
ClutterActor *
|
||||||
shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size)
|
shell_startup_sequence_create_icon (MetaStartupSequence *sequence,
|
||||||
|
guint size)
|
||||||
{
|
{
|
||||||
GIcon *themed;
|
GIcon *themed;
|
||||||
const char *icon_name;
|
const char *icon_name;
|
||||||
@ -889,7 +844,7 @@ shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size)
|
|||||||
context = st_theme_context_get_for_stage (shell_global_get_stage (global));
|
context = st_theme_context_get_for_stage (shell_global_get_stage (global));
|
||||||
g_object_get (context, "scale-factor", &scale, NULL);
|
g_object_get (context, "scale-factor", &scale, NULL);
|
||||||
|
|
||||||
icon_name = sn_startup_sequence_get_icon_name ((SnStartupSequence*)sequence);
|
icon_name = meta_startup_sequence_get_icon_name (sequence);
|
||||||
if (!icon_name)
|
if (!icon_name)
|
||||||
{
|
{
|
||||||
texture = clutter_texture_new ();
|
texture = clutter_texture_new ();
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
#include <meta/window.h>
|
#include <meta/window.h>
|
||||||
|
#include <meta/meta-startup-notification.h>
|
||||||
|
|
||||||
#include "shell-app.h"
|
#include "shell-app.h"
|
||||||
#include "shell-app-system.h"
|
#include "shell-app-system.h"
|
||||||
@ -23,17 +24,8 @@ ShellApp *shell_window_tracker_get_app_from_pid (ShellWindowTracker *tracker, in
|
|||||||
|
|
||||||
GSList *shell_window_tracker_get_startup_sequences (ShellWindowTracker *tracker);
|
GSList *shell_window_tracker_get_startup_sequences (ShellWindowTracker *tracker);
|
||||||
|
|
||||||
/* Hidden typedef for SnStartupSequence */
|
ShellApp *shell_startup_sequence_get_app (MetaStartupSequence *sequence);
|
||||||
typedef struct _ShellStartupSequence ShellStartupSequence;
|
ClutterActor *shell_startup_sequence_create_icon (MetaStartupSequence *sequence, guint size);
|
||||||
#define SHELL_TYPE_STARTUP_SEQUENCE (shell_startup_sequence_get_type ())
|
|
||||||
GType shell_startup_sequence_get_type (void);
|
|
||||||
|
|
||||||
const char *shell_startup_sequence_get_id (ShellStartupSequence *sequence);
|
|
||||||
ShellApp *shell_startup_sequence_get_app (ShellStartupSequence *sequence);
|
|
||||||
const char *shell_startup_sequence_get_name (ShellStartupSequence *sequence);
|
|
||||||
gboolean shell_startup_sequence_get_completed (ShellStartupSequence *sequence);
|
|
||||||
int shell_startup_sequence_get_workspace (ShellStartupSequence *sequence);
|
|
||||||
ClutterActor *shell_startup_sequence_create_icon (ShellStartupSequence *sequence, guint size);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user