X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=ioncore%2Fioncore.c;h=33eb3e37d229e8856cc51b7989ffa1230abc950a;hb=29aae1975d46f66b97a2b873f1875eded8c6fbc3;hp=5c88803f8d2358f59cb3ea38e55387aa79fce45e;hpb=8366314611bf30a0f31d25bf5f5023186fa87692;p=ion3.git diff --git a/ioncore/ioncore.c b/ioncore/ioncore.c index 5c88803..33eb3e3 100644 --- a/ioncore/ioncore.c +++ b/ioncore/ioncore.c @@ -1,12 +1,9 @@ /* * ion/ioncore/ioncore.c * - * Copyright (c) Tuomo Valkonen 1999-2006. + * Copyright (c) Tuomo Valkonen 1999-2008. * - * Ion is free software; you can redistribute it and/or modify it under - * the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * (at your option) any later version. + * See the included file LICENSE for details. */ #include @@ -14,14 +11,18 @@ #include #include #include +#include #include #include #include #ifndef CF_NO_LOCALE #include #include +#endif +#ifndef CF_NO_GETTEXT #include #endif +#include #include #include @@ -56,6 +57,10 @@ #include "group-cw.h" #include "group-ws.h" #include "llist.h" +#include "exec.h" +#include "screen-notify.h" +#include "key.h" + #include "../version.h" #include "exports.h" @@ -69,18 +74,18 @@ WGlobal ioncore_g; static const char *progname="ion"; static const char ioncore_copy[]= - "Ion " ION_VERSION ", copyright (c) Tuomo Valkonen 1999-2006."; + "Ion " ION_VERSION ", copyright (c) Tuomo Valkonen 1999-2008."; static const char ioncore_license[]=DUMMY_TR( - "This program is free software; you can redistribute it and/or\n" - "modify it under the terms of the GNU Lesser General Public\n" - "License as published by the Free Software Foundation; either\n" - "version 2.1 of the License, or (at your option) any later version.\n" + "This software is licensed under the GNU Lesser General Public License\n" + "(LGPL), version 2.1, extended with terms applying to the use of the name\n" + "of the project, Ion(tm), unless otherwise indicated in components taken\n" + "from elsewhere. For details, see the file LICENSE that you should have\n" + "received with this software.\n" "\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" - "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\n" - "Lesser General Public License for more details.\n"); + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"); static const char *ioncore_about=NULL; @@ -95,12 +100,17 @@ WHook *ioncore_deinit_hook=NULL; /*{{{ warn_nolog */ -void ioncore_warn_nolog(const char *str) +void ioncore_warn_nolog(const char *str, ...) { - fprintf(stderr, "%s: %s\n", prog_execname(), str); + va_list args; + + va_start(args, str); + fprintf(stderr, "%s: ", libtu_progname()); + vfprintf(stderr, str, args); + fprintf(stderr, "\n"); + va_end(args); } - /*}}}*/ @@ -227,6 +237,10 @@ static bool init_locale() return FALSE; } +#endif + +#ifndef CF_NO_GETTEXT + #define TEXTDOMAIN "ion3" static bool init_messages(const char *localedir) @@ -253,12 +267,12 @@ static bool init_messages(const char *localedir) #define INIT_HOOK_(NM) \ NM=mainloop_register_hook(#NM, create_hook()); \ - if(NM==NULL) return FALSE; + if(NM==NULL) return FALSE -#define INIT_HOOK(NM, DFLT) \ - INIT_HOOK_(NM) \ - if(!hook_add(NM, (void (*)())DFLT)) return FALSE; +#define ADD_HOOK_(NM, FN) \ + if(!hook_add(NM, (void (*)())FN)) return FALSE +#define INIT_HOOK(NM, DFLT) INIT_HOOK_(NM); ADD_HOOK_(NM, DFLT) static bool init_hooks() { @@ -267,17 +281,19 @@ static bool init_hooks() INIT_HOOK_(ioncore_deinit_hook); INIT_HOOK_(screen_managed_changed_hook); INIT_HOOK_(frame_managed_changed_hook); - INIT_HOOK_(region_activated_hook); - INIT_HOOK_(region_inactivated_hook); INIT_HOOK_(clientwin_mapped_hook); INIT_HOOK_(clientwin_unmapped_hook); INIT_HOOK_(clientwin_property_change_hook); + INIT_HOOK_(ioncore_submap_ungrab_hook); + INIT_HOOK_(region_notify_hook); + ADD_HOOK_(region_notify_hook, ioncore_screen_activity_notify); INIT_HOOK(clientwin_do_manage_alt, clientwin_do_manage_default); INIT_HOOK(ioncore_handle_event_alt, ioncore_handle_event); INIT_HOOK(region_do_warp_alt, region_do_warp_default); - + INIT_HOOK(ioncore_exec_environ_hook, ioncore_setup_environ); + mainloop_sigchld_hook=mainloop_register_hook("ioncore_sigchld_hook", create_hook()); mainloop_sigusr2_hook=mainloop_register_hook("ioncore_sigusr2_hook", @@ -308,7 +324,11 @@ static bool register_classes() } -static void init_global() +#define INITSTR(NM) \ + ioncore_g.notifies.NM=stringstore_alloc(#NM); \ + if(ioncore_g.notifies.NM==STRINGID_NONE) return FALSE; + +static bool init_global() { /* argc, argv must be set be the program */ ioncore_g.dpy=NULL; @@ -319,6 +339,7 @@ static void init_global() ioncore_g.screens=NULL; ioncore_g.focus_next=NULL; ioncore_g.warp_next=FALSE; + ioncore_g.focus_next_source=IONCORE_FOCUSNEXT_OTHER; ioncore_g.focus_current=NULL; @@ -328,6 +349,9 @@ static void init_global() ioncore_g.opaque_resize=0; ioncore_g.warp_enabled=TRUE; ioncore_g.switchto_new=TRUE; + ioncore_g.no_mousefocus=FALSE; + ioncore_g.unsqueeze_enabled=TRUE; + ioncore_g.autoraise=TRUE; ioncore_g.enc_utf8=FALSE; ioncore_g.enc_sb=TRUE; @@ -338,13 +362,32 @@ static void init_global() ioncore_g.frame_default_index=LLIST_INDEX_AFTER_CURRENT_ACT; ioncore_g.framed_transients=TRUE; + + INITSTR(activated); + INITSTR(inactivated); + INITSTR(activity); + INITSTR(sub_activity); + INITSTR(name); + INITSTR(unset_manager); + INITSTR(set_manager); + INITSTR(unset_return); + INITSTR(set_return); + INITSTR(pseudoactivated); + INITSTR(pseudoinactivated); + INITSTR(tag); + INITSTR(deinit); + INITSTR(map); + INITSTR(unmap); + + return TRUE; } bool ioncore_init(const char *prog, int argc, char *argv[], const char *localedir) { - init_global(); + if(!init_global()) + return FALSE; progname=prog; ioncore_g.argc=argc; @@ -352,6 +395,8 @@ bool ioncore_init(const char *prog, int argc, char *argv[], #ifndef CF_NO_LOCALE init_locale(); +#endif +#ifndef CF_NO_GETTEXT init_messages(localedir); #endif @@ -472,6 +517,7 @@ static bool ioncore_init_x(const char *display, int stflags) ioncore_g.atom_wm_window_role=XInternAtom(dpy, "WM_WINDOW_ROLE", False); ioncore_g.atom_checkcode=XInternAtom(dpy, "_ION_CWIN_RESTART_CHECKCODE", False); ioncore_g.atom_selection=XInternAtom(dpy, "_ION_SELECTION_STRING", False); + ioncore_g.atom_dockapp_hack=XInternAtom(dpy, "_ION_DOCKAPP_HACK", False); ioncore_g.atom_mwm_hints=XInternAtom(dpy, "_MOTIF_WM_HINTS", False); ioncore_init_xim(); @@ -483,7 +529,7 @@ static bool ioncore_init_x(const char *display, int stflags) ioncore_init_session(XDisplayName(display)); for(i=drw; i1)