From f4ef34b814d4b8aae040c0b0f08a64a8b9e2bf2b Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 17 Dec 2001 21:21:59 +0000 Subject: [PATCH] - Made dock/clip steal appicons of applications that were started from a shell/xterm or from the main menu, if there is a docked appicon of that class that is not running at the time the app is launched. - Added animation to show that the appicon was stolen by the dock (the way NEXTSTEP did - map an appicon as it normally would have been, then slide it to the position the docked appicon is). - Updated the animation constants for scrolling/sliding/shading to better adapt to newer/faster machines. Also used wusleep(10) when the delay was 0 to get rid of the jerky animation when there was no delay. --- ChangeLog | 9 +++++++++ src/actions.c | 20 +++++++++++++++++--- src/appicon.c | 4 ---- src/application.c | 10 ++++------ src/dock.c | 29 ++++++++++++++++++++++++++--- src/menu.c | 2 +- src/misc.c | 4 +++- src/wconfig.h.in | 32 ++++++++++++++++---------------- 8 files changed, 76 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index b919ce45..62fc0d56 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,15 @@ Changes since version 0.70.0: appicon). - Fixed user and global defaults domain merging to preserve values present in global but not in user in subdictionaries. +- Made dock/clip steal appicons of applications that were started from a + shell/xterm or from the main menu, if there is a docked appicon of that + class that is not running at the time the app is launched. +- Added animation to show that the appicon was stolen by the dock (the way + NEXTSTEP did - map an appicon as it normally would have been, then slide it + to the position the docked appicon is). +- Updated the animation constants for scrolling/sliding/shading to better + adapt to newer/faster machines. Also used wusleep(10) when the delay was 0 + to get rid of the jerky animation when there was no delay. Changes since version 0.65.1: diff --git a/src/actions.c b/src/actions.c index 31b3c756..c19f805c 100644 --- a/src/actions.c +++ b/src/actions.c @@ -78,7 +78,7 @@ static struct { {SHADE_STEPS_F, SHADE_DELAY_F}, {SHADE_STEPS_M, SHADE_DELAY_M}, {SHADE_STEPS_S, SHADE_DELAY_S}, - {SHADE_STEPS_U, SHADE_DELAY_U}}; + {SHADE_STEPS_US, SHADE_DELAY_US}}; #define SHADE_STEPS shadePars[(int)wPreferences.shade_speed].steps #define SHADE_DELAY shadePars[(int)wPreferences.shade_speed].delay @@ -286,8 +286,11 @@ wShadeWindow(WWindow *wwin) if (time(NULL)-time0 > MAX_ANIMATION_TIME) break; - if (SHADE_DELAY > 0) + if (SHADE_DELAY > 0) { wusleep(SHADE_DELAY*1000L); + } else { + wusleep(10); + } h-=s; y-=s; } @@ -363,8 +366,11 @@ wUnshadeWindow(WWindow *wwin) XResizeWindow(dpy, wwin->frame->core->window, w, h); XMoveWindow(dpy, wwin->client_win, 0, y); XFlush(dpy); - if (SHADE_DELAY > 0) + if (SHADE_DELAY > 0) { wusleep(SHADE_DELAY*2000L/3); + } else { + wusleep(10); + } h+=s; y+=s; @@ -561,6 +567,8 @@ animateResizeFlip(WScreen *scr, int x, int y, int w, int h, XFlush(dpy); #if (MINIATURIZE_ANIMATION_DELAY_F > 0) wusleep(MINIATURIZE_ANIMATION_DELAY_F); +#else + wusleep(10); #endif XDrawLines(dpy,scr->root_win,scr->frame_gc,points, 5, CoordModeOrigin); @@ -627,6 +635,8 @@ animateResizeTwist(WScreen *scr, int x, int y, int w, int h, XFlush(dpy); #if (MINIATURIZE_ANIMATION_DELAY_T > 0) wusleep(MINIATURIZE_ANIMATION_DELAY_T); +#else + wusleep(10); #endif XDrawLines(dpy, scr->root_win, scr->frame_gc, points, 5, CoordModeOrigin); @@ -673,6 +683,8 @@ animateResizeZoom(WScreen *scr, int x, int y, int w, int h, XFlush(dpy); #if (MINIATURIZE_ANIMATION_DELAY_Z > 0) wusleep(MINIATURIZE_ANIMATION_DELAY_Z); +#else + wusleep(10); #endif for (j=0; jroot_win, scr->frame_gc, @@ -698,6 +710,8 @@ animateResizeZoom(WScreen *scr, int x, int y, int w, int h, XFlush(dpy); #if (MINIATURIZE_ANIMATION_DELAY_Z > 0) wusleep(MINIATURIZE_ANIMATION_DELAY_Z); +#else + wusleep(10); #endif for (j=0; jroot_win, scr->frame_gc, diff --git a/src/appicon.c b/src/appicon.c index e723f8fc..de61ab8b 100644 --- a/src/appicon.c +++ b/src/appicon.c @@ -277,10 +277,6 @@ drawCorner(WIcon *icon) void wAppIconMove(WAppIcon *aicon, int x, int y) { - WApplication *app; - - app = wApplicationOf(aicon->icon->owner->main_window); - XMoveWindow(dpy, aicon->icon->core->window, x, y); aicon->x_pos = x; aicon->y_pos = y; diff --git a/src/application.c b/src/application.c index 1163664f..735b44ff 100644 --- a/src/application.c +++ b/src/application.c @@ -363,12 +363,10 @@ wApplicationCreate(WScreen *scr, Window main_window) if (clip && clip->attract_icons && wDockFindFreeSlot(clip, &x, &y)) { wapp->app_icon->attracted = 1; - if (!wapp->app_icon->icon->shadowed) { - wapp->app_icon->icon->shadowed = 1; - wapp->app_icon->icon->force_paint = 1; - /* We don't do an wAppIconPaint() here because it's in - * wDockAttachIcon(). -Dan. - */ + if (!icon->shadowed) { + icon->shadowed = 1; + icon->force_paint = 1; + /* wAppIconPaint() is done in wDockAttachIcon() below */ } wDockAttachIcon(clip, wapp->app_icon, x, y); } else { diff --git a/src/dock.c b/src/dock.c index 42fc2e3d..44a6f614 100644 --- a/src/dock.c +++ b/src/dock.c @@ -3172,8 +3172,7 @@ retry: } if ((icon->wm_instance || icon->wm_class) - && (icon->launching - || (dock->screen_ptr->flags.startup && !icon->running))) { + && (icon->launching || !icon->running)) { if (icon->wm_instance && wm_instance && strcmp(icon->wm_instance, wm_instance)!=0) { @@ -3202,7 +3201,31 @@ retry: icon->main_window = window; } - found = True; + found = True; + if (!wPreferences.no_animations && !icon->launching && + !dock->screen_ptr->flags.startup) { + WAppIcon *aicon; + int x0, y0; + + icon->launching = 1; + dockIconPaint(icon); + + aicon = wAppIconCreateForDock(dock->screen_ptr, NULL, + wm_instance, wm_class, + TILE_NORMAL); + PlaceIcon(dock->screen_ptr, &x0, &y0); + wAppIconMove(aicon, x0, y0); + /* Should this always be lowered? -Dan */ + if (dock->lowered) + wLowerFrame(aicon->icon->core); + XMapWindow(dpy, aicon->icon->core->window); + aicon->launching = 1; + wAppIconPaint(aicon); + SlideWindow(aicon->icon->core->window, x0, y0, + icon->x_pos, icon->y_pos); + XUnmapWindow(dpy, aicon->icon->core->window); + wAppIconDestroy(aicon); + } wDockFinishLaunch(dock, icon); break; } diff --git a/src/menu.c b/src/menu.c index 6b1adc9c..c31033c3 100644 --- a/src/menu.c +++ b/src/menu.c @@ -73,7 +73,7 @@ static struct { {MENU_SCROLL_STEPS_F, MENU_SCROLL_DELAY_F}, {MENU_SCROLL_STEPS_M, MENU_SCROLL_DELAY_M}, {MENU_SCROLL_STEPS_S, MENU_SCROLL_DELAY_S}, - {MENU_SCROLL_STEPS_U, MENU_SCROLL_DELAY_U}}; + {MENU_SCROLL_STEPS_US, MENU_SCROLL_DELAY_US}}; static void menuMouseDown(WObjDescriptor *desc, XEvent *event); diff --git a/src/misc.c b/src/misc.c index 61f2f13c..f4aa1378 100644 --- a/src/misc.c +++ b/src/misc.c @@ -350,7 +350,7 @@ SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y) {ICON_SLIDE_DELAY_F, ICON_SLIDE_STEPS_F, ICON_SLIDE_SLOWDOWN_F}, {ICON_SLIDE_DELAY_M, ICON_SLIDE_STEPS_M, ICON_SLIDE_SLOWDOWN_M}, {ICON_SLIDE_DELAY_S, ICON_SLIDE_STEPS_S, ICON_SLIDE_SLOWDOWN_S}, - {ICON_SLIDE_DELAY_U, ICON_SLIDE_STEPS_U, ICON_SLIDE_SLOWDOWN_U}}; + {ICON_SLIDE_DELAY_US, ICON_SLIDE_STEPS_US, ICON_SLIDE_SLOWDOWN_US}}; @@ -407,6 +407,8 @@ SlideWindow(Window win, int from_x, int from_y, int to_x, int to_y) XFlush(dpy); if (apars[(int)wPreferences.icon_slide_speed].delay > 0) { wusleep(apars[(int)wPreferences.icon_slide_speed].delay*1000L); + } else { + wusleep(10); } if (time(NULL) - time0 > MAX_ANIMATION_TIME) break; diff --git a/src/wconfig.h.in b/src/wconfig.h.in index b2dd738a..4f0393a9 100644 --- a/src/wconfig.h.in +++ b/src/wconfig.h.in @@ -356,29 +356,29 @@ /* *** animation speed constants *** */ /* icon slide */ -#define ICON_SLIDE_SLOWDOWN_UF 20 +#define ICON_SLIDE_SLOWDOWN_UF 1 #define ICON_SLIDE_DELAY_UF 0 -#define ICON_SLIDE_STEPS_UF 15 +#define ICON_SLIDE_STEPS_UF 50 -#define ICON_SLIDE_SLOWDOWN_F 30 +#define ICON_SLIDE_SLOWDOWN_F 3 #define ICON_SLIDE_DELAY_F 0 -#define ICON_SLIDE_STEPS_F 10 +#define ICON_SLIDE_STEPS_F 50 -#define ICON_SLIDE_SLOWDOWN_M 40 +#define ICON_SLIDE_SLOWDOWN_M 5 #define ICON_SLIDE_DELAY_M 0 -#define ICON_SLIDE_STEPS_M 5 +#define ICON_SLIDE_STEPS_M 30 -#define ICON_SLIDE_SLOWDOWN_S 50 +#define ICON_SLIDE_SLOWDOWN_S 10 #define ICON_SLIDE_DELAY_S 0 -#define ICON_SLIDE_STEPS_S 3 +#define ICON_SLIDE_STEPS_S 20 -#define ICON_SLIDE_SLOWDOWN_U 50 -#define ICON_SLIDE_DELAY_U 3 -#define ICON_SLIDE_STEPS_U 3 +#define ICON_SLIDE_SLOWDOWN_US 20 +#define ICON_SLIDE_DELAY_US 1 +#define ICON_SLIDE_STEPS_US 10 /* menu scrolling */ #define MENU_SCROLL_STEPS_UF 14 -#define MENU_SCROLL_DELAY_UF 0 +#define MENU_SCROLL_DELAY_UF 1 #define MENU_SCROLL_STEPS_F 10 #define MENU_SCROLL_DELAY_F 5 @@ -389,8 +389,8 @@ #define MENU_SCROLL_STEPS_S 4 #define MENU_SCROLL_DELAY_S 6 -#define MENU_SCROLL_STEPS_U 1 -#define MENU_SCROLL_DELAY_U 8 +#define MENU_SCROLL_STEPS_US 1 +#define MENU_SCROLL_DELAY_US 8 /* shade animation */ @@ -406,8 +406,8 @@ #define SHADE_STEPS_S 30 #define SHADE_DELAY_S 0 -#define SHADE_STEPS_U 20 -#define SHADE_DELAY_U 10 +#define SHADE_STEPS_US 40 +#define SHADE_DELAY_US 10 /* workspace name on switch display */ -- 2.11.4.GIT