]> git.decadent.org.uk Git - ion3.git/blobdiff - ioncore/clientwin.c
[svn-upgrade] Integrating new upstream version, ion3 (20070203)
[ion3.git] / ioncore / clientwin.c
index 4b4dbe4a56ab4011a5f28071b9d3a423e0f00855..d80c37b8c73c86395d7879f6d06212f73f47eb2a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * ion/ioncore/clientwin.c
  *
- * Copyright (c) Tuomo Valkonen 1999-2006
+ * Copyright (c) Tuomo Valkonen 1999-2007
  *
  * 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
@@ -41,6 +41,8 @@
 #include "netwm.h"
 #include "xwindow.h"
 #include "bindmaps.h"
+#include "return.h"
+#include "conf.h"
 
 
 static void set_clientwin_state(WClientWin *cwin, int state);
@@ -78,22 +80,6 @@ void clientwin_get_protocols(WClientWin *cwin)
 }
 
 
-static bool get_winprop_fn_set=FALSE;
-static ExtlFn get_winprop_fn;
-
-/*EXTL_DOC
- * Set function used to look up winprops.
- */
-EXTL_EXPORT
-void ioncore_set_get_winprop_fn(ExtlFn fn)
-{
-    if(get_winprop_fn_set)
-        extl_unref_fn(get_winprop_fn);
-    get_winprop_fn=extl_ref_fn(fn);
-    get_winprop_fn_set=TRUE;
-}
-
-
 static WSizePolicy get_sizepolicy_winprop(WClientWin *cwin,
                                           const char *propname,
                                           WSizePolicy value)
@@ -118,17 +104,8 @@ static void clientwin_get_winprops(WClientWin *cwin)
 {
     ExtlTab tab, tab2;
     int i1, i2;
-    bool ret;
     
-    if(!get_winprop_fn_set)
-        return;
-    
-    extl_protect(NULL);
-    ret=extl_call(get_winprop_fn, "o", "t", cwin, &tab);
-    extl_unprotect(NULL);
-
-    if(!ret)
-        return;
+    tab=ioncore_get_winprop(cwin);
     
     cwin->proptab=tab;
     
@@ -346,8 +323,6 @@ static bool clientwin_init(WClientWin *cwin, WWindow *par, Window win,
     cwin->n_cmapwins=0;
     cwin->event_mask=IONCORE_EVENTMASK_CLIENTWIN;
 
-    cwin->fs_pholder=NULL;
-
     region_init(&(cwin->region), par, &fp);
 
     cwin->region.flags|=REGION_GRAB_ON_PARENT;
@@ -376,26 +351,6 @@ static WClientWin *create_clientwin(WWindow *par, Window win,
 }
 
 
-static bool handle_target_prop(WClientWin *cwin, const WManageParams *param)
-{
-    WRegion *r=NULL;
-    char *target_name=NULL;
-    
-    if(extl_table_gets_s(cwin->proptab, "target", &target_name)){
-        r=ioncore_lookup_region(target_name, NULL);
-        
-        free(target_name);
-    
-        if(r!=NULL){
-            if(region_manage_clientwin(r, cwin, param, 
-                                       MANAGE_REDIR_PREFER_NO))
-                return TRUE;
-        }
-    }
-    
-    return FALSE;
-}
-
 
 WClientWin *clientwin_get_transient_for(const WClientWin *cwin)
 {
@@ -484,6 +439,7 @@ WClientWin* ioncore_manage_clientwin(Window win, bool maprq)
     XWMHints *hints;
     int init_state=NormalState;
     WManageParams param=MANAGEPARAMS_INIT;
+    void *mrshpm[2];
 
     param.dockapp=FALSE;
     
@@ -581,21 +537,14 @@ again:
                                   FALSE);
     }
 
-    if(!handle_target_prop(cwin, &param)){
-        bool managed;
-        void *mrshpm[2];
-        
-        mrshpm[0]=cwin;
-        mrshpm[1]=&param;
+    mrshpm[0]=cwin;
+    mrshpm[1]=&param;
         
-        managed=hook_call_alt(clientwin_do_manage_alt, &mrshpm, 
-                              (WHookMarshall*)do_manage_mrsh,
-                              (WHookMarshallExtl*)do_manage_mrsh_extl);
-
-        if(!managed){
-            warn(TR("Unable to manage client window %#x."), win);
-            goto failure;
-        }
+    if(!hook_call_alt(clientwin_do_manage_alt, &mrshpm, 
+                      (WHookMarshall*)do_manage_mrsh,
+                      (WHookMarshallExtl*)do_manage_mrsh_extl)){
+        warn(TR("Unable to manage client window %#x."), win);
+        goto failure;
     }
     
     if(ioncore_g.opmode==IONCORE_OPMODE_NORMAL &&
@@ -604,7 +553,6 @@ again:
         region_set_activity((WRegion*)cwin, SETPARAM_SET);
     }
     
-    
     if(postmanage_check(cwin, &attr)){
         if(param.jumpto && ioncore_g.focus_next==NULL)
             region_goto((WRegion*)cwin);
@@ -696,6 +644,8 @@ void clientwin_deinit(WClientWin *cwin)
     WRegion *reg;
     
     if(cwin->win!=None){
+        region_pointer_focus_hack(&cwin->region);
+
         xwindow_unmanaged_selectinput(cwin->win, 0);
         XUnmapWindow(ioncore_g.dpy, cwin->win);
         
@@ -721,12 +671,6 @@ void clientwin_deinit(WClientWin *cwin)
     
     clientwin_clear_colormaps(cwin);
     
-    if(cwin->fs_pholder!=NULL){
-        WPHolder *ph=cwin->fs_pholder;
-        cwin->fs_pholder=NULL;
-        destroy_obj((Obj*)ph);
-    }
-    
     region_deinit((WRegion*)cwin);
 }
 
@@ -747,12 +691,7 @@ static bool mrsh_u_extl(ExtlFn fn, void *param)
 
 static void clientwin_do_unmapped(WClientWin *cwin, Window win)
 {
-    bool mcf=region_may_control_focus((WRegion*)cwin);
-
-    if(mcf && cwin->fs_pholder!=NULL)
-        pholder_goto(cwin->fs_pholder);
-    
-    destroy_obj((Obj*)cwin);
+    region_dispose_((WRegion*)cwin);
     
     hook_call(clientwin_unmapped_hook, &win, mrsh_u_c, mrsh_u_extl);
 }
@@ -843,6 +782,8 @@ static void set_clientwin_state(WClientWin *cwin, int state)
 
 static void hide_clientwin(WClientWin *cwin)
 {
+    region_pointer_focus_hack(&cwin->region);
+
     if(cwin->flags&CLIENTWIN_PROP_ACROBATIC){
         XMoveWindow(ioncore_g.dpy, cwin->win,
                     -2*REGION_GEOM(cwin).w, -2*REGION_GEOM(cwin).h);
@@ -981,15 +922,8 @@ static bool clientwin_fitrep(WClientWin *cwin, WWindow *np,
         region_set_parent((WRegion*)cwin, np);
         sendconfig_clientwin(cwin);
         
-        if(!REGION_IS_FULLSCREEN(cwin) && cwin->fs_pholder!=NULL){
-            WPHolder *ph=cwin->fs_pholder;
-            cwin->fs_pholder=NULL;
+        if(!REGION_IS_FULLSCREEN(cwin))
             cwin->flags&=~CLIENTWIN_FS_RQ;
-            /* Can't destroy it yet - messes up mplex placeholder
-             * reorganisation.
-             */
-            mainloop_defer_destroy((Obj*)ph);
-        }
 
         netwm_update_state(cwin);
     }