Main Page | Directories | File List | File Members

hn-wm.h

Go to the documentation of this file.
00001 /* -*- mode:C; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
00002 
00003 /* 
00004  * This file is part of maemo-af-desktop
00005  *
00006  * Copyright (C) 2005, 2006 Nokia Corporation.
00007  *
00008  * Contact: Karoliina Salminen <karoliina.t.salminen@nokia.com>
00009  *
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public License
00012  * version 2.1 as published by the Free Software Foundation.
00013  *
00014  * This library is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00022  * 02110-1301 USA
00023  *
00024  */
00025 
00026 
00031 #ifndef HILDON_NAVIGATOR_WM_H
00032 #define HILDON_NAVIGATOR_WM_H
00033 
00034 #include <X11/Xlib.h>
00035 #include <sys/time.h>
00036 #include <gtk/gtk.h>
00037 
00038 #include "hn-wm-types.h"
00039 
00040 #define HN_WANT_DEBUG 0 /* Set to 1 for more verbose hn */
00041 
00042 #if (HN_WANT_DEBUG)
00043 #define HN_DBG(x, a...) \
00044  fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a)
00045 #else
00046 #define HN_DBG(x, a...) do {} while (0)
00047 #endif
00048 #define HN_MARK() HN_DBG("--mark--");
00049 
00050 /* For gathering available memory information */
00051 #define LOWMEM_PROC_ALLOWED              "/proc/sys/vm/lowmem_allowed_pages"
00052 #define LOWMEM_PROC_USED                 "/proc/sys/vm/lowmem_used_pages"
00053 
00054 #define LOWMEM_LAUNCH_BANNER_TIMEOUT     0
00055 #define LOWMEM_LAUNCH_BANNER_TIMEOUT_MAX 60000
00056 #define LOWMEM_LAUNCH_BANNER_TIMEOUT_ENV "NAVIGATOR_LOWMEM_LAUNCH_BANNER_TIMEOUT"
00057 /* Added by Karoliina 26092005 */
00058 #define LOWMEM_TIMEOUT_MULTIPLIER_ENV    "NAVIGATOR_LOWMEM_TIMEOUT_MULTIPLIER"
00059 #define LOWMEM_TIMEOUT_MULTIPLIER        2
00060 /* */
00061 #define LOWMEM_LAUNCH_THRESHOLD_DISTANCE 2500
00062 #define LOWMEM_LAUNCH_THRESHOLD_DISTANCE_ENV "NAVIGATOR_LOWMEM_LAUNCH_THRESHOLD_DISTANCE"
00063 
00064 /* DBus/Banner etc related defines
00065  */
00066 #define APP_LAUNCH_BANNER_METHOD_INTERFACE   "com.nokia.tasknav.app_launch_banner"
00067 #define APP_LAUNCH_BANNER_METHOD_PATH        "/com/nokia/tasknav/app_launch_banner"
00068 #define APP_LAUNCH_BANNER_METHOD             "app_launch_banner"
00069 #define APP_LAUNCH_BANNER_MSG_LOADING        "ckct_ib_application_loading"
00070 #define APP_LAUNCH_BANNER_MSG_RESUMING       "ckct_ib_application_resuming"
00071 #define APP_LAUNCH_BANNER_MSG_LOADING_FAILED "ckct_ib_application_loading_failed"
00072 /* Timeout of the launch banner, in secons */
00073 #define APP_LAUNCH_BANNER_TIMEOUT            20
00074 /* Timeout of the launch banner in lowmem situation */
00075 #define APP_LAUNCH_BANNER_TIMEOUT_LOWMEM     40
00076 /* Interval for checking for new window or timeout, in seconds */
00077 #define APP_LAUNCH_BANNER_CHECK_INTERVAL     0.5
00078 
00079 /* .desktop file related defines, mainly for keys
00080  */
00081 #define DESKTOP_VISIBLE_FIELD         "Name"
00082 #define DESKTOP_LAUNCH_FIELD          "X-Osso-Service"
00083 #define DESKTOP_EXEC_FIELD            "Exec"
00084 #define DESKTOP_ICON_FIELD            "Icon"
00085 #define DESKTOP_ICON_PATH_FIELD       "X-Icon-path"
00086 #define DESKTOP_SUP_WMCLASS           "StartupWMClass"
00087 #define DESKTOP_STARTUPNOTIFY         "StartupNotify"
00088 #define DESKTOP_TEXT_DOMAIN_FIELD     "X-Text-Domain"
00089 #define DESKTOP_SUFFIX                ".desktop"
00090 
00091 /* Maemo Launcher DBus interface
00092  */
00093 #define MAEMO_LAUNCHER_SIGNAL_IFACE "org.maemo.launcher"
00094 #define MAEMO_LAUNCHER_SIGNAL_PATH "/org/maemo/launcher"
00095 #define APP_DIED_SIGNAL_NAME "ApplicationDied"
00096 
00097 /* Application killer DBus interface
00098  */
00099 #define APPKILLER_SIGNAL_INTERFACE "com.nokia.osso_app_killer"
00100 #define APPKILLER_SIGNAL_PATH      "/com/nokia/osso_app_killer"
00101 #define APPKILLER_SIGNAL_NAME      "exit"
00102 
00103 #define SAVE_METHOD      "save"
00104 #define KILL_APPS_METHOD "kill_app"
00105 
00106 #define UNKNOWN_TITLE         "Unknown"
00107 
00108 #undef  TN_ALWAYS_FOCUSABLE
00109 
00110 #ifdef TN_ALWAYS_FOCUSABLE
00111 #define TN_DEFAULT_FOCUS TRUE
00112 #else
00113 #define TN_DEFAULT_FOCUS FALSE
00114 #endif
00115 
00116 typedef struct
00117 {
00118   gpointer entry_ptr;
00119   gulong view_id;
00120   gchar *service;
00121   gchar *wm_class;
00122   gulong window_id;
00123 } menuitem_comp_t;
00124 
00125 struct HNWMLaunchBannerInfo
00126 {
00127   GtkWidget         *parent;
00128   GtkWidget         *banner;
00129   struct timeval     launch_time;
00130   gchar             *msg;
00131   HNWMWatchableApp  *app;
00132 };
00133 
00139 void hn_wm_top_item (HNEntryInfo *info);
00140 
00141 
00145 gboolean hn_wm_top_service(const gchar *service_name);
00146 
00150 void hn_wm_top_desktop(void);
00151 
00155 void hn_wm_toggle_desktop (void);
00156 
00157 HNWMWatchedWindow*
00158 hn_wm_lookup_watched_window_via_service (const gchar *service_name);
00159 
00160 HNWMWatchedWindow*
00161 hn_wm_lookup_watched_window_via_menu_widget (GtkWidget *menu_widget);
00162 
00163 HNWMWatchableApp*
00164 hn_wm_lookup_watchable_app_via_service (const gchar *service_name);
00165 
00166 HNWMWatchableApp*
00167 hn_wm_lookup_watchable_app_via_exec (const gchar *exec_name);
00168 
00169 HNWMWatchableApp*
00170 hn_wm_lookup_watchable_app_via_menu (GtkWidget *menu);
00171 
00172 HNWMWatchedWindow*
00173 hn_wm_lookup_watched_window_view (GtkWidget *menu_widget);
00174 
00175 gchar *
00176 hn_wm_compute_watched_window_hibernation_key (Window xwin,
00177                           HNWMWatchableApp *app);
00178 
00179 gboolean
00180 hn_wm_init (HNAppSwitcher *as);
00181 
00182 void
00183 hn_wm_dnotify_register (void);
00184 
00185 /* keyboard handling functions */
00186 
00187 void
00188 hn_wm_activate(guint32 what);
00189 
00190 void
00191 hn_wm_focus_active_window (void);
00192 
00193 gboolean
00194 hn_wm_fullscreen_mode (void);
00195 
00196 /*
00197  * These are simple getters/setters that replace direct use of global
00198  * hnwm->something. In order to ensure that we do not incure performance
00199  * penalty due to the function call, we declare all of these as
00200  * 'extern inline'; this ensures that these functions will always be inlined.
00201  */
00202 
00203 
00204 extern inline Atom
00205 hn_wm_get_atom(gint indx);
00206 
00207 extern inline GHashTable *
00208 hn_wm_get_watched_windows(void);
00209 
00210 extern inline GHashTable *
00211 hn_wm_get_hibernating_windows(void);
00212 
00213 extern inline gboolean
00214 hn_wm_is_lowmem_situation(void);
00215 
00216 extern inline void
00217 hn_wm_set_lowmem_situation(gboolean b);
00218 
00219 extern inline gboolean
00220 hn_wm_is_bg_kill_situation(void);
00221 
00222 extern inline void
00223 hn_wm_set_bg_kill_situation(gboolean b);
00224 
00225 extern inline HNAppSwitcher *
00226 hn_wm_get_app_switcher(void);
00227 
00228 extern inline gint
00229 hn_wm_get_timer_id(void);
00230 
00231 extern inline void
00232 hn_wm_set_timer_id(gint id);
00233 
00234 extern inline void
00235 hn_wm_set_about_to_shutdown(gboolean b);
00236 
00237 extern inline gboolean
00238 hn_wm_get_about_to_shutdown(void);
00239 
00240 extern inline GList *
00241 hn_wm_get_banner_stack(void);
00242 
00243 extern inline void
00244 hn_wm_set_banner_stack(GList * l);
00245 
00246 extern inline gulong
00247 hn_wm_get_lowmem_banner_timeout(void);
00248 
00249 extern inline gulong
00250 hn_wm_get_lowmem_timeout_multiplier(void);
00251 
00252 extern inline HNWMWatchedWindow *
00253 hn_wm_get_active_window(void);
00254 
00255 extern inline HNWMWatchedWindow *
00256 hn_wm_get_last_active_window(void);
00257 
00258 extern inline gboolean
00259 hn_wm_modal_windows_present(void);
00260 
00261 /*
00262  * reset the active window to NULL
00263  *
00264  * NB: we intentionally do not provide a setter -- the active window is our
00265  * business alone and must not be done from anywhere else than the WM itself.
00266  * The reset function is only to be called from hn_wm_watched_window_destroy().
00267  */
00268 extern inline void
00269 hn_wm_reset_active_window(void);
00270 
00271 extern inline void
00272 hn_wm_reset_last_active_window(void);
00273 
00274 void 
00275 hn_wm_others_open (void);
00276 
00277 #endif /* HILDON_NAVIGATOR_WM_H */
00278 

Generated on Thu Dec 21 11:26:52 2006 for maemo-af-desktop-documentation by  doxygen 1.4.2