/** * shell_app_system_get_from_pid: * @self; A #ShellAppSystem * @pid: A Unix process identifier * * Look up the application corresponding to a process. * * Returns: (transfer full): A #ShellApp, or %NULL if none */ ShellApp * shell_window_tracker_get_app_from_pid (ShellWindowTracker *self, int pid) { ShellGlobal *global = shell_global_get (); GList *windows, *iter; windows = shell_global_get_windows (global); for (iter = windows; iter; iter = iter->next) { MutterWindow *win = iter->data; MetaWindow *metawin; int windowpid; ShellApp *app; metawin = mutter_window_get_meta_window (win); windowpid = meta_window_get_pid (metawin); if (windowpid != pid) continue; app = shell_window_tracker_get_window_app (self, metawin); if (app) return app; } return NULL; }
static void update_focus_app (ShellWindowTracker *self) { MetaWindow *new_focus_win; ShellApp *new_focus_app; new_focus_win = meta_display_get_focus_window (shell_global_get_display (shell_global_get ())); /* we only consider an app focused if the focus window can be clearly * associated with a running app; this is the case if the focus window * or one of its parents is visible in the taskbar, e.g. * - 'nautilus' should appear focused when its about dialog has focus * - 'nautilus' should not appear focused when the DESKTOP has focus */ while (new_focus_win && meta_window_is_skip_taskbar (new_focus_win)) new_focus_win = meta_window_get_transient_for (new_focus_win); new_focus_app = new_focus_win ? shell_window_tracker_get_window_app (self, new_focus_win) : NULL; if (new_focus_app) { shell_app_update_window_actions (new_focus_app, new_focus_win); shell_app_update_app_menu (new_focus_app, new_focus_win); } set_focus_app (self, new_focus_app); }
static void update_focus_app (ShellWindowTracker *self) { MetaWindow *new_focus_win; ShellApp *new_focus_app; new_focus_win = meta_display_get_focus_window (meta_screen_get_display (shell_global_get_screen (shell_global_get ()))); new_focus_app = new_focus_win ? shell_window_tracker_get_window_app (self, new_focus_win) : NULL; set_focus_app (self, new_focus_app); }
static void update_focus_app (ShellWindowTracker *self) { MetaWindow *new_focus_win; ShellApp *new_focus_app; new_focus_win = meta_display_get_focus_window (shell_global_get_display (shell_global_get ())); new_focus_app = new_focus_win ? shell_window_tracker_get_window_app (self, new_focus_win) : NULL; if (new_focus_app) { shell_app_update_window_actions (new_focus_app, new_focus_win); shell_app_update_app_menu (new_focus_app, new_focus_win); } set_focus_app (self, new_focus_app); }
static ClutterActor* load_icon_for_window(MetaSwitcher* self, MetaWindow* window) { MetaSwitcherPrivate *priv = self->priv; MetaScreen *screen = meta_plugin_get_screen(priv->plugin); ShellWindowTracker* tracker = shell_window_tracker_get_default(); ShellApp* app = shell_window_tracker_get_window_app(tracker, window); gint screen_width, screen_height, app_icon_size = APP_ICON_SIZE; /* TODO: @sonald scale app icon size at first */ meta_screen_get_size(screen, &screen_width, &screen_height); if (priv->apps->len) app_icon_size = (screen_width - priv->apps->len * APP_ICON_PADDING ) / priv->apps->len; if (app_icon_size > APP_ICON_SIZE) app_icon_size = APP_ICON_SIZE; if (app) return shell_app_create_icon_texture(app, app_icon_size); return NULL; }