Show opacity when changing by bindings.
SVN revision: 40021
This commit is contained in:
parent
2e5683e41c
commit
514a27c25e
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
45
src/coords.c
45
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);
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
14
src/ipc.c
14
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:
|
||||
|
|
Loading…
Reference in New Issue