Remove iconify/deiconify zoom animation option

It's too fast to see.
This commit is contained in:
Mike Small 2021-01-31 23:41:29 -05:00
parent 21dcde5dd6
commit 63be49b23c
13 changed files with 695 additions and 805 deletions

View File

@ -1,8 +1,21 @@
2021-01-31 Mike Small <smallm@sdf.org> 2021-01-31 Mike Small <smallm@sdf.org>
* src/screen.h (struct ScreenInfo): Remove NoGrabServer member * src/util.h: Remove zoom option
* src/gram.y: Remove ICON_REGION * src/screen.h (struct ScreenInfo): Remove DoZoom, ZoomCount
* src/menus.cc (DeIconify,Iconify): Remove zoom effect
* src/events.c (HandleMapRequest): Remove zoom option
* src/util.c: Remove zoom effect function
* src/twm.c (InitVariables): Remove zoom option
* src/screen.h (struct ScreenInfo): Remove NoGrabServer member
(struct ScreenInfo): Remove zoom option
* src/gram.y: Remove ICON_REGION, zoom option
* src/menus.cc (ExecuteFunction): Remove nograbserver option * src/menus.cc (ExecuteFunction): Remove nograbserver option
@ -12,9 +25,9 @@
* src/deftwmrc.c: ditto * src/deftwmrc.c: ditto
* src/parse.c: ditto and remove IconRegion option. * src/parse.c: ditto and remove IconRegion, Zoom options.
* man/twmruined.man: Remove nograbserver and IconRegion settings. * man/twmruined.man: Remove nograbserver, zoom and IconRegion settings.
Describe simplified icon placement. Describe simplified icon placement.
* src/util.h: move CreateMenuIcon prototype here * src/util.h: move CreateMenuIcon prototype here

3
README
View File

@ -5,7 +5,8 @@ Features removed...
1. iconmgr feature and icon region (icons always land on the right edge). 1. iconmgr feature and icon region (icons always land on the right edge).
2. these configuration options: UsePPosition, SqueezeTitle, RandomPlacement, 2. these configuration options: UsePPosition, SqueezeTitle, RandomPlacement,
opaquemove, window highlight, DontIconifyByUnmapping, IconifyByUnmapping, opaquemove, window highlight, DontIconifyByUnmapping, IconifyByUnmapping,
TitlePadding, title button indent, NoGrabServer (never grab), IconRegion. TitlePadding, title button indent, NoGrabServer (never grab), IconRegion,
Zoom.
Changes ... Changes ...

View File

@ -584,11 +584,6 @@ user's typical screen. Setting this variable to 1 often gives nice results
if adjacent colors in the default colormap are distinct. By default, if adjacent colors in the default colormap are distinct. By default,
\fItwmruined\fP will attempt to cause temporary lines to appear at the opposite \fItwmruined\fP will attempt to cause temporary lines to appear at the opposite
end of the colormap from the graphics. end of the colormap from the graphics.
.IP "\fBZoom\fP [ \fIcount\fP ]" 8
This variable indicates that outlines suggesting movement of a window
to and from its iconified state should be displayed whenever a window is
iconified or deiconified. The optional \fIcount\fP argument specifies the
number of outlines to be drawn. The default count is 8.
.PP .PP
The following variables must be set after the fonts have been The following variables must be set after the fonts have been
assigned, so it is usually best to put them at the end of the variables assigned, so it is usually best to put them at the end of the variables

View File

@ -1242,7 +1242,6 @@ void
HandleMapRequest(void) HandleMapRequest(void)
{ {
XPointer context_data; XPointer context_data;
int zoom_save;
Event.xany.window = Event.xmaprequest.window; Event.xany.window = Event.xmaprequest.window;
if (XFindContext(dpy, Event.xany.window, TwmContext, &context_data) == 0) if (XFindContext(dpy, Event.xany.window, TwmContext, &context_data) == 0)
@ -1284,10 +1283,7 @@ HandleMapRequest(void)
break; break;
case IconicState: case IconicState:
zoom_save = Scr->DoZoom;
Scr->DoZoom = FALSE;
Iconify(Tmp_win, 0, 0); Iconify(Tmp_win, 0, 0);
Scr->DoZoom = zoom_save;
break; break;
} }
} }

1182
src/gram.c

File diff suppressed because it is too large Load Diff

View File

@ -64,45 +64,44 @@ extern int yydebug;
MONOCHROME = 274, MONOCHROME = 274,
FUNCTION = 275, FUNCTION = 275,
WINDOW_FUNCTION = 276, WINDOW_FUNCTION = 276,
ZOOM = 277, MAKE_TITLE = 277,
MAKE_TITLE = 278, GRAYSCALE = 278,
GRAYSCALE = 279, NO_TITLE = 279,
NO_TITLE = 280, AUTO_RAISE = 280,
AUTO_RAISE = 281, META = 281,
META = 283, SHIFT = 282,
SHIFT = 284, LOCK = 283,
LOCK = 285, CONTROL = 284,
CONTROL = 286, WINDOW = 285,
WINDOW = 287, TITLE = 286,
TITLE = 288, ICON = 287,
ICON = 289, ROOT = 288,
ROOT = 290, FRAME = 289,
FRAME = 291, COLON = 290,
COLON = 292, EQUALS = 291,
EQUALS = 293, START_ICONIFIED = 292,
START_ICONIFIED = 294, MOVE = 293,
MOVE = 295, RESIZE = 294,
RESIZE = 296, WAIT = 295,
WAIT = 297, SELECT = 296,
SELECT = 298, KILL = 297,
KILL = 299, LEFT_TITLEBUTTON = 298,
LEFT_TITLEBUTTON = 300, RIGHT_TITLEBUTTON = 299,
RIGHT_TITLEBUTTON = 301, NUMBER = 300,
NUMBER = 302, KEYWORD = 301,
KEYWORD = 303, NKEYWORD = 302,
NKEYWORD = 304, CKEYWORD = 303,
CKEYWORD = 305, CLKEYWORD = 304,
CLKEYWORD = 306, FKEYWORD = 305,
FKEYWORD = 307, FSKEYWORD = 306,
FSKEYWORD = 308, SKEYWORD = 307,
SKEYWORD = 309, DKEYWORD = 308,
DKEYWORD = 310, JKEYWORD = 309,
JKEYWORD = 311, WINDOW_RING = 310,
WINDOW_RING = 312, WARP_CURSOR = 311,
WARP_CURSOR = 313, ERRORTOKEN = 312,
ERRORTOKEN = 314, NO_STACKMODE = 313,
NO_STACKMODE = 315, STRING = 314
STRING = 316
}; };
#endif #endif
/* Tokens. */ /* Tokens. */
@ -125,45 +124,44 @@ extern int yydebug;
#define MONOCHROME 274 #define MONOCHROME 274
#define FUNCTION 275 #define FUNCTION 275
#define WINDOW_FUNCTION 276 #define WINDOW_FUNCTION 276
#define ZOOM 277 #define MAKE_TITLE 277
#define MAKE_TITLE 278 #define GRAYSCALE 278
#define GRAYSCALE 279 #define NO_TITLE 279
#define NO_TITLE 280 #define AUTO_RAISE 280
#define AUTO_RAISE 281 #define META 281
#define META 283 #define SHIFT 282
#define SHIFT 284 #define LOCK 283
#define LOCK 285 #define CONTROL 284
#define CONTROL 286 #define WINDOW 285
#define WINDOW 287 #define TITLE 286
#define TITLE 288 #define ICON 287
#define ICON 289 #define ROOT 288
#define ROOT 290 #define FRAME 289
#define FRAME 291 #define COLON 290
#define COLON 292 #define EQUALS 291
#define EQUALS 293 #define START_ICONIFIED 292
#define START_ICONIFIED 294 #define MOVE 293
#define MOVE 295 #define RESIZE 294
#define RESIZE 296 #define WAIT 295
#define WAIT 297 #define SELECT 296
#define SELECT 298 #define KILL 297
#define KILL 299 #define LEFT_TITLEBUTTON 298
#define LEFT_TITLEBUTTON 300 #define RIGHT_TITLEBUTTON 299
#define RIGHT_TITLEBUTTON 301 #define NUMBER 300
#define NUMBER 302 #define KEYWORD 301
#define KEYWORD 303 #define NKEYWORD 302
#define NKEYWORD 304 #define CKEYWORD 303
#define CKEYWORD 305 #define CLKEYWORD 304
#define CLKEYWORD 306 #define FKEYWORD 305
#define FKEYWORD 307 #define FSKEYWORD 306
#define FSKEYWORD 308 #define SKEYWORD 307
#define SKEYWORD 309 #define DKEYWORD 308
#define DKEYWORD 310 #define JKEYWORD 309
#define JKEYWORD 311 #define WINDOW_RING 310
#define WINDOW_RING 312 #define WARP_CURSOR 311
#define WARP_CURSOR 313 #define ERRORTOKEN 312
#define ERRORTOKEN 314 #define NO_STACKMODE 313
#define NO_STACKMODE 315 #define STRING 314
#define STRING 316
/* Value type. */ /* Value type. */
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
@ -175,7 +173,7 @@ union YYSTYPE
int num; int num;
char *ptr; char *ptr;
#line 181 "gram.h" /* yacc.c:1909 */ #line 177 "gram.h" /* yacc.c:1909 */
}; };
typedef union YYSTYPE YYSTYPE; typedef union YYSTYPE YYSTYPE;

View File

@ -110,7 +110,7 @@ static void yyerror ( const char *s );
%token <num> LB RB LP RP MENUS MENU BUTTON DEFAULT_FUNCTION PLUS MINUS %token <num> LB RB LP RP MENUS MENU BUTTON DEFAULT_FUNCTION PLUS MINUS
%token <num> ALL OR CURSORS ICONS COLOR SAVECOLOR MONOCHROME FUNCTION %token <num> ALL OR CURSORS ICONS COLOR SAVECOLOR MONOCHROME FUNCTION
%token <num> WINDOW_FUNCTION ZOOM %token <num> WINDOW_FUNCTION
%token <num> MAKE_TITLE GRAYSCALE %token <num> MAKE_TITLE GRAYSCALE
%token <num> NO_TITLE AUTO_RAISE %token <num> NO_TITLE AUTO_RAISE
%token <num> META SHIFT LOCK CONTROL WINDOW TITLE ICON ROOT FRAME %token <num> META SHIFT LOCK CONTROL WINDOW TITLE ICON ROOT FRAME
@ -141,14 +141,6 @@ stmt : error
| noarg | noarg
| sarg | sarg
| narg | narg
| ZOOM number { if (Scr->FirstTime)
{
Scr->DoZoom = TRUE;
Scr->ZoomCount = $2;
}
}
| ZOOM { if (Scr->FirstTime)
Scr->DoZoom = TRUE; }
| CURSORS cursor_list {} | CURSORS cursor_list {}
| LEFT_TITLEBUTTON string EQUALS action { | LEFT_TITLEBUTTON string EQUALS action {
GotTitleButton ($2, $4, False); GotTitleButton ($2, $4, False);

View File

@ -2236,24 +2236,6 @@ DeIconify(TwmWindow *tmp_win)
{ {
TwmWindow *t; TwmWindow *t;
/* de-iconify the main window */
if (tmp_win->icon)
{
if (tmp_win->icon_on)
Zoom(tmp_win->icon_w, tmp_win->frame);
else if (tmp_win->group != (Window) 0)
{
for (t = Scr->TwmRoot.next; t != NULL; t = t->next)
{
if (tmp_win->group == t->w && t->icon_on)
{
Zoom(t->icon_w, tmp_win->frame);
break;
}
}
}
}
XMapWindow(dpy, tmp_win->w); XMapWindow(dpy, tmp_win->w);
tmp_win->mapped = TRUE; tmp_win->mapped = TRUE;
if (Scr->NoRaiseDeicon) if (Scr->NoRaiseDeicon)
@ -2274,30 +2256,25 @@ DeIconify(TwmWindow *tmp_win)
/* now de-iconify transients */ /* now de-iconify transients */
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) for (t = Scr->TwmRoot.next; t != NULL; t = t->next)
{
if (t->transient && t->transientfor == tmp_win->w)
{ {
if (t->transient && t->transientfor == tmp_win->w) XMapWindow(dpy, t->w);
{ t->mapped = TRUE;
if (t->icon_on) if (Scr->NoRaiseDeicon)
Zoom(t->icon_w, t->frame);
else
Zoom(tmp_win->icon_w, t->frame);
XMapWindow(dpy, t->w);
t->mapped = TRUE;
if (Scr->NoRaiseDeicon)
XMapWindow(dpy, t->frame); XMapWindow(dpy, t->frame);
else else
XMapRaised(dpy, t->frame); XMapRaised(dpy, t->frame);
SetMapStateProp(t, NormalState); SetMapStateProp(t, NormalState);
if (t->icon_w) { if (t->icon_w) {
XUnmapWindow(dpy, t->icon_w); XUnmapWindow(dpy, t->icon_w);
}
t->icon = FALSE;
t->icon_on = FALSE;
} }
t->icon = FALSE;
t->icon_on = FALSE;
} }
}
XSync (dpy, 0); XSync (dpy, 0);
} }
@ -2320,14 +2297,9 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y)
/* iconify transients first */ /* iconify transients first */
for (t = Scr->TwmRoot.next; t != NULL; t = t->next) for (t = Scr->TwmRoot.next; t != NULL; t = t->next)
{ {
if (t->transient && t->transientfor == tmp_win->w) if (t->transient && t->transientfor == tmp_win->w)
{ {
if (t->icon_on)
Zoom(t->icon_w, tmp_win->icon_w);
else
Zoom(t->frame, tmp_win->icon_w);
/* /*
* Prevent the receipt of an UnmapNotify, since that would * Prevent the receipt of an UnmapNotify, since that would
* cause a transition to the Withdrawn state. * cause a transition to the Withdrawn state.
@ -2338,21 +2310,19 @@ Iconify(TwmWindow *tmp_win, int def_x, int def_y)
XSelectInput(dpy, t->w, eventMask); XSelectInput(dpy, t->w, eventMask);
XUnmapWindow(dpy, t->frame); XUnmapWindow(dpy, t->frame);
if (t->icon_w) if (t->icon_w)
XUnmapWindow(dpy, t->icon_w); XUnmapWindow(dpy, t->icon_w);
SetMapStateProp(t, IconicState); SetMapStateProp(t, IconicState);
SetBorder(t, False); SetBorder(t, False);
if (t == Scr->Focus) if (t == Scr->Focus)
{ {
SetFocus ((TwmWindow *) NULL, LastTimestamp()); SetFocus ((TwmWindow *) NULL, LastTimestamp());
Scr->Focus = NULL; Scr->Focus = NULL;
Scr->FocusRoot = TRUE; Scr->FocusRoot = TRUE;
} }
t->icon = TRUE; t->icon = TRUE;
t->icon_on = FALSE; t->icon_on = FALSE;
} }
} }
Zoom(tmp_win->frame, tmp_win->icon_w);
/* /*
* Prevent the receipt of an UnmapNotify, since that would * Prevent the receipt of an UnmapNotify, since that would

View File

@ -523,7 +523,6 @@ static TwmKeyword keytable[] = {
{ "windowfunction", WINDOW_FUNCTION, 0 }, { "windowfunction", WINDOW_FUNCTION, 0 },
{ "windowring", WINDOW_RING, 0 }, { "windowring", WINDOW_RING, 0 },
{ "xorvalue", NKEYWORD, kwn_XorValue }, { "xorvalue", NKEYWORD, kwn_XorValue },
{ "zoom", ZOOM, 0 },
}; };
static int numkeywords = (sizeof(keytable)/sizeof(keytable[0])); static int numkeywords = (sizeof(keytable)/sizeof(keytable[0]));

View File

@ -198,7 +198,6 @@ typedef struct ScreenInfo
short NoRaiseDeicon; /* don't raise window on deiconify */ short NoRaiseDeicon; /* don't raise window on deiconify */
short NoRaiseWarp; /* don't raise window on warp */ short NoRaiseWarp; /* don't raise window on warp */
short DontMoveOff; /* don't allow windows to be moved off */ short DontMoveOff; /* don't allow windows to be moved off */
short DoZoom; /* zoom in and out of icons */
short TitleFocus; /* focus on window in title bar ? */ short TitleFocus; /* focus on window in title bar ? */
short NoTitlebar; /* put title bars on windows */ short NoTitlebar; /* put title bars on windows */
short DecorateTransients; /* put title bars on transients */ short DecorateTransients; /* put title bars on transients */
@ -206,7 +205,6 @@ typedef struct ScreenInfo
short SaveUnder; /* use save under's for menus */ short SaveUnder; /* use save under's for menus */
short StackMode; /* should we honor stack mode requests */ short StackMode; /* should we honor stack mode requests */
short MoveDelta; /* number of pixels before f.move starts */ short MoveDelta; /* number of pixels before f.move starts */
short ZoomCount; /* zoom outline count */
short Shadow; /* show the menu shadow */ short Shadow; /* show the menu shadow */
short InterpolateMenuColors;/* make pretty menus */ short InterpolateMenuColors;/* make pretty menus */
short HaveFonts; /* set if fonts have been loaded */ short HaveFonts; /* set if fonts have been loaded */

View File

@ -708,7 +708,6 @@ InitVariables(void)
Scr->NoRaiseDeicon = FALSE; Scr->NoRaiseDeicon = FALSE;
Scr->NoRaiseWarp = FALSE; Scr->NoRaiseWarp = FALSE;
Scr->DontMoveOff = FALSE; Scr->DontMoveOff = FALSE;
Scr->DoZoom = FALSE;
Scr->TitleFocus = TRUE; Scr->TitleFocus = TRUE;
Scr->NoTitlebar = FALSE; Scr->NoTitlebar = FALSE;
Scr->DecorateTransients = FALSE; Scr->DecorateTransients = FALSE;
@ -716,7 +715,6 @@ InitVariables(void)
Scr->SaveUnder = TRUE; Scr->SaveUnder = TRUE;
Scr->StackMode = TRUE; Scr->StackMode = TRUE;
Scr->MoveDelta = 1; /* so that f.deltastop will work */ Scr->MoveDelta = 1; /* so that f.deltastop will work */
Scr->ZoomCount = 8;
Scr->Shadow = TRUE; Scr->Shadow = TRUE;
Scr->InterpolateMenuColors = FALSE; Scr->InterpolateMenuColors = FALSE;
Scr->FirstTime = TRUE; Scr->FirstTime = TRUE;

View File

@ -202,51 +202,6 @@ void MoveOutline(Window root, int x, int y, int width, int height, int bw, int t
} }
} }
/**
* zoom in or out of an icon
*
* \param wf window to zoom from
* \param wt window to zoom to
*/
void
Zoom(Window wf, Window wt)
{
int fx, fy, tx, ty; /* from, to */
unsigned int fw, fh, tw, th; /* from, to */
long dx, dy, dw, dh;
long z;
int j;
if (!Scr->DoZoom || Scr->ZoomCount < 1) return;
if (wf == None || wt == None) return;
XGetGeometry (dpy, wf, &JunkRoot, &fx, &fy, &fw, &fh, &JunkBW, &JunkDepth);
XGetGeometry (dpy, wt, &JunkRoot, &tx, &ty, &tw, &th, &JunkBW, &JunkDepth);
dx = ((long) (tx - fx)); /* going from -> to */
dy = ((long) (ty - fy)); /* going from -> to */
dw = ((long) (tw - fw)); /* going from -> to */
dh = ((long) (th - fh)); /* going from -> to */
z = (long) (Scr->ZoomCount + 1);
for (j = 0; j < 2; j++) {
long i;
XDrawRectangle (dpy, Scr->Root, Scr->DrawGC, fx, fy, fw, fh);
for (i = 1; i < z; i++) {
int x = fx + (int) ((dx * i) / z);
int y = fy + (int) ((dy * i) / z);
unsigned width = (unsigned) (((long) fw) + (dw * i) / z);
unsigned height = (unsigned) (((long) fh) + (dh * i) / z);
XDrawRectangle (dpy, Scr->Root, Scr->DrawGC,
x, y, width, height);
}
XDrawRectangle (dpy, Scr->Root, Scr->DrawGC, tx, ty, tw, th);
}
}
/** /**
* expand the tilde character to HOME if it is the first * expand the tilde character to HOME if it is the first
* character of the filename * character of the filename

View File

@ -69,7 +69,6 @@ in this Software without prior written authorization from The Open Group.
EXTERN void MoveOutline ( Window root, int x, int y, int width, int height, EXTERN void MoveOutline ( Window root, int x, int y, int width, int height,
int bw, int th ); int bw, int th );
EXTERN void Zoom ( Window wf, Window wt );
EXTERN const char * ExpandFilename ( const char *name ); EXTERN const char * ExpandFilename ( const char *name );
EXTERN Pixmap CreateMenuIcon( int height, unsigned int *widthp, unsigned int *heightp ); EXTERN Pixmap CreateMenuIcon( int height, unsigned int *widthp, unsigned int *heightp );
EXTERN void GetUnknownIcon( const char *name ); EXTERN void GetUnknownIcon( const char *name );