aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@novell.com>2010-04-15 03:13:19 +0800
committerMichael Meeks <michael.meeks@novell.com>2010-04-15 03:13:19 +0800
commit41a762eee8b46a4c5243e50dacf5857380a3752a (patch)
treea9eca15ba2675bb50e3002350b89e308212b261a /shell
parent41cf6f96d385935c2cd2abb98bdca50223dd0eff (diff)
downloadgsoc2013-evolution-41a762eee8b46a4c5243e50dacf5857380a3752a.tar
gsoc2013-evolution-41a762eee8b46a4c5243e50dacf5857380a3752a.tar.gz
gsoc2013-evolution-41a762eee8b46a4c5243e50dacf5857380a3752a.tar.bz2
gsoc2013-evolution-41a762eee8b46a4c5243e50dacf5857380a3752a.tar.lz
gsoc2013-evolution-41a762eee8b46a4c5243e50dacf5857380a3752a.tar.xz
gsoc2013-evolution-41a762eee8b46a4c5243e50dacf5857380a3752a.tar.zst
gsoc2013-evolution-41a762eee8b46a4c5243e50dacf5857380a3752a.zip
add EVO_MEEGO debugging env var:
export EVO_MEEGO="session-type=small-screen" for the most fun.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-meego.c99
1 files changed, 52 insertions, 47 deletions
diff --git a/shell/e-shell-meego.c b/shell/e-shell-meego.c
index 70401c1e62..3e1bb8a393 100644
--- a/shell/e-shell-meego.c
+++ b/shell/e-shell-meego.c
@@ -37,15 +37,9 @@ void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen)
#else
void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen)
{
- GdkAtom wm_win, mob_atom;
- Atom dummy_t;
- unsigned long dummy_l;
- int dummy_i;
- GdkScreen *screen;
- GdkDisplay *display;
Window *wm_window_v = NULL;
unsigned char *moblin_string = NULL;
- GModule *module;
+ GModule *module = NULL;
/*
* Wow - this is unpleasant, but it is hard to link directly
* to the X libraries, and we have to use XGetWindowProperty
@@ -60,46 +54,56 @@ void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen)
*is_meego = *small_screen = FALSE;
- if (!gdk_display_get_default ())
- return;
-
- wm_win = gdk_atom_intern ("_NET_SUPPORTING_WM_CHECK", TRUE);
- mob_atom = gdk_atom_intern ("_MOBLIN", TRUE);
- if (!wm_win || !mob_atom)
- return;
-
- module = g_module_open (NULL, 0);
- if (!module)
- return;
- g_module_symbol (module, "XFree", (gpointer) &fns.XFree);
- g_module_symbol (module, "XGetWindowProperty",
- (gpointer) &fns.XGetWindowProperty);
- if (!fns.XFree || !fns.XGetWindowProperty) {
- fprintf (stderr, "defective X server\n");
- goto exit;
- }
+ moblin_string = (unsigned char *)g_getenv ("EVO_MEEGO");
+ if (!moblin_string) {
+ GdkScreen *screen;
+ GdkDisplay *display;
+ GdkAtom wm_win, mob_atom;
+ Atom dummy_t;
+ unsigned long dummy_l;
+ int dummy_i;
+
+ if (!gdk_display_get_default ())
+ return;
+
+ wm_win = gdk_atom_intern ("_NET_SUPPORTING_WM_CHECK", TRUE);
+ mob_atom = gdk_atom_intern ("_MOBLIN", TRUE);
+ if (!wm_win || !mob_atom)
+ return;
+
+ module = g_module_open (NULL, 0);
+ if (!module)
+ return;
+ g_module_symbol (module, "XFree", (gpointer) &fns.XFree);
+ g_module_symbol (module, "XGetWindowProperty",
+ (gpointer) &fns.XGetWindowProperty);
+ if (!fns.XFree || !fns.XGetWindowProperty) {
+ fprintf (stderr, "defective X server\n");
+ goto exit;
+ }
- display = gdk_display_get_default ();
- screen = gdk_display_get_default_screen (gdk_display_get_default());
+ display = gdk_display_get_default ();
+ screen = gdk_display_get_default_screen (gdk_display_get_default());
- gdk_error_trap_push ();
+ gdk_error_trap_push ();
- /* get the window manager's supporting window */
- fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display),
- GDK_WINDOW_XID (gdk_screen_get_root_window (screen)),
- gdk_x11_atom_to_xatom_for_display (display, wm_win),
- 0, 1, False, XA_WINDOW, &dummy_t, &dummy_i,
- &dummy_l, &dummy_l, (unsigned char **)(&wm_window_v));
+ /* get the window manager's supporting window */
+ fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display),
+ GDK_WINDOW_XID (gdk_screen_get_root_window (screen)),
+ gdk_x11_atom_to_xatom_for_display (display, wm_win),
+ 0, 1, False, XA_WINDOW, &dummy_t, &dummy_i,
+ &dummy_l, &dummy_l, (unsigned char **)(&wm_window_v));
- /* get the '_Moblin' setting */
- if (wm_window_v && (*wm_window_v != None))
- fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display), *wm_window_v,
- gdk_x11_atom_to_xatom_for_display (display, mob_atom),
- 0, 8192, False, XA_STRING,
- &dummy_t, &dummy_i, &dummy_l, &dummy_l,
- &moblin_string);
-
- gdk_error_trap_pop ();
+ /* get the '_Moblin' setting */
+ if (wm_window_v && (*wm_window_v != None))
+ fns.XGetWindowProperty (gdk_x11_display_get_xdisplay (display), *wm_window_v,
+ gdk_x11_atom_to_xatom_for_display (display, mob_atom),
+ 0, 8192, False, XA_STRING,
+ &dummy_t, &dummy_i, &dummy_l, &dummy_l,
+ &moblin_string);
+
+ gdk_error_trap_pop ();
+ }
if (moblin_string) {
int i;
@@ -123,14 +127,15 @@ void e_shell_detect_meego (gboolean *is_meego, gboolean *small_screen)
g_strfreev (pair);
}
g_strfreev (props);
- fns.XFree (moblin_string);
+ if (fns.XFree)
+ fns.XFree (moblin_string);
}
exit:
if (wm_window_v)
- fns.XFree (wm_window_v);
-
- g_module_close (module);
+ fns.XFree (wm_window_v);
+ if (module)
+ g_module_close (module);
}
#endif