00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00031 #ifndef HILDON_NAVIGATOR_WM_H
00032 #define HILDON_NAVIGATOR_WM_H
00033
00034 #include <X11/Xlib.h>
00035 #include <X11/Xatom.h>
00036
00037 #include <gdk/gdk.h>
00038 #include <gdk/gdkx.h>
00039 #include <gdk/gdkevents.h>
00040
00041 #include <gtk/gtk.h>
00042
00043 #include <hildon-navigator.h>
00044 #include <hildon-widgets/hildon-defines.h>
00045 #include <hildon-widgets/hildon-banner.h>
00046 #include <hildon-widgets/hildon-note.h>
00047
00048 #include <libosso.h>
00049 #include <log-functions.h>
00050
00051 #include <libmb/mbdotdesktop.h>
00052 #include <libmb/mbutil.h>
00053
00054 #define DBUS_API_SUBJECT_TO_CHANGE
00055 #include <dbus/dbus.h>
00056
00057 #include <stdlib.h>
00058 #include <string.h>
00059 #include <dirent.h>
00060 #include <signal.h>
00061 #include <sys/types.h>
00062 #include <sys/stat.h>
00063 #include <sys/time.h>
00064 #include <pwd.h>
00065
00066 #include "hn-wm-types.h"
00067 #include "application-switcher.h"
00068 #include "osso-manager.h"
00069 #include "others-menu.h"
00070 #include "hildon-navigator-interface.h"
00071
00072 #define HN_WANT_DEBUG 1
00073
00074 #if (HN_WANT_DEBUG)
00075 #define HN_DBG(x, a...) \
00076 fprintf(stderr, __FILE__ ":%d,%s() " x "\n", __LINE__, __func__, ##a)
00077 #else
00078 #define HN_DBG(x, a...) do {} while (0)
00079 #endif
00080 #define HN_MARK() HN_DBG("--mark--");
00081
00082
00083
00084 #define DESKTOP_EXEC_FIELD "Exec"
00085 #define DESKTOP_LAUNCH_FIELD "X-Osso-Service"
00086 #define DESKTOP_VISIBLE_FIELD "Name"
00087 #define DESKTOP_ICON_FIELD "Icon"
00088 #define DESKTOP_SUP_WMCLASS "StartupWMClass"
00089 #define DESKTOP_STARTUPNOTIFY "StartupNotify"
00090 #define DESKTOP_SUFFIX ".desktop"
00091 #define UNKNOWN_TITLE "Unknown"
00092
00093
00094
00095 #define APP_LAUNCH_BANNER_METHOD_INTERFACE "com.nokia.tasknav.app_launch_banner"
00096 #define APP_LAUNCH_BANNER_METHOD_PATH "/com/nokia/tasknav/app_launch_banner"
00097 #define APP_LAUNCH_BANNER_METHOD "app_launch_banner"
00098 #define APP_LAUNCH_BANNER_MSG_LOADING "ckct_ib_application_loading"
00099 #define APP_LAUNCH_BANNER_MSG_LOADING_FAILED "ckct_ib_application_loading_failed"
00100
00101 #define APP_LAUNCH_BANNER_TIMEOUT 20
00102
00103 #define APP_LAUNCH_BANNER_TIMEOUT_LOWMEM 40
00104
00105 #define APP_LAUNCH_BANNER_CHECK_INTERVAL 0.5
00106
00107
00108
00109 #define MAEMO_LAUNCHER_SIGNAL_IFACE "org.maemo.launcher"
00110 #define MAEMO_LAUNCHER_SIGNAL_PATH "/org/maemo/launcher"
00111 #define APP_DIED_SIGNAL_NAME "ApplicationDied"
00112
00113
00114
00115 #define APPKILLER_SIGNAL_INTERFACE "com.nokia.osso_app_killer"
00116 #define APPKILLER_SIGNAL_PATH "/com/nokia/osso_app_killer"
00117 #define APPKILLER_SIGNAL_NAME "exit"
00118
00119
00120
00121 #define LAUNCH_SUCCESS_TIMEOUT 20
00122
00123
00124 #define LOWMEM_PROC_ALLOWED "/proc/sys/vm/lowmem_allowed_pages"
00125 #define LOWMEM_PROC_USED "/proc/sys/vm/lowmem_used_pages"
00126
00127 #define LOWMEM_LAUNCH_BANNER_TIMEOUT 0
00128 #define LOWMEM_LAUNCH_BANNER_TIMEOUT_MAX 60000
00129 #define LOWMEM_LAUNCH_BANNER_TIMEOUT_ENV "NAVIGATOR_LOWMEM_LAUNCH_BANNER_TIMEOUT"
00130
00131 #define LOWMEM_TIMEOUT_MULTIPLIER_ENV "NAVIGATOR_LOWMEM_TIMEOUT_MULTIPLIER"
00132 #define LOWMEM_TIMEOUT_MULTIPLIER 2
00133
00134 #define LOWMEM_LAUNCH_THRESHOLD_DISTANCE 2500
00135 #define LOWMEM_LAUNCH_THRESHOLD_DISTANCE_ENV "NAVIGATOR_LOWMEM_LAUNCH_THRESHOLD_DISTANCE"
00136
00137 #define KILL_DELAY 2000
00138 #define KILL_DELAY_LOWMEM 4000
00139
00140 struct HNWMLaunchBannerInfo
00141 {
00142 GtkWidget *parent;
00143 GtkWidget *banner;
00144 struct timeval launch_time;
00145 gchar *msg;
00146 HNWMWatchableApp *app;
00147 };
00148
00149 struct HNWM
00150 {
00151
00152 Atom atoms[HN_ATOM_COUNT];
00153
00154
00155
00156
00157 GHashTable *watched_windows;
00158
00159
00160
00161
00162
00163 GHashTable *watched_windows_hibernating;
00164
00165
00166
00167
00168
00169
00170 GHashTable *watched_apps;
00171
00172 ApplicationSwitcher_t *app_switcher;
00173
00174
00175
00176 gulong lowmem_banner_timeout;
00177 gulong lowmem_min_distance;
00178 gulong lowmem_timeout_multiplier;
00179 gboolean lowmem_situation;
00180
00181 gboolean bg_kill_situation;
00182 gint timer_id;
00183 gboolean about_to_shutdown;
00184 };
00185
00186
00187 HNWM *hn_wm_get_singleton(void);
00188
00194 void hn_wm_top_view(GtkMenuItem *menuitem);
00195
00196
00200 gboolean hn_wm_top_service(const gchar *service_name);
00201
00205 void hn_wm_top_desktop(void);
00206
00207
00208 HNWMWatchedWindow*
00209 hn_wm_lookup_watched_window_via_service (const gchar *service_name);
00210
00211 HNWMWatchedWindow*
00212 hn_wm_lookup_watched_window_via_menu_widget (GtkWidget *menu_widget);
00213
00214 HNWMWatchableApp*
00215 hn_wm_lookup_watchable_app_via_service (const gchar *service_name);
00216
00217 HNWMWatchableApp*
00218 hn_wm_lookup_watchable_app_via_exec (const gchar *exec_name);
00219
00220 HNWMWatchableApp*
00221 hn_wm_lookup_watchable_app_via_menu (GtkWidget *menu);
00222
00223 HNWMWatchedWindow*
00224 hn_wm_lookup_watched_window_view (GtkWidget *menu_widget);
00225
00226 gchar *
00227 hn_wm_compute_watched_window_hibernation_key (Window xwin,
00228 HNWMWatchableApp *app);
00229
00230 gboolean
00231 hn_wm_init (ApplicationSwitcher_t *as);
00232
00233
00234
00235 typedef struct
00236 {
00237 Window window_id;
00238 union win_value *viewlist;
00239 gulong num_views;
00240 } view_clean_t;
00241
00242 typedef struct
00243 {
00244 gpointer menu_ptr;
00245 gulong view_id;
00246 gchar *service;
00247 gchar *wm_class;
00248 gulong window_id;
00249 } menuitem_comp_t;
00250
00251
00252 #include "hn-wm-util.h"
00253 #include "hn-wm-memory.h"
00254 #include "hn-wm-watchable-app.h"
00255 #include "hn-wm-watched-window.h"
00256 #include "hn-wm-watched-window-view.h"
00257
00258 #endif
00259