diff --git a/po/POTFILES.in b/po/POTFILES.in index b4976afd..5455bce3 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -9,6 +9,7 @@ src/buttons.c src/comms.c src/config.c src/container.c +src/coords.c src/cursors.c src/desktops.c src/dialog.c diff --git a/src/aclass.c b/src/aclass.c index e1ccf388..e80bac1e 100644 --- a/src/aclass.c +++ b/src/aclass.c @@ -933,7 +933,11 @@ ActionGetModifiers(Action * aa) static void handleAction(EWin * ewin, ActionType * action) { + if (ewin) + ewin->state.in_action = 1; EFunc(ewin, action->params); + if (ewin) + ewin->state.in_action = 0; /* Did we just hose ourselves? if so, we'd best not stick around here */ if (mode_action_destroy) diff --git a/src/coords.c b/src/coords.c index 8b954e47..86330a3d 100644 --- a/src/coords.c +++ b/src/coords.c @@ -27,12 +27,13 @@ #include "hints.h" #include "iclass.h" #include "tclass.h" +#include "timers.h" #include "xwin.h" static EObj *coord_eo = NULL; -void -CoordsShow(EWin * ewin) +static void +_CoordsShow(EWin * ewin, int mode) { TextClass *tc; ImageClass *ic; @@ -63,7 +64,18 @@ CoordsShow(EWin * ewin) h = (ewin->state.shaded) ? ewin->client.h : ewin->shape_h; ICCCM_GetIncrementalSize(ewin, w, h, &w, &h); - Esnprintf(s, sizeof(s), "%i x %i (%i, %i)", w, h, x, y); + switch (mode) + { + default: + case 0: + Esnprintf(s, sizeof(s), "%i x %i (%i, %i)", w, h, x, y); + break; + case 1: + Esnprintf(s, sizeof(s), _("Focused/unfocused opacity: %d/%d %%"), + OpacityToPercent(ewin->props.focused_opacity), + OpacityToPercent(ewin->ewmh.opacity)); + break; + } TextSize(tc, 0, 0, 0, s, &cw, &ch, 17); pad = ImageclassGetPadding(ic); cw += pad->left + pad->right; @@ -148,3 +160,30 @@ CoordsHide(void) #endif } } + +void +CoordsShow(EWin * ewin) +{ + _CoordsShow(ewin, 0); +} + +static Timer *timer_show_op = NULL; + +static int +_CoordsHideTimeout(void *data __UNUSED__) +{ + CoordsHide(); + + timer_show_op = NULL; + return 0; +} + +void +CoordsShowOpacity(EWin * ewin) +{ + EwinShapeSet(ewin); + ewin->state.show_coords = 1; + _CoordsShow(ewin, 1); + TIMER_DEL(timer_show_op); + TIMER_ADD(timer_show_op, 1., _CoordsHideTimeout, NULL); +} diff --git a/src/ewins.h b/src/ewins.h index a45710c4..83f147f8 100644 --- a/src/ewins.h +++ b/src/ewins.h @@ -105,6 +105,7 @@ struct _ewin { unsigned show_coords:1; unsigned maximizing:1; unsigned shading:1; + unsigned in_action:1; /* Derived state flags. Change only in EwinStateUpdate() */ unsigned no_border:1; @@ -319,6 +320,7 @@ void ArrangeEwins(const char *params); /* coords.c */ void CoordsShow(EWin * ewin); +void CoordsShowOpacity(EWin * ewin); void CoordsHide(void); /* dock.c */ diff --git a/src/ipc.c b/src/ipc.c index 306f8786..d0ebb2a3 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -404,17 +404,22 @@ doMoveConstrainedNoGroup(EWin * ewin, const char *params) } #endif +static Timer *op_timer = NULL; + static int OpacityTimeout(void *data) { EWin *ewin = (EWin *) data; if (!EwinFindByPtr(ewin)) /* May be gone */ - return 0; + goto done; if (ewin->state.active) EoChangeOpacity(ewin, ewin->props.focused_opacity); + done: + ewin->state.show_coords = 0; + op_timer = NULL; return 0; } @@ -703,12 +708,13 @@ IpcWinop(const WinOp * wop, EWin * ewin, const char *prm) EwinOpSetOpacity(ewin, OPSRC_USER, a); if (a && ewin->state.active) { - Timer *op_timer; - EoChangeOpacity(ewin, OpacityFromPercent(a)); + TIMER_DEL(op_timer); if (ewin->props.focused_opacity) TIMER_ADD(op_timer, 0.001 * 700, OpacityTimeout, ewin); } + if (ewin->state.in_action) + CoordsShowOpacity(ewin); break; case EWIN_OP_FOCUSED_OPACITY: @@ -724,6 +730,8 @@ IpcWinop(const WinOp * wop, EWin * ewin, const char *prm) b += a; a = (b < 0) ? 0 : (b > 100) ? 100 : b; EwinOpSetFocusedOpacity(ewin, OPSRC_USER, a); + if (ewin->state.in_action) + CoordsShowOpacity(ewin); break; case EWIN_OP_SNAP: