]> Dogcows Code - chaz/openbox/commitdiff
Merge branch 'backport' into work
authorDana Jansens <danakj@orodu.net>
Sun, 2 Mar 2008 22:23:23 +0000 (17:23 -0500)
committerDana Jansens <danakj@orodu.net>
Sun, 2 Mar 2008 22:23:23 +0000 (17:23 -0500)
Conflicts:

openbox/actions/execute.c
openbox/event.c
openbox/openbox.c
openbox/openbox.h

12 files changed:
1  2 
openbox/actions/execute.c
openbox/actions/exit.c
openbox/actions/session.c
openbox/client.c
openbox/debug.c
openbox/event.c
openbox/misc.h
openbox/openbox.c
openbox/openbox.h
openbox/prompt.c
openbox/prompt.h
openbox/screen.c

index 81aa6d22b881d0b795de19e186aba0e958388348,cb3ab24796a0e74d0da9ecf87ccdc8cc21bcfed0..05ab2ef3c6fda7085c8fbf0aea0cd59f078d9567
@@@ -202,9 -147,8 +207,9 @@@ static gboolean run_func(ObActionsData 
         it so the application can grab things */
      event_cancel_all_key_grabs();
  
 +    e = NULL;
      if (!g_shell_parse_argv(cmd, NULL, &argv, &e)) {
-         g_message(_("Failed to execute \"%s\": %s"), o->cmd, e->message);
+         g_message(e->message, o->cmd);
          g_error_free(e);
      }
      else {
                                         screen_desktop);
          }
  
 -        if (!g_spawn_async(NULL, argv, NULL,
 -                           G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
 -                           NULL, NULL, NULL, &e))
 -        {
 +        e = NULL;
 +        ok = g_spawn_async(NULL, argv, NULL,
 +                           G_SPAWN_SEARCH_PATH |
 +                           G_SPAWN_DO_NOT_REAP_CHILD,
 +                           NULL, NULL, NULL, &e);
 +        if (!ok) {
-             g_message(_("Failed to execute \"%s\": %s"),
-                       o->cmd, e->message);
+             g_message(e->message, o->cmd);
              g_error_free(e);
 -
 -            if (o->sn)
 -                sn_spawn_cancel();
          }
 -        if (o->sn)
 +
 +        if (o->sn) {
 +            if (!ok) sn_spawn_cancel();
              unsetenv("DESKTOP_STARTUP_ID");
 +        }
  
          g_free(program);
          g_strfreev(argv);
Simple merge
Simple merge
Simple merge
diff --cc openbox/debug.c
index 04a958208ecf1ac9d4cc315d33e38e19ad98cfa7,0fceba489d64e90c79178b041830d7e9b1c07f2f..6b92c9ec9dd74f4aec81978282d3ef4e987cb142
@@@ -99,86 -50,29 +99,86 @@@ void ob_debug_enable(ObDebugType type, 
      enabled_types[type] = enable;
  }
  
 -void ob_debug_type(ObDebugType type, const gchar *a, ...)
 +static inline void log_print(FILE *out, const gchar* log_domain,
 +                             const gchar *level, const gchar *message)
  {
 -    va_list vl;
 +    fprintf(out, log_domain);
 +    fprintf(out, "-");
 +    fprintf(out, level);
 +    fprintf(out, ": ");
 +    fprintf(out, message);
 +    fprintf(out, "\n");
 +    fflush(out);
 +}
 +
 +static void log_handler(const gchar *log_domain, GLogLevelFlags log_level,
 +                        const gchar *message, gpointer data)
 +{
 +    FILE *out;
 +    const gchar *level;
 +
 +    switch (log_level & G_LOG_LEVEL_MASK) {
 +    case G_LOG_LEVEL_DEBUG:    level = "Debug";    out = stdout; break;
 +    case G_LOG_LEVEL_INFO:     level = "Info";     out = stdout; break;
 +    case G_LOG_LEVEL_MESSAGE:  level = "Message";  out = stdout; break;
 +    case G_LOG_LEVEL_WARNING:  level = "Warning";  out = stderr; break;
 +    case G_LOG_LEVEL_CRITICAL: level = "Critical"; out = stderr; break;
 +    case G_LOG_LEVEL_ERROR:    level = "Error";    out = stderr; break;
 +    default:                   g_assert_not_reached(); /* invalid level.. */
 +    }
 +
 +    log_print(out, log_domain, level, message);
 +    if (log_file) log_print(log_file, log_domain, level, message);
 +}
 +
 +static void prompt_handler(const gchar *log_domain, GLogLevelFlags log_level,
 +                           const gchar *message, gpointer data)
 +{
 +    if (ob_state() == OB_STATE_RUNNING)
-         prompt_show_message(message, _("Close"));
++        prompt_show_message(message, _("Openbox"), _("Close"));
 +}
 +
 +static inline void log_argv(ObDebugType type,
 +                            const gchar *format, va_list args)
 +{
 +    const gchar *prefix;
 +    gchar *message;
  
      g_assert(type < OB_DEBUG_TYPE_NUM);
 +    if (!enabled_types[type]) return;
 +
 +    switch (type) {
 +    case OB_DEBUG_FOCUS:    prefix = "(FOCUS) ";           break;
 +    case OB_DEBUG_APP_BUGS: prefix = "(APPLICATION BUG) "; break;
 +    case OB_DEBUG_SM:       prefix = "(SESSION) ";         break;
 +    default:                prefix = NULL;                 break;
 +    }
  
 -    if (show && enabled_types[type]) {
 -        switch (type) {
 -        case OB_DEBUG_FOCUS:
 -            fprintf(stderr, "FOCUS: ");
 -            break;
 -        case OB_DEBUG_APP_BUGS:
 -            fprintf(stderr, "APPLICATION BUG: ");
 -            break;
 -        case OB_DEBUG_SM:
 -            fprintf(stderr, "SESSION: ");
 -            break;
 -        default:
 -            g_assert_not_reached();
 -        }
 -
 -        va_start(vl, a);
 -        vfprintf(stderr, a, vl);
 -        va_end(vl);
 +    message = g_strdup_vprintf(format, args);
 +    if (prefix) {
 +        gchar *a = message;
 +        message = g_strconcat(prefix, message, NULL);
 +        g_free(a);
      }
 +
 +    g_debug(message);
 +    g_free(message);
 +}
 +
 +void ob_debug(const gchar *a, ...)
 +{
 +    va_list vl;
 +
 +    va_start(vl, a);
 +    log_argv(OB_DEBUG_NORMAL, a, vl);
 +    va_end(vl);
 +}
 +
 +void ob_debug_type(ObDebugType type, const gchar *a, ...)
 +{
 +    va_list vl;
 +
 +    va_start(vl, a);
 +    log_argv(type, a, vl);
 +    va_end(vl);
  }
diff --cc openbox/event.c
index 9705fb656deeb82f92a7a975c2d45d3fc38a5e19,a7f65fcb1e15ed192825a4e11dab4de1aca9f5b3..a0ce223a231eaa5a14b4170e54d2c27f948f2ef7
@@@ -656,9 -651,12 +656,11 @@@ static void event_process(const XEvent 
      else if (e->type == MappingNotify) {
          /* keyboard layout changes for modifier mapping changes. reload the
             modifier map, and rebind all the key bindings as appropriate */
 -        ob_debug("Kepboard map changed. Reloading keyboard bindings.\n");
 +        ob_debug("Kepboard map changed. Reloading keyboard bindings.");
+         ob_set_state(OB_STATE_RECONFIGURING);
 -        modkeys_shutdown(TRUE);
 -        modkeys_startup(TRUE);
 +        obt_keyboard_reload();
          keyboard_rebind();
+         ob_set_state(OB_STATE_RUNNING);
      }
      else if (e->type == ClientMessage) {
          /* This is for _NET_WM_REQUEST_FRAME_EXTENTS messages. They come for
diff --cc openbox/misc.h
Simple merge
index 01aa58a2de0819b520679797acd91f3864d78d6c,7221556e1fb62aa94bb11d00afd6f8465d956014..3f286092cfd70ec9607c66bd21c09d91932e918a
@@@ -118,10 -121,8 +118,10 @@@ gint main(gint argc, gchar **argv
  {
      gchar *program_name;
  
-     state = OB_STATE_STARTING;
+     ob_set_state(OB_STATE_STARTING);
  
 +    ob_debug_startup();
 +
      /* initialize the locale */
      if (!setlocale(LC_ALL, ""))
          g_message("Couldn't set locale from environment.");
      cursors[OB_CURSOR_NORTHWEST] = load_cursor("top_left_corner",
                                                 XC_top_left_corner);
  
 -
 -    prop_startup(); /* get atoms values for the display */
 -    extensions_query_all(); /* find which extensions are present */
 -
      if (screen_annex()) { /* it will be ours! */
          do {
 -            modkeys_startup(reconfigure);
+             ObPrompt *xmlprompt = NULL;
 +            if (reconfigure) obt_keyboard_reload();
  
              /* get the keycodes for keys we use */
 -            keys[OB_KEY_RETURN] = modkeys_sym_to_code(XK_Return);
 -            keys[OB_KEY_ESCAPE] = modkeys_sym_to_code(XK_Escape);
 -            keys[OB_KEY_LEFT] = modkeys_sym_to_code(XK_Left);
 -            keys[OB_KEY_RIGHT] = modkeys_sym_to_code(XK_Right);
 -            keys[OB_KEY_UP] = modkeys_sym_to_code(XK_Up);
 -            keys[OB_KEY_DOWN] = modkeys_sym_to_code(XK_Down);
 -            keys[OB_KEY_TAB] = modkeys_sym_to_code(XK_Tab);
 -            keys[OB_KEY_SPACE] = modkeys_sym_to_code(XK_space);
 +            keys[OB_KEY_RETURN] = obt_keyboard_keysym_to_keycode(XK_Return);
 +            keys[OB_KEY_ESCAPE] = obt_keyboard_keysym_to_keycode(XK_Escape);
 +            keys[OB_KEY_LEFT] = obt_keyboard_keysym_to_keycode(XK_Left);
 +            keys[OB_KEY_RIGHT] = obt_keyboard_keysym_to_keycode(XK_Right);
 +            keys[OB_KEY_UP] = obt_keyboard_keysym_to_keycode(XK_Up);
 +            keys[OB_KEY_DOWN] = obt_keyboard_keysym_to_keycode(XK_Down);
 +            keys[OB_KEY_TAB] = obt_keyboard_keysym_to_keycode(XK_Tab);
 +            keys[OB_KEY_SPACE] = obt_keyboard_keysym_to_keycode(XK_space);
  
              {
 -                ObParseInst *i;
 -                xmlDocPtr doc;
 -                xmlNodePtr node;
 +                ObtParseInst *i;
  
                  /* startup the parsing so everything can register sections
                     of the rc */
  
              reconfigure = FALSE;
  
-             state = OB_STATE_RUNNING;
+             ob_set_state(OB_STATE_RUNNING);
+             /* look for parsing errors */
+             {
+                 xmlErrorPtr e = xmlGetLastError();
+                 if (e) {
+                     gchar *m;
+                     m = g_strdup_printf(_("One or more XML syntax errors were found while parsing the Openbox configuration files.  See stdout for more information.  The last error seen was in file \"%s\" line %d, with message: %s"), e->file, e->line, e->message);
+                     xmlprompt =
+                         prompt_show_message(m, _("Openbox Syntax Error"), _("Close"));
+                     g_free(m);
+                     xmlResetError(e);
+                 }
+             }
 -            ob_main_loop_run(ob_main_loop);
 +            obt_main_loop_run(ob_main_loop);
-             state = OB_STATE_EXITING;
+             ob_set_state(reconfigure ?
+                          OB_STATE_RECONFIGURING : OB_STATE_EXITING);
+             if (xmlprompt) {
+                 prompt_unref(xmlprompt);
+                 xmlprompt = NULL;
+             }
  
 -            if (!reconfigure) {
 -                dock_remove_all();
 -                client_unmanage_all();
 -            }
 +            if (!reconfigure)
 +                window_unmanage_all();
  
+             prompt_shutdown(reconfigure);
              menu_shutdown(reconfigure);
              menu_frame_shutdown(reconfigure);
              mouse_shutdown(reconfigure);
index ba221832ab97d19f0de56f99f0572f4075ca1c00,06d38297270bc208215b362d91f79af7cfa328ff..2a938c5d1154edc4e02a3529f3e22776b6034bfa
@@@ -48,14 -51,15 +48,15 @@@ extern gboolean ob_replace_wm
  extern gboolean ob_debug_xinerama;
  
  /* The state of execution of the window manager */
 -ObState ob_state();
 +ObState ob_state(void);
+ void ob_set_state(ObState state);
  
  void ob_restart_other(const gchar *path);
 -void ob_restart();
 +void ob_restart(void);
  void ob_exit(gint code);
 -void ob_exit_replace();
 +void ob_exit_replace(void);
  
 -void ob_reconfigure();
 +void ob_reconfigure(void);
  
  void ob_exit_with_error(const gchar *msg);
  
index d4dcbb7bf856bdd46a3fa90085de98fcefaa8f6e,f531b70c2f10ca6d1483d4ea32589d55bdb45557..31d805ae2a6000ff133a8c9b9ddb4792a6de4e3f
@@@ -158,9 -169,13 +168,13 @@@ ObPrompt* prompt_new(const gchar *msg, 
                                         &attrib);
  
      /* make it a dialog type window */
 -    PROP_SET32(self->super.window, net_wm_window_type, atom,
 -               prop_atoms.net_wm_window_type_dialog);
 +    OBT_PROP_SET32(self->super.window, NET_WM_WINDOW_TYPE, ATOM,
 +                   OBT_PROP_ATOM(NET_WM_WINDOW_TYPE_DIALOG));
  
 -        PROP_SETS(self->super.window, net_wm_name, title);
+     /* set the window's title */
+     if (title)
++        OBT_PROP_SETS(self->super.window, NET_WM_NAME, utf8, title);
      /* listen for key presses on the window */
      self->event_mask = KeyPressMask;
  
Simple merge
index cd46c53bcb76cfa6092eb11a6e2db8fcb770057d,15b3c8d80ccaa69d3e5a4b1707a7680fee49f448..3b9f66ff35a66cce6d06dbfcf4db8e50be855ce1
@@@ -478,10 -489,10 +478,10 @@@ void screen_resize(void
      /* Set the _NET_DESKTOP_GEOMETRY hint */
      screen_physical_size.width = geometry[0] = w;
      screen_physical_size.height = geometry[1] = h;
 -    PROP_SETA32(RootWindow(ob_display, ob_screen),
 -                net_desktop_geometry, cardinal, geometry, 2);
 +    OBT_PROP_SETA32(obt_root(ob_screen),
 +                    NET_DESKTOP_GEOMETRY, CARDINAL, geometry, 2);
  
-     if (ob_state() == OB_STATE_STARTING)
+     if (ob_state() != OB_STATE_RUNNING)
          return;
  
      screen_update_areas();
This page took 0.049378 seconds and 4 git commands to generate.