forked from e16/e16
1
0
Fork 0

Move EObj sliding functions to slide.c too.

SVN revision: 73454
This commit is contained in:
Kim Woelders 2012-07-07 14:05:56 +00:00
parent 00bba77795
commit 3f8541b565
12 changed files with 146 additions and 102 deletions

View File

@ -93,7 +93,7 @@ e16_SOURCES = \
setup.c \
shapewin.c \
size.c \
slide.c \
slide.c slide.h \
slideout.c \
snaps.c snaps.h \
sound.c sound.h \

View File

@ -26,6 +26,7 @@
#include "ewins.h"
#include "groups.h"
#include "screen.h"
#include "slide.h"
#define DEBUG_ARRANGE 0

View File

@ -38,6 +38,7 @@
#include "iclass.h"
#include "screen.h"
#include "settings.h"
#include "slide.h"
#include "timers.h"
#include "tooltips.h"
#include "xwin.h"

View File

@ -612,87 +612,6 @@ EobjChangeShadow(EObj * eo __UNUSED__, int shadow __UNUSED__)
}
#endif
void
EobjSlideTo(EObj * eo, int fx, int fy, int tx, int ty, int speed)
{
int k, x, y;
EGrabServer();
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
x = ((fx * (1024 - k)) + (tx * k)) >> 10;
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
EobjMove(eo, x, y);
k = ETimedLoopNext();
}
EobjMove(eo, tx, ty);
EUngrabServer();
}
void
EobjsSlideBy(EObj ** peo, int num, int dx, int dy, int speed)
{
int i, k, x, y;
struct _xy {
int x, y;
} *xy;
if (num <= 0)
return;
xy = EMALLOC(struct _xy, num);
if (!xy)
return;
for (i = 0; i < num; i++)
{
xy[i].x = EobjGetX(peo[i]);
xy[i].y = EobjGetY(peo[i]);
}
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
for (i = 0; i < num; i++)
{
x = ((xy[i].x * (1024 - k)) + ((xy[i].x + dx) * k)) >> 10;
y = ((xy[i].y * (1024 - k)) + ((xy[i].y + dy) * k)) >> 10;
EobjMove(peo[i], x, y);
}
k = ETimedLoopNext();
}
for (i = 0; i < num; i++)
EobjMove(peo[i], xy[i].x + dx, xy[i].y + dy);
Efree(xy);
}
void
EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty, int fw, int fh,
int tw, int th, int speed)
{
int k, x, y, w, h;
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
x = ((fx * (1024 - k)) + (tx * k)) >> 10;
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
w = ((fw * (1024 - k)) + (tw * k)) >> 10;
h = ((fh * (1024 - k)) + (th * k)) >> 10;
EobjMoveResize(eo, x, y, w, h);
k = ETimedLoopNext();
}
EobjMoveResize(eo, tx, ty, tw, th);
}
void
EobjsRepaint(void)
{

View File

@ -182,12 +182,6 @@ void EobjChangeShadow(EObj * eo, int shadow);
void EobjSetLayer(EObj * eo, int layer);
void EobjSetFloating(EObj * eo, int floating);
int EobjIsShaped(const EObj * eo);
void EobjSlideTo(EObj * eo, int fx, int fy, int tx, int ty,
int speed);
void EobjsSlideBy(EObj ** peo, int num, int dx, int dy,
int speed);
void EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty,
int fw, int fh, int tw, int th, int speed);
void EobjsOpacityUpdate(int op_or);

View File

@ -36,6 +36,7 @@
#include "groups.h"
#include "hints.h"
#include "screen.h"
#include "slide.h"
#include "snaps.h"
#include "timers.h"
#include "windowmatch.h"

View File

@ -464,20 +464,6 @@ void MoveResizeEnd(EWin * ewin);
void MaxSizeHV(EWin * ewin, const char *resize_type,
int hor, int ver);
/* slide.c */
#define SLIDE_SOUND (1 << 0)
#define SLIDE_FOCUS (1 << 1)
#define SLIDE_WARP (1 << 2)
void EwinSlideSizeTo(EWin * ewin, int tx, int ty,
int tw, int th,
int speed, int mode, int flags);
void EwinSlideTo(EWin * ewin, int fx, int fy, int tx, int ty,
int speed, int mode, int flags);
void EwinsSlideTo(EWin ** ewin, int *fx, int *fy,
int *tx, int *ty, int num_wins,
int speed, int mode, int flags);
/* stacking.c */
EWin *const *EwinListStackGet(int *num);
EWin *const *EwinListFocusGet(int *num);

View File

@ -37,6 +37,7 @@
#include "menus.h"
#include "screen.h"
#include "settings.h"
#include "slide.h"
#include "tclass.h"
#include "timers.h"
#include "tooltips.h"

View File

@ -25,6 +25,7 @@
#include "ewins.h"
#include "hints.h"
#include "screen.h"
#include "slide.h"
#define DEBUG_SIZE 0
#if DEBUG_SIZE

View File

@ -24,8 +24,98 @@
#include "eobj.h"
#include "ewins.h"
#include "focus.h"
#include "slide.h"
#include "xwin.h"
/*
* EObj sliding functions
*/
void
EobjSlideTo(EObj * eo, int fx, int fy, int tx, int ty, int speed)
{
int k, x, y;
EGrabServer();
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
x = ((fx * (1024 - k)) + (tx * k)) >> 10;
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
EobjMove(eo, x, y);
k = ETimedLoopNext();
}
EobjMove(eo, tx, ty);
EUngrabServer();
}
void
EobjsSlideBy(EObj ** peo, int num, int dx, int dy, int speed)
{
int i, k, x, y;
struct _xy {
int x, y;
} *xy;
if (num <= 0)
return;
xy = EMALLOC(struct _xy, num);
if (!xy)
return;
for (i = 0; i < num; i++)
{
xy[i].x = EobjGetX(peo[i]);
xy[i].y = EobjGetY(peo[i]);
}
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
for (i = 0; i < num; i++)
{
x = ((xy[i].x * (1024 - k)) + ((xy[i].x + dx) * k)) >> 10;
y = ((xy[i].y * (1024 - k)) + ((xy[i].y + dy) * k)) >> 10;
EobjMove(peo[i], x, y);
}
k = ETimedLoopNext();
}
for (i = 0; i < num; i++)
EobjMove(peo[i], xy[i].x + dx, xy[i].y + dy);
Efree(xy);
}
void
EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty, int fw, int fh,
int tw, int th, int speed)
{
int k, x, y, w, h;
ETimedLoopInit(0, 1024, speed);
for (k = 0; k <= 1024;)
{
x = ((fx * (1024 - k)) + (tx * k)) >> 10;
y = ((fy * (1024 - k)) + (ty * k)) >> 10;
w = ((fw * (1024 - k)) + (tw * k)) >> 10;
h = ((fh * (1024 - k)) + (th * k)) >> 10;
EobjMoveResize(eo, x, y, w, h);
k = ETimedLoopNext();
}
EobjMoveResize(eo, tx, ty, tw, th);
}
/*
* EWin sliding functions
*/
void
EwinSlideSizeTo(EWin * ewin, int tx, int ty, int tw, int th,
int speed, int mode __UNUSED__, int flags __UNUSED__)

49
src/slide.h Normal file
View File

@ -0,0 +1,49 @@
/*
* Copyright (C) 2012 Kim Woelders
*
* 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 of the Software, its documentation and marketing & publicity
* materials, and acknowledgment shall be given in the documentation, materials
* and software packages that this Software was used.
*
* 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 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.
*/
#ifndef _SLIDE_H_
#define _SLIDE_H_
#include "eobj.h"
#include "ewins.h"
void EobjSlideTo(EObj * eo, int fx, int fy, int tx, int ty,
int speed);
void EobjsSlideBy(EObj ** peo, int num, int dx, int dy,
int speed);
void EobjSlideSizeTo(EObj * eo, int fx, int fy, int tx, int ty,
int fw, int fh, int tw, int th, int speed);
#define SLIDE_SOUND (1 << 0)
#define SLIDE_FOCUS (1 << 1)
#define SLIDE_WARP (1 << 2)
void EwinSlideSizeTo(EWin * ewin, int tx, int ty,
int tw, int th,
int speed, int mode, int flags);
void EwinSlideTo(EWin * ewin, int fx, int fy, int tx, int ty,
int speed, int mode, int flags);
void EwinsSlideTo(EWin ** ewin, int *fx, int *fy,
int *tx, int *ty, int num_wins,
int speed, int mode, int flags);
#endif /* _SLIDE_H_ */

View File

@ -32,6 +32,7 @@
#include "eobj.h"
#include "ewins.h"
#include "grabs.h"
#include "slide.h"
#include "xwin.h"
#define SLIDEOUT_EVENT_MASK \