From 720e6978185b09f2b2f60a6b96018238085a7238 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Sat, 15 Dec 2007 03:20:30 +0000 Subject: [PATCH] [svn-upgrade] Integrating new upstream version, ion3 (20071130) --- ChangeLog | 89 +++++++++++++++++++++++++++ LICENSE | 85 +++++++++++++------------- README | 5 +- RELNOTES | 8 +++ de/fontset.c | 30 +++++++++- etc/lookcommon_clean.lua | 10 ++-- etc/lookcommon_emboss.lua | 10 ++-- exact-version | 4 +- ioncore/clientwin.c | 109 ++++++++++++++++++++-------------- ioncore/conf-bindings.c | 2 +- ioncore/conf.c | 1 + ioncore/detach.c | 9 ++- ioncore/frame-draw.c | 28 +++++---- ioncore/frame-draw.h | 2 +- ioncore/frame.c | 88 +++++++++++++++++---------- ioncore/frame.h | 7 ++- ioncore/group-cw.c | 3 +- ioncore/group.c | 10 +++- ioncore/ioncore.c | 10 ++-- ioncore/ioncore_wd.lua | 11 ++-- ioncore/ioncore_winprops.lua | 4 +- ioncore/kbresize.c | 7 ++- ioncore/mplex.c | 10 +++- ioncore/pointer.c | 11 ---- ioncore/resize.c | 47 +++++++++------ mod_query/mod_query_chdir.lua | 38 +++++++++++- mod_tiling/tiling.c | 3 +- utils/ion-completeman.in | 4 +- version.h | 2 +- 29 files changed, 436 insertions(+), 211 deletions(-) diff --git a/ChangeLog b/ChangeLog index e73da79..cfe4c84 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,92 @@ +2007-11-30 17:25 UTC Tuomo Valkonen + tagged ion-3rc-20071130 + +2007-11-30 17:24 UTC Tuomo Valkonen + * Some release notes + +2007-11-29 19:48 UTC Tuomo Valkonen + * Removed pointer event subwindow forwarding hack. + Only useful use cases seem to be handled by not grabbing modifierless + bindings. This was stopping global (WScreen) grabs of buttons from + being handled if there was a frame in the way. (Note that modifierless + pointing device bindings are never grabbed, on purpose, so they still + don't work through frames or client windows.) + +2007-11-29 17:56 UTC Tuomo Valkonen + * Oops, ion-completeman preferred system over user cache. + +2007-11-28 00:33 UTC Tuomo Valkonen + * edge_resistance wasn't dynamically configurable. + +2007-11-27 23:56 UTC Tuomo Valkonen + * 'exec' ion-runinxterm + (Simple case that doesn't clutter the configs etc.; the rest can be + configured by those with crappy shells.) + +2007-11-27 23:48 UTC Tuomo Valkonen + * Snap to base size + +2007-11-27 23:32 UTC Tuomo Valkonen + * Size hint usage tuning + +2007-11-25 15:38 UTC Tuomo Valkonen + * Removed redundant settings from lookcommon_* + +2007-11-25 15:37 UTC Tuomo Valkonen + * Added the -alt bit to all frame modes for completeness. + +2007-11-25 12:30 UTC Tuomo Valkonen + * typo fixes + +2007-11-25 12:09 UTC Tuomo Valkonen + * Frame mode change shape setting fix + +2007-11-25 11:52 UTC Tuomo Valkonen + * Added missing header + +2007-11-25 01:27 UTC Tuomo Valkonen + * reorg + +2007-11-25 00:00 UTC Tuomo Valkonen + * License intro clarifications + +2007-11-24 23:22 UTC Tuomo Valkonen + * Further license simplification + +2007-11-23 17:50 UTC Tuomo Valkonen + * Minor clarification + +2007-11-23 17:39 UTC Tuomo Valkonen + * Try to prevent EnterWindow event triggered focus change when switchto=false. + +2007-11-22 16:43 UTC Tuomo Valkonen + * Added some missing variable initialisations. + +2007-11-21 23:00 UTC Tuomo Valkonen + * Fixes/improvements to dockapp detection kludges on startup. + +2007-11-21 15:16 UTC Tuomo Valkonen + * Clarifications + +2007-11-20 18:28 UTC Tuomo Valkonen + * Clarified the full ancestry of de/fontset.c. + (That can also be seen by examining 'changeset 956'.) + +2007-11-18 09:56 UTC Tuomo Valkonen + * Don't try to store working dir of dead/nameless objects + +2007-11-16 22:22 UTC Tuomo Valkonen + * Do not complain when attempting to nil non-existent binding. + +2007-11-09 18:20 UTC Tuomo Valkonen + * Winprop matching hack fix (?) + +2007-11-09 18:03 UTC Tuomo Valkonen + * Lua-posix dir. checking support fixes. + +2007-11-09 17:50 UTC Tuomo Valkonen + * Improvements to mod_query 'cd' and 'pwd' override hacks + 2007-11-09 14:47 UTC Tuomo Valkonen tagged ion-3rc-20071109 diff --git a/LICENSE b/LICENSE index 576a773..f8e3c54 100644 --- a/LICENSE +++ b/LICENSE @@ -1,75 +1,76 @@ Copyright (c) Tuomo Valkonen 1999-2007. -The code of this project is "essentially" licensed under the LGPL, version -2.1, unless otherwise indicated in components taken from elsewhere. It is -reproduced below. Additionally, the following terms apply to the use of -the name of the project, Ion(tm), names of particular "branches" such as -Ion3(tm), and other derived names, in relation to this software, including -derived works: +Unless otherwise indicated in components taken from elsewhere, this software +is licensed under the GNU Lesser General Public License, version 2.1 ("LGPL", +reproduced below), extended and modified with the following terms: If the name Ion(tm) or other names that can be associated with the Ion project are used to distribute this software, then: - A version that does not significantly differ from one of the - original author's versions must be provided by default. + copyright holder's releases, must be provided by default. - - When there are no further prominent notices of possible out-datedness, - and no prominent original author's version qualifiers present (resp. - only branch qualifier is present), then the version distributed online - may not significantly differ from the original author's latest stable - release (resp. latest release on the branch) within a reasonable delay - (normally 28 days). The holders of physical distribution media must - be provided ways to upgrade to the latest release within this delay. + - Versions not based on the copyright holder's latest release (on + the corresponding "branch", such as Ion3(tm)), must within 28 days + of this release, be prominently marked as (potentially) obsolete + and unsupported. - Significantly altered versions may be provided only if the user explicitly requests for those modifications to be applied, and is prominently notified that the software is no longer considered - the standard version, and is not supported by the original author. + the standard version, and is not supported by the copyright holder. The version string displayed by the program must describe these modifications and the "support void" status. - Derived works that do not satisfy the above terms must be renamed so - that they can not be associated with the Ion project, their executables - must be given names that do not conflict with the original author's - version, and this author may not be referred to for support. + Versions for which the above conditions are not satisfied, must be + renamed so that they can not be associated with the Ion project, their + executables must be given names that do not conflict with the copyright + holder's version, and neither the copyright holder nor the Ion project + may be referred to for support. - Modules and other (standalone) extensions to Ion must also be named - so that they can not be confused to be supported by the original - author. If "Ion" occurs in the name, it must be in the form - "Foo for Ion" instead of "Ion Foo", etc. + In the text of sections 0-2, 4-12, and 14-16 of the LGPL, "this License" + is to be understood to refer to the LGPL extended with these terms and, + where applicable, possible similar terms related to the names of other + works forming a whole. Sections 3 and 13 of the LGPL are void. Where + contradictory, these additional terms are primary to the LGPL. - This name policy notice may not be altered, and must be included in - any altered versions and binary redistributions. It may only be - removed when using small portions of the code in unrelated projects. +End of terms. - The original author and the Ion project retain the same rights to - your modifications that it would have under the LGPL or GPL without - these or similar additional terms. - If you fail to follow these terms, you lose the rights granted to - you by the LGPL. +Explanations -Explanations: +Trademarks: With the terms above primarily appealing to copyright law, +should any of the indicated trademarks be found invalid, does not excuse +you from the conditions imposed by those terms. The use of these names +in contexts other than redistribution of this software and modifications, +is outside the scope of the terms above, and governed by applicable +trademark or other laws. + + With regard to modules and other extensions to Ion(tm), the permission + is hereby granted to use "Ion" as part of the name, provided that it + occurs in a form suggesting that the work is supported by neither the + copyright holder nor the Ion project: "Foo for Ion" instead of "Ion Foo", + etc. Significant change: Bug fixes are a priori insignificant as additions. Basic changes that are needed to install or run the software on a target platform are a priori insignificant. Additionally, basic configuration changes to better integrate the software with the target platform, without obstructing the standard behaviour, are a priori insignificant. -Everything else is significant. The author reserves the right to refine -the definition of significant changes on a per-case basis. Please consult -when in doubt. +Everything else is significant. The copyright holder reserves the right +to refine the definition of significant changes on a per-case basis. +Please consult when in doubt. Distributions: For example, suppose an aggregate distribution of software provides an `installpkg` command for installing packages. Then the action -`installpkg ion3` (resp. `installpkg ion`) should within a reasonable -delay install the latest release of Ion3 (resp. the latest stable release), -or prominently notify the user that the provided version is not or may not -be the latest. The action `installpkg ion-3ds-20070318` may at any date -install this particular mentioned release. Likewise, the action `installpkg ---support-void-featurex ion3` may apply additional patches to the latest -Ion3, within the further constraints set above. +`installpkg ion3` (resp. `installpkg ion`) should after 28 days provide the +latest release of Ion3 (resp. the latest stable release), or prominently +notify the user that the provided version is (likely to be) obsolete and +unsupported. Specific versions (including modified versions) may be provided +if the user explicitly requests for those, within the constraints set above. +The latest release being provided by default, or prominently appearing in +a listing, constitutes prominent marking of earlier releases as obsolete. The intent of these terms is to curb the power that "distributions", as the primary sources of software for many users, have in defining what diff --git a/README b/README index 226bbe4..2d066b5 100644 --- a/README +++ b/README @@ -114,9 +114,8 @@ The dock module was written by Tom Payne and Per Olofsson. `utils/ion-completefile/ion-completefile.c` is based on editline, (c) 1992 Simmule Turner and Rich Salz. See the file for details. -The code that `de/fontset.c` is based on was apparently originally -written by Tomohiro Kubota; see -. +The code that `de/fontset.c` is based on seems to have been originally +written by Tomohiro Kubota, but see the file for details. Various (minor) patches have been contributed by other individuals unlisted here. See the mailing list archives and the darcs source diff --git a/RELNOTES b/RELNOTES index 0d09d47..56e8c55 100644 --- a/RELNOTES +++ b/RELNOTES @@ -1,4 +1,12 @@ +ion-3rc-20071130 +---------------- + +This RC features various minor fixes, and some clarifications and +simplifications to the license, which people seem to have had trouble +understanding. + + ion-3rc-20071109 ---------------- diff --git a/de/fontset.c b/de/fontset.c index af164be..37946e0 100644 --- a/de/fontset.c +++ b/de/fontset.c @@ -3,10 +3,34 @@ * * This file contains routines to attempt to add fonts to a font pattern * so that XCreateFontSet will not fail because the given font(s) do not - * contain all the characters required by the locale. The original code - * was apparently written by Tomohiro Kubota; see + * contain all the characters required by the locale. + * + * The original code was apparently written by Tomohiro Kubota; see * . - * + * + * However, the code that this file is based on, was taken from: + * + * Screen.cc for Blackbox - an X11 Window manager + * Copyright (c) 2001 - 2002 Sean 'Shaleh' Perry + * Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. */ #include diff --git a/etc/lookcommon_clean.lua b/etc/lookcommon_clean.lua index 6ffb7b4..c2a8420 100644 --- a/etc/lookcommon_clean.lua +++ b/etc/lookcommon_clean.lua @@ -19,17 +19,17 @@ de.defstyle("frame-tiled", { spacing = 1, }) -de.defstyle("frame-tiled-alt", { - bar = "none", -}) +--de.defstyle("frame-tiled-alt", { +-- bar = "none", +--}) de.defstyle("frame-floating", { - bar = "shaped", + --bar = "shaped", padding_pixels = 0, }) de.defstyle("frame-transient", { - bar = "none", + --bar = "none", padding_pixels = 0, }) diff --git a/etc/lookcommon_emboss.lua b/etc/lookcommon_emboss.lua index b15de6a..f50935a 100644 --- a/etc/lookcommon_emboss.lua +++ b/etc/lookcommon_emboss.lua @@ -25,17 +25,17 @@ de.defstyle("frame-tiled", { padding_pixels = 1, }) -de.defstyle("frame-tiled-alt", { - bar = "none", -}) +--de.defstyle("frame-tiled-alt", { +-- bar = "none", +--}) de.defstyle("frame-floating", { - bar = "shaped", + --bar = "shaped", spacing = 0, }) de.defstyle("frame-transient", { - bar = "none", + --bar = "none", spacing = 0, }) diff --git a/exact-version b/exact-version index 7d9d056..69a0964 100644 --- a/exact-version +++ b/exact-version @@ -1,5 +1,5 @@ Context: -[TAG ion-3rc-20071109 -Tuomo Valkonen **20071109144719] +[TAG ion-3rc-20071130 +Tuomo Valkonen **20071130172504] diff --git a/ioncore/clientwin.c b/ioncore/clientwin.c index 01a15d3..7c3880e 100644 --- a/ioncore/clientwin.c +++ b/ioncore/clientwin.c @@ -448,7 +448,6 @@ WClientWin* ioncore_manage_clientwin(Window win, bool maprq) param.dockapp=FALSE; -again: /* Is the window already being managed? */ cwin=XWINDOW_REGION_OF_T(win, WClientWin); if(cwin!=NULL) @@ -459,70 +458,88 @@ again: */ xwindow_unmanaged_selectinput(win, StructureNotifyMask); + if(!XGetWindowAttributes(ioncore_g.dpy, win, &attr)){ + if(maprq) + warn(TR("Window %#x disappeared."), win); + goto fail2; + } /* Is it a dockapp? */ hints=XGetWMHints(ioncore_g.dpy, win); - - if(hints!=NULL && hints->flags&StateHint) - init_state=hints->initial_state; - if(!param.dockapp && init_state==WithdrawnState && - hints->flags&IconWindowHint && hints->icon_window!=None){ - /* The dockapp might be displaying its "main" window if no - * wm that understands dockapps has been managing it. - */ - if(!maprq) - XUnmapWindow(ioncore_g.dpy, win); - - xwindow_unmanaged_selectinput(win, 0); - - /* Copy WM_CLASS as _ION_DOCKAPP_HACK */ - { - char **p=NULL; - int n=0; - - p=xwindow_get_text_property(win, XA_WM_CLASS, &n); + if(hints!=NULL){ + if(hints->flags&StateHint) + init_state=hints->initial_state; + + if(!param.dockapp && init_state==WithdrawnState && + hints->flags&IconWindowHint && hints->icon_window!=None){ + Window icon_win=hints->icon_window; + XWindowAttributes icon_attr; - if(p!=NULL){ - xwindow_set_text_property(hints->icon_window, - ioncore_g.atom_dockapp_hack, - (const char **)p, n); - XFreeStringList(p); + if(!XGetWindowAttributes(ioncore_g.dpy, icon_win, &icon_attr)){ + if(maprq) + warn(TR("Window %#x disappeared."), win); + XFree((void*)hints); + goto fail2; + } + + if(!maprq){ + if(attr.map_state==IsViewable){ + /* The dockapp might be displaying its "main" window if no + * wm that understands dockapps has been managing it. + */ + XUnmapWindow(ioncore_g.dpy, win); + param.dockapp=TRUE; + }else{ + /* Main window is unmapped on initial scan, but icon window + * is mapped. Let's hope it's a dockapp left by e.g. us. + */ + if(icon_attr.map_state==IsViewable) + param.dockapp=TRUE; + } }else{ - const char *pdummy[2]={"unknowndockapp", "UnknownDockapp"}; - xwindow_set_text_property(hints->icon_window, - ioncore_g.atom_dockapp_hack, - pdummy, 2); + param.dockapp=TRUE; + } + + if(param.dockapp){ + char **p=NULL; + int n=0; + + xwindow_unmanaged_selectinput(win, 0); + xwindow_unmanaged_selectinput(icon_win, StructureNotifyMask); + + win=icon_win; + attr=icon_attr; + + /* Copy WM_CLASS as _ION_DOCKAPP_HACK */ + + p=xwindow_get_text_property(win, XA_WM_CLASS, &n); + + if(p!=NULL){ + xwindow_set_text_property(icon_win, ioncore_g.atom_dockapp_hack, + (const char **)p, n); + XFreeStringList(p); + }else{ + const char *pdummy[2]={"unknowndockapp", "UnknownDockapp"}; + xwindow_set_text_property(icon_win, ioncore_g.atom_dockapp_hack, + pdummy, 2); + } } } - /* It is a dockapp, do everything again from the beginning, now - * with the icon window. - */ - win=hints->icon_window; - param.dockapp=TRUE; - goto again; - } - - if(hints!=NULL) XFree((void*)hints); - - if(!XGetWindowAttributes(ioncore_g.dpy, win, &attr)){ - if(maprq) - warn(TR("Window %#x disappeared."), win); - goto fail2; } - attr.width=maxof(attr.width, 1); - attr.height=maxof(attr.height, 1); - /* Do we really want to manage it? */ if(!param.dockapp && (attr.override_redirect || (!maprq && attr.map_state!=IsViewable))){ goto fail2; } + attr.width=maxof(attr.width, 1); + attr.height=maxof(attr.height, 1); + /* Find root window */ FOR_ALL_ROOTWINS(rootwin){ if(WROOTWIN_ROOT(rootwin)==attr.root) diff --git a/ioncore/conf-bindings.c b/ioncore/conf-bindings.c index c449a87..d745a09 100644 --- a/ioncore/conf-bindings.c +++ b/ioncore/conf-bindings.c @@ -185,7 +185,7 @@ static bool do_action(WBindmap *bindmap, const char *str, binding.func=func; if(bindmap_remove_binding(bindmap, &binding)) return TRUE; - warn(TR("Unable to remove binding %s."), str); + /*warn(TR("Unable to remove binding %s."), str);*/ } return FALSE; diff --git a/ioncore/conf.c b/ioncore/conf.c index eb464cb..1656fc0 100644 --- a/ioncore/conf.c +++ b/ioncore/conf.c @@ -70,6 +70,7 @@ static ExtlFn get_layout_fn; * \var{kbresize_t_min} & (integer) See below. \\ * \var{kbresize_step} & (floating point) See below. \\ * \var{kbresize_maxacc} & (floating point) See below. \\ + * \var{edge_resistance} & (integer) Resize edge resistance in pixels. \\ * \var{framed_transients} & (boolean) Put transients in nested frames. \\ * \var{float_placement_method} & (string) How to place floating frames. * One of \codestr{udlr} (up-down, then left-right), diff --git a/ioncore/detach.c b/ioncore/detach.c index 2d24fee..21997ec 100644 --- a/ioncore/detach.c +++ b/ioncore/detach.c @@ -6,6 +6,8 @@ * See the included file LICENSE for details. */ +#include + #include #include #include @@ -115,9 +117,10 @@ static WRegion *check_mplex(WRegion *reg, WFrameMode *mode) *mode=FRAME_MODE_FLOATING; - if(OBJ_IS(mplex, WFrame) - && frame_mode((WFrame*)mplex)==FRAME_MODE_TRANSIENT){ - *mode=FRAME_MODE_TRANSIENT; + if(OBJ_IS(mplex, WFrame)){ + WFrameMode mode2=frame_mode((WFrame*)mplex); + if(framemode_unalt(mode2)==FRAME_MODE_TRANSIENT) + *mode=mode2; } return (WRegion*)mplex; diff --git a/ioncore/frame-draw.c b/ioncore/frame-draw.c index 0b3411a..925a858 100644 --- a/ioncore/frame-draw.c +++ b/ioncore/frame-draw.c @@ -214,7 +214,7 @@ void frame_clear_shape(WFrame *frame) #define CF_TAB_MAX_TEXT_X_OFF 10 -static void frame_shaped_recalc_bar_size(WFrame *frame) +static void frame_shaped_recalc_bar_size(WFrame *frame, bool complete) { int bar_w=0, textw=0, tmaxw=frame->tab_min_w, tmp=0; WLListIterTmp itmp; @@ -268,7 +268,7 @@ static void frame_shaped_recalc_bar_size(WFrame *frame) bar_w=frame->bar_max_width_q*REGION_GEOM(frame).w; } - if(frame->bar_w!=bar_w){ + if(complete || frame->bar_w!=bar_w){ frame->bar_w=bar_w; frame_set_shape(frame); } @@ -290,7 +290,7 @@ static int init_title(WFrame *frame, int i) } -void frame_recalc_bar(WFrame *frame) +void frame_recalc_bar(WFrame *frame, bool complete) { int textw, i; WLListIterTmp tmp; @@ -301,7 +301,7 @@ void frame_recalc_bar(WFrame *frame) return; if(frame->barmode==FRAME_BAR_SHAPED) - frame_shaped_recalc_bar_size(frame); + frame_shaped_recalc_bar_size(frame, complete); i=0; @@ -371,19 +371,21 @@ void frame_draw(const WFrame *frame, bool complete) void frame_brushes_updated(WFrame *frame) { - WFrameBarMode barmode=FRAME_BAR_INSIDE; + WFrameBarMode barmode; ExtlTab tab; char *s; if(frame->brush==NULL) return; - if(frame->mode==FRAME_MODE_FLOATING) + if(frame->mode==FRAME_MODE_FLOATING){ barmode=FRAME_BAR_SHAPED; - else if(frame->mode==FRAME_MODE_TRANSIENT) - barmode=FRAME_BAR_NONE; - else if(frame->mode==FRAME_MODE_TILED_ALT) + }else if(frame->mode==FRAME_MODE_TILED || frame->mode==FRAME_MODE_UNKNOWN || + frame->mode==FRAME_MODE_TRANSIENT_ALT){ + barmode=FRAME_BAR_INSIDE; + }else{ barmode=FRAME_BAR_NONE; + } if(grbrush_get_extra(frame->brush, "bar", 's', &s)){ if(strcmp(s, "inside")==0) @@ -445,16 +447,20 @@ void frame_updategr(WFrame *frame) region_updategr_default((WRegion*)frame); mplex_fit_managed(&frame->mplex); - frame_recalc_bar(frame); + frame_recalc_bar(frame, TRUE); frame_set_background(frame, TRUE); } -StringIntMap frame_tab_styles[]={ +static StringIntMap frame_tab_styles[]={ + {"tab-frame-unknown", FRAME_MODE_UNKNOWN}, + {"tab-frame-unknown-alt", FRAME_MODE_UNKNOWN_ALT}, {"tab-frame-tiled", FRAME_MODE_TILED}, {"tab-frame-tiled-alt", FRAME_MODE_TILED_ALT}, {"tab-frame-floating", FRAME_MODE_FLOATING}, + {"tab-frame-floating-alt", FRAME_MODE_FLOATING_ALT}, {"tab-frame-transient", FRAME_MODE_TRANSIENT}, + {"tab-frame-transient-alt", FRAME_MODE_TRANSIENT_ALT}, END_STRINGINTMAP }; diff --git a/ioncore/frame-draw.h b/ioncore/frame-draw.h index e286bc3..5654389 100644 --- a/ioncore/frame-draw.h +++ b/ioncore/frame-draw.h @@ -14,7 +14,7 @@ extern void frame_draw(const WFrame *frame, bool complete); extern void frame_draw_bar(const WFrame *frame, bool complete); -extern void frame_recalc_bar(WFrame *frame); +extern void frame_recalc_bar(WFrame *frame, bool complete); extern void frame_bar_geom(const WFrame *frame, WRectangle *geom); extern void frame_border_geom(const WFrame *frame, WRectangle *geom); extern void frame_border_inner_geom(const WFrame *frame, WRectangle *geom); diff --git a/ioncore/frame.c b/ioncore/frame.c index 6937b3d..f85a296 100644 --- a/ioncore/frame.c +++ b/ioncore/frame.c @@ -50,11 +50,32 @@ static void frame_add_mode_bindmaps(WFrame *frame); WHook *frame_managed_changed_hook=NULL; -#define IS_FLOATING_MODE(FRAME) \ - ((FRAME)->mode==FRAME_MODE_FLOATING || (FRAME)->mode==FRAME_MODE_TRANSIENT) -#define FORWARD_CWIN_RQGEOM(FRAME) IS_FLOATING_MODE(FRAME) -#define USE_MINMAX(FRAME) IS_FLOATING_MODE(FRAME) -#define DEST_EMPTY(FRAME) IS_FLOATING_MODE(FRAME) +#define FORWARD_CWIN_RQGEOM(FRAME) framemode_is_floating(frame_mode(FRAME)) +#define USE_MINMAX(FRAME) framemode_is_floating(frame_mode(FRAME)) +#define DEST_EMPTY(FRAME) framemode_is_floating(frame_mode(FRAME)) + + +WFrameMode framemode_unalt(WFrameMode mode) +{ + if(mode==FRAME_MODE_UNKNOWN_ALT) + return FRAME_MODE_UNKNOWN; + else if(mode==FRAME_MODE_TILED_ALT) + return FRAME_MODE_TILED; + else if(mode==FRAME_MODE_FLOATING_ALT) + return FRAME_MODE_FLOATING; + else if(mode==FRAME_MODE_TRANSIENT_ALT) + return FRAME_MODE_TRANSIENT; + else + return mode; +} + + +static WFrameMode framemode_is_floating(WFrameMode mode) +{ + WFrameMode modea=framemode_unalt(mode); + + return (modea==FRAME_MODE_FLOATING || modea==FRAME_MODE_TRANSIENT); +} /*{{{ Destroy/create frame */ @@ -130,13 +151,13 @@ void frame_deinit(WFrame *frame) static void frame_add_mode_bindmaps(WFrame *frame) { - WFrameMode mode=frame->mode; + WFrameMode modea=framemode_unalt(frame->mode); - if(mode==FRAME_MODE_FLOATING){ + if(modea==FRAME_MODE_FLOATING){ region_add_bindmap((WRegion*)frame, ioncore_mplex_toplevel_bindmap); region_add_bindmap((WRegion*)frame, ioncore_frame_toplevel_bindmap); region_add_bindmap((WRegion*)frame, ioncore_frame_floating_bindmap); - }else if(mode==FRAME_MODE_TRANSIENT){ + }else if(modea==FRAME_MODE_TRANSIENT){ region_add_bindmap((WRegion*)frame, ioncore_frame_transient_bindmap); region_add_bindmap((WRegion*)frame, ioncore_frame_floating_bindmap); }else{ @@ -170,7 +191,7 @@ void frame_set_mode(WFrame *frame, WFrameMode mode) frame_initialise_gr(frame); mplex_fit_managed(&frame->mplex); - frame_recalc_bar(frame); + frame_recalc_bar(frame, TRUE); frame_set_background(frame, TRUE); } @@ -181,12 +202,15 @@ WFrameMode frame_mode(WFrame *frame) } -StringIntMap frame_modes[]={ +static StringIntMap frame_modes[]={ {"unknown", FRAME_MODE_UNKNOWN}, + {"unknown-alt", FRAME_MODE_UNKNOWN_ALT}, {"tiled", FRAME_MODE_TILED}, {"tiled-alt", FRAME_MODE_TILED_ALT}, {"floating", FRAME_MODE_FLOATING}, + {"floating-alt", FRAME_MODE_FLOATING_ALT}, {"transient", FRAME_MODE_TRANSIENT}, + {"transient-alt", FRAME_MODE_TRANSIENT_ALT}, END_STRINGINTMAP }; @@ -203,7 +227,9 @@ const char *frame_mode_extl(WFrame *frame) /*EXTL_DOC - * Set frame mode. + * Set frame mode (one of + * \codestr{unknown}, \codestr{tiled}, \codestr{floating}, \codestr{transient}, + * or any of these suffixed with \codestr{-alt}). */ EXTL_EXPORT_AS(WFrame, set_mode) bool frame_set_mode_extl(WFrame *frame, const char *modestr) @@ -386,7 +412,7 @@ static bool frame_initialise_titles(WFrame *frame) } } - frame_recalc_bar(frame); + frame_recalc_bar(frame, FALSE); return TRUE; } @@ -453,36 +479,36 @@ void frame_size_hints(WFrame *frame, WSizeHints *hints_ret) woff=maxof(REGION_GEOM(frame).w-subgeom.w, 0); hoff=maxof(REGION_GEOM(frame).h-subgeom.h, 0); - if(FRAME_CURRENT(frame)!=NULL){ + if(FRAME_CURRENT(frame)!=NULL) region_size_hints(FRAME_CURRENT(frame), hints_ret); - if(!USE_MINMAX(frame)){ - hints_ret->max_set=0; - hints_ret->min_set=0; - /*hints_ret->base_set=0;*/ - hints_ret->aspect_set=0; - hints_ret->no_constrain=FALSE; - /*hints_ret->no_constrain=TRUE;*/ - } - }else{ + else sizehints_clear(hints_ret); - } FRAME_MX_FOR_ALL(sub, frame, tmp){ sizehints_adjust_for(hints_ret, sub); } - if(!hints_ret->base_set){ - hints_ret->base_width=0; - hints_ret->base_height=0; - hints_ret->base_set=TRUE; + if(!USE_MINMAX(frame)){ + hints_ret->max_set=0; + hints_ret->min_set=0; + /*hints_ret->base_set=0;*/ + hints_ret->aspect_set=0; + hints_ret->no_constrain=FALSE; + /*hints_ret->no_constrain=TRUE;*/ } - + if(!hints_ret->min_set){ hints_ret->min_width=0; hints_ret->min_height=0; hints_ret->min_set=TRUE; } + if(!hints_ret->base_set){ + hints_ret->base_width=0; + hints_ret->base_height=0; + hints_ret->base_set=TRUE; + } + hints_ret->base_width+=woff; hints_ret->base_height+=hoff; hints_ret->max_width+=woff; @@ -868,7 +894,7 @@ void frame_managed_notify(WFrame *frame, WRegion *sub, WRegionNotify how) how==ioncore_g.notifies.tag){ frame_update_attrs(frame); - frame_recalc_bar(frame); + frame_recalc_bar(frame, FALSE); frame_draw_bar(frame, FALSE); } } @@ -880,7 +906,7 @@ static void frame_size_changed_default(WFrame *frame, int bar_w=frame->bar_w; if(wchg) - frame_recalc_bar(frame); + frame_recalc_bar(frame, TRUE); if(frame->barmode==FRAME_BAR_SHAPED && ((!wchg && hchg) || (wchg && bar_w==frame->bar_w))){ @@ -953,7 +979,7 @@ WPHolder *frame_prepare_manage_transient(WFrame *frame, /* Transient manager searches should not cross tiled frames * unless explicitly floated. */ - if(IS_FLOATING_MODE(frame) || + if(framemode_is_floating(frame_mode(frame)) || extl_table_is_bool_set(transient->proptab, "float")){ return region_prepare_manage_transient_default((WRegion*)frame, transient, diff --git a/ioncore/frame.h b/ioncore/frame.h index c8827a5..44cc7bf 100644 --- a/ioncore/frame.h +++ b/ioncore/frame.h @@ -39,7 +39,10 @@ typedef enum{ FRAME_MODE_TILED, FRAME_MODE_TILED_ALT, FRAME_MODE_FLOATING, - FRAME_MODE_TRANSIENT + FRAME_MODE_TRANSIENT, + FRAME_MODE_UNKNOWN_ALT, + FRAME_MODE_FLOATING_ALT, + FRAME_MODE_TRANSIENT_ALT } WFrameMode; typedef enum{ @@ -132,4 +135,6 @@ extern void frame_do_load(WFrame *frame, ExtlTab tab); extern WHook *frame_managed_changed_hook; +extern WFrameMode framemode_unalt(WFrameMode mode); + #endif /* ION_IONCORE_FRAME_H */ diff --git a/ioncore/group-cw.c b/ioncore/group-cw.c index 5a2a32d..6bb9c2f 100644 --- a/ioncore/group-cw.c +++ b/ioncore/group-cw.c @@ -163,7 +163,8 @@ void groupcw_toggle_transients_pos(WGroupCW *cwg) if(st->reg!=NULL){ WFitParams fp; - + + fp.mode=0; fp.g=REGION_GEOM(cwg); sizepolicy(&st->szplcy, st->reg, NULL, diff --git a/ioncore/group.c b/ioncore/group.c index e39b202..5cff1d0 100644 --- a/ioncore/group.c +++ b/ioncore/group.c @@ -531,8 +531,7 @@ WStacking *group_do_add_managed_default(WGroup *ws, WRegion *reg, int level, frame=OBJ_CAST(reg, WFrame); if(frame!=NULL){ - WFrameMode m=frame_mode(frame); - if(m==FRAME_MODE_TILED || m==FRAME_MODE_TILED_ALT) + if(framemode_unalt(frame_mode(frame))==FRAME_MODE_TILED) frame_set_mode(frame, FRAME_MODE_FLOATING); } @@ -662,8 +661,10 @@ bool group_do_attach_final(WGroup *ws, region_set_focus(st->reg); else ws->current_managed=st; + }else if(region_is_fully_mapped(reg)){ + region_pointer_focus_hack(reg); } - + return TRUE; } @@ -897,6 +898,8 @@ void group_manage_stdisp(WGroup *ws, WRegion *stdisp, stdisp->flags|=REGION_SKIP_FOCUS; fp.g=REGION_GEOM(ws); + fp.mode=0; + sizepolicy(&ws->managed_stdisp->szplcy, stdisp, NULL, 0, &fp); region_fitrep(stdisp, NULL, &fp); @@ -935,6 +938,7 @@ void group_managed_rqgeom(WGroup *ws, WRegion *reg, fp.mode=REGION_FIT_EXACT; }else{ fp.g=REGION_GEOM(ws); + fp.mode=0; sizepolicy(&st->szplcy, reg, &rq->geom, rq->flags, &fp); } diff --git a/ioncore/ioncore.c b/ioncore/ioncore.c index 9f9bcfc..e66f5cd 100644 --- a/ioncore/ioncore.c +++ b/ioncore/ioncore.c @@ -76,11 +76,11 @@ static const char ioncore_copy[]= "Ion " ION_VERSION ", copyright (c) Tuomo Valkonen 1999-2007."; static const char ioncore_license[]=DUMMY_TR( - "This software is essentially licensed under the GNU Lesser General\n" - "Public License (LGPL), version 2.1, unless otherwise indicated in\n" - "components taken from elsewhere. Additional terms apply to the use\n" - "of the name of the project, Ion(tm). For details, see the file\n" - "LICENSE that you should have received with this software.\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" diff --git a/ioncore/ioncore_wd.lua b/ioncore/ioncore_wd.lua index cdb7a36..d69a9eb 100644 --- a/ioncore/ioncore_wd.lua +++ b/ioncore/ioncore_wd.lua @@ -26,13 +26,12 @@ local function checkdir(d) if not d2 then return nil, err else - print('follow') return checkdir(d2) end elseif t=="directory" then return true else - return TR("Not a directory.") + return nil, TR("Not a directory.") end end end @@ -51,7 +50,7 @@ end --DOC -- Change default working directory for new programs started in \var{reg}. function ioncore.chdir_for(reg, dir) - assert(type(dir)=="string") + assert(dir==nil or type(dir)=="string") if dir=="" or dir==nil then dirs[reg]=nil return true @@ -87,6 +86,7 @@ end local function lookup_runinxterm_warn(prog, title, wait) local rx=lookup_script_warn("ion-runinxterm") if rx then + rx="exec "..rx if wait then rx=rx.." -w" end @@ -147,7 +147,10 @@ end local function save_config() local t={} for r, d in pairs(dirs) do - t[r:name()]=d + local nm=obj_exists(r) and r:name() + if nm then + t[nm]=d + end end ioncore.write_savefile(savefile, t) end diff --git a/ioncore/ioncore_winprops.lua b/ioncore/ioncore_winprops.lua index 6a6ca51..cae9c63 100644 --- a/ioncore/ioncore_winprops.lua +++ b/ioncore/ioncore_winprops.lua @@ -92,8 +92,8 @@ function ioncore.match_winprop_dflt(prop, cwin, id) if p==nil then return true else - return (p==(i and true)) - -- hack for nil + return (p==(i and true or false)) + -- hack for nil i end end diff --git a/ioncore/kbresize.c b/ioncore/kbresize.c index f91821c..636ac1d 100644 --- a/ioncore/kbresize.c +++ b/ioncore/kbresize.c @@ -33,6 +33,8 @@ static int last_accel_mode=0; static double accel=1, accelinc=30, accelmax=100*100; static long actmax=200, uptmin=50; static int resize_delay=CF_RESIZE_DELAY; +/* Here to not have to write other set callback for resize code... */ +int ioncore_edge_resistance=CF_EDGE_RESISTANCE; static void accel_reset() @@ -46,7 +48,7 @@ static void accel_reset() void ioncore_set_moveres_accel(ExtlTab tab) { - int t_max, t_min, rd; + int t_max, t_min, rd, er; double step, maxacc; if(extl_table_gets_i(tab, "kbresize_t_max", &t_max)) @@ -59,6 +61,8 @@ void ioncore_set_moveres_accel(ExtlTab tab) accelmax=(maxacc>0 ? maxacc*maxacc : 1); if(extl_table_gets_i(tab, "kbresize_delay", &rd)) resize_delay=maxof(0, rd); + if(extl_table_gets_i(tab, "edge_resistance", &er)) + ioncore_edge_resistance=maxof(0, er); } @@ -69,6 +73,7 @@ void ioncore_get_moveres_accel(ExtlTab tab) extl_table_sets_d(tab, "kbresize_step", accelinc); extl_table_sets_d(tab, "kbresize_maxacc", accelmax); extl_table_sets_d(tab, "kbresize_delay", resize_delay); + extl_table_sets_i(tab, "edge_resistance", ioncore_edge_resistance); } diff --git a/ioncore/mplex.c b/ioncore/mplex.c index da1bd49..239d46f 100644 --- a/ioncore/mplex.c +++ b/ioncore/mplex.c @@ -492,9 +492,10 @@ static void mplex_managed_rqgeom(WMPlex *mplex, WRegion *sub, node=mplex_find_stacking(mplex, sub); assert(node!=NULL); - + + fp.mode=0; mplex_managed_geom(mplex, &fp.g); - + sizepolicy(&node->szplcy, sub, &rq->geom, rq->flags, &fp); if(geomret!=NULL) @@ -1297,6 +1298,7 @@ bool mplex_do_attach_final(WMPlex *mplex, WRegion *reg, WMPlexPHolder *ph) if(!(param->flags&MPLEX_ATTACH_WHATEVER)){ WFitParams fp; + fp.mode=0; mplex_managed_geom(mplex, &(fp.g)); sizepolicy(&node->szplcy, reg, @@ -1323,7 +1325,11 @@ bool mplex_do_attach_final(WMPlex *mplex, WRegion *reg, WMPlexPHolder *ph) * client windows still..) */ mplex_refocus(mplex, NULL, FALSE); + }else if(!hidden){ + region_pointer_focus_hack(reg); } + }else if(!hidden){ + region_pointer_focus_hack(reg); } if(lnode!=NULL) diff --git a/ioncore/pointer.c b/ioncore/pointer.c index 63a408e..4d5e26e 100644 --- a/ioncore/pointer.c +++ b/ioncore/pointer.c @@ -233,17 +233,6 @@ bool ioncore_do_handle_buttonpress(XButtonEvent *ev) if(reg==NULL) return FALSE; - if(ev->subwindow!=None){ - XButtonEvent ev2=*ev; - ev2.window=ev->subwindow; - if(XTranslateCoordinates(ioncore_g.dpy, ev->window, ev2.window, - ev->x, ev->y, &(ev2.x), &(ev2.y), - &(ev2.subwindow))){ - if(ioncore_do_handle_buttonpress(&ev2)) - return TRUE; - } - } - dblclick=(p_clickcnt==1 && time_in_threshold(ev->time) && p_button==button && p_state==state && reg==p_reg); diff --git a/ioncore/resize.c b/ioncore/resize.c index 22950ee..1592f00 100644 --- a/ioncore/resize.c +++ b/ioncore/resize.c @@ -30,6 +30,9 @@ #define XOR_RESIZE (!ioncore_g.opaque_resize) +extern int ioncore_edge_resistance; + + /*{{{ Size/position display and rubberband */ @@ -139,14 +142,14 @@ static void moveres_draw_infowin(WMoveresMode *mode) w=mode->geom.w; h=mode->geom.h; - if((mode->hints.inc_set) && - (mode->hints.width_inc>1 || mode->hints.height_inc>1)){ - if(mode->hints.base_set){ - w-=mode->hints.base_width; - h-=mode->hints.base_height; - } - w/=mode->hints.width_inc; - h/=mode->hints.height_inc; + if(mode->hints.base_set){ + w=maxof(0, w-mode->hints.base_width); + h=maxof(0, h-mode->hints.base_height); + } + + if(mode->hints.inc_set){ + w/=maxof(1, mode->hints.width_inc); + h/=maxof(1, mode->hints.height_inc); } snprintf(buf, INFOWIN_BUFFER_LEN, "%dx%d", w, h); @@ -249,10 +252,9 @@ static bool moveresmode_init(WMoveresMode *mode, WRegion *reg, if(mgr==(WRegion*)parent){ mode->snapgeom.x=0; mode->snapgeom.y=0; - mode->snap_enabled=FALSE; - }else if(REGION_PARENT(mgr)==parent){ - mode->snap_enabled=TRUE; + /*mode->snap_enabled=FALSE;*/ } + mode->snap_enabled=TRUE; } if(!mode->hints.min_set || mode->hints.min_width<1) @@ -341,12 +343,19 @@ static void moveresmode_do_newgeom(WMoveresMode *mode, WRQGeomParams *rq) } +static int clamp_up(int t, int low, int high) +{ + return (t < high && t > low ? high : t); +} + + static void moveresmode_delta(WMoveresMode *mode, int dx1, int dx2, int dy1, int dy2, WRectangle *rret) { int realdx1, realdx2, realdy1, realdy2; WRQGeomParams rq=RQGEOMPARAMS_INIT; + int er=ioncore_edge_resistance; int w=0, h=0; realdx1=(mode->dx1+=dx1); @@ -358,7 +367,6 @@ static void moveresmode_delta(WMoveresMode *mode, /* snap */ if(mode->snap_enabled){ WRectangle *sg=&mode->snapgeom; - int er=CF_EDGE_RESISTANCE; if(mode->dx1!=0 && rq.geom.x+mode->dx1x && rq.geom.x+mode->dx1>sg->x-er) realdx1=sg->x-rq.geom.x; @@ -370,14 +378,15 @@ static void moveresmode_delta(WMoveresMode *mode, realdy2=sg->y+sg->h-rq.geom.y-rq.geom.h; } - w=mode->origgeom.w-realdx1+realdx2; - h=mode->origgeom.h-realdy1+realdy2; - - if(w<=0) - w=mode->hints.min_width; - if(h<=0) - h=mode->hints.min_height; + w=maxof(1, mode->origgeom.w-realdx1+realdx2); + h=maxof(1, mode->origgeom.h-realdy1+realdy2); + + if(mode->snap_enabled && mode->hints.base_set){ + w=clamp_up(w, mode->hints.base_width-er, mode->hints.base_width); + h=clamp_up(h, mode->hints.base_height-er, mode->hints.base_height); + } + /* Correct size */ sizehints_correct(&mode->hints, &w, &h, TRUE, TRUE); /* Do not modify coordinates and sizes that were not requested to be diff --git a/mod_query/mod_query_chdir.lua b/mod_query/mod_query_chdir.lua index dcf4d2a..083cf50 100644 --- a/mod_query/mod_query_chdir.lua +++ b/mod_query/mod_query_chdir.lua @@ -6,17 +6,49 @@ -- See the included file LICENSE for details. -- +local function simplify_path(path) + local npath=string.gsub(path, "([^/]+)/+%.%./+", "") + if npath~=path then + return simplify_path(npath) + else + return string.gsub(string.gsub(path, "([^/]+)/+%.%.$", ""), "/+", "/") + end +end + +local function relative_path(path) + return not string.find(path, "^/") +end + +local function empty_path(path) + return (not path or path=="") +end + local function ws_chdir(mplex, params) + local nwd=params[1] + ws=assert(ioncore.find_manager(mplex, "WGroupWS")) - local ok, err=ioncore.chdir_for(ws, params[1] or "") + + if not empty_path(nwd) and relative_path(nwd) then + local owd=ioncore.get_dir_for(ws) + if empty_path(owd) then + owd=os.getenv("PWD") + end + if owd then + nwd=owd.."/"..nwd + end + end + local ok, err=ioncore.chdir_for(ws, nwd and simplify_path(nwd)) if not ok then mod_query.warn(mplex, err) end end local function ws_showdir(mplex, params) - local dir=assert(ioncore.get_dir_for(mplex) or os.getenv("PWD")) - mod_query.message(mplex, dir) + local dir=ioncore.get_dir_for(mplex) + if empty_path(dir) then + dir=os.getenv("PWD") + end + mod_query.message(mplex, dir or "(?)") end mod_query.defcmd("cd", ws_chdir) diff --git a/mod_tiling/tiling.c b/mod_tiling/tiling.c index e933dc7..b9d454c 100644 --- a/mod_tiling/tiling.c +++ b/mod_tiling/tiling.c @@ -478,8 +478,7 @@ bool tiling_managed_add_default(WTiling *ws, WRegion *reg) frame=OBJ_CAST(reg, WFrame); if(frame!=NULL){ - WFrameMode mode=frame_mode(frame); - if(mode!=FRAME_MODE_TILED && mode!=FRAME_MODE_TILED_ALT) + if(framemode_unalt(frame_mode(frame))==FRAME_MODE_TILED) frame_set_mode(frame, FRAME_MODE_TILED); } diff --git a/utils/ion-completeman.in b/utils/ion-completeman.in index 969839b..cfcaade 100644 --- a/utils/ion-completeman.in +++ b/utils/ion-completeman.in @@ -113,9 +113,7 @@ case "$action" in complete) if test "x$usercache" != x -a -f "$usercache"; then cachefile="$usercache" - fi - - if test -f "$syscache"; then + elif test -f "$syscache"; then cachefile="$syscache" fi diff --git a/version.h b/version.h index 17f05f8..9c3629b 100644 --- a/version.h +++ b/version.h @@ -1,2 +1,2 @@ -#define ION_VERSION "3rc-20071109" +#define ION_VERSION "3rc-20071130" #define ION_API_VERSION "3" -- 2.39.2