/*
* 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
#include "netwm.h"
#include "xwindow.h"
#include "bindmaps.h"
+#include "return.h"
+#include "conf.h"
static void set_clientwin_state(WClientWin *cwin, int state);
}
-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)
{
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;
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;
}
-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)
{
XWMHints *hints;
int init_state=NormalState;
WManageParams param=MANAGEPARAMS_INIT;
+ void *mrshpm[2];
param.dockapp=FALSE;
FALSE);
}
- if(!handle_target_prop(cwin, ¶m)){
- bool managed;
- void *mrshpm[2];
-
- mrshpm[0]=cwin;
- mrshpm[1]=¶m;
+ mrshpm[0]=cwin;
+ mrshpm[1]=¶m;
- 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 &&
region_set_activity((WRegion*)cwin, SETPARAM_SET);
}
-
if(postmanage_check(cwin, &attr)){
if(param.jumpto && ioncore_g.focus_next==NULL)
region_goto((WRegion*)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);
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);
}
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);
}
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);
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);
}