/* Handle the velocity */ static void throwPreparePaintScreen (CompScreen *s, int ms) { CompWindow *w; THROW_SCREEN (s); for (w = s->windows; w; w = w->next) { THROW_WINDOW (w); if (tw->moving) tw->time += ms; tw->xVelocity /= (1.0 + (throwGetFrictionConstant (s) / 100)); tw->yVelocity /= (1.0 + (throwGetFrictionConstant (s) / 100)); if (!tw->moving && ( (tw->xVelocity < 0.0f || tw->xVelocity > 0.0f) || (tw->yVelocity < 0.0f || tw->yVelocity > 0.0))) { int dx = roundf(tw->xVelocity * (ms / 10) * (throwGetVelocityX (s) / 10)); int dy = roundf (tw->yVelocity * (ms / 10) * (throwGetVelocityY (s) / 10)); if (throwGetConstrainX (s)) { if ((WIN_REAL_X (w) + dx) < 0) dx = 0; else if ((WIN_REAL_X (w) + WIN_REAL_W (w) + dx) > w->screen->width) dx = 0; } if (throwGetConstrainY (s)) { if ((WIN_REAL_Y (w) + dy) < 0) dy = 0; else if ((WIN_REAL_Y (w) + WIN_REAL_H (w) + dy) > w->screen->height) dy = 0; } moveWindow (w, dx, dy, TRUE, FALSE); syncWindowPosition (w); } } UNWRAP (ts, s, preparePaintScreen); (*s->preparePaintScreen) (s, ms); WRAP (ts, s, preparePaintScreen, throwPreparePaintScreen); }
static void FWHandleIPWMoveMotionEvent (CompWindow *w, unsigned int x, unsigned int y) { FREEWINS_SCREEN (w->screen); int dx = x - lastPointerX; int dy = y - lastPointerY; if (!fws->grabIndex) return; moveWindow(w, dx, dy, TRUE, freewinsGetImmediateMoves (w->screen)); syncWindowPosition (w); }
static void groupDequeueSyncs (GroupPendingSyncs *syncs) { GroupPendingSyncs *sync; while (syncs) { sync = syncs; syncs = sync->next; GROUP_WINDOW (sync->w); if (gw->needsPosSync) { syncWindowPosition (sync->w); gw->needsPosSync = FALSE; } free (sync); } }
static void compiz_damage(void) { CompDisplay *d; CompScreen *s; CompWindow *w; Eina_Bool thaw = EINA_FALSE; for (d = core.displays; d; d = d->next) for (s = d->screens; s; s = s->next) { if (!s->damageMask) for (w = s->windows; w; w = w->next) { E_Client *ec; ec = compiz_win_to_client(w); if (w->grabbed && ((!ec->moving) && (!e_client_util_resizing_get(ec)))) w->screen->windowUngrabNotify(w); if ((w->attrib.x == ec->client.x) && (w->attrib.y == ec->client.y)) continue; moveWindow(w, ec->client.x - w->attrib.x, ec->client.y - w->attrib.y, TRUE, TRUE); syncWindowPosition(w); compiz_texture_clear(w->texture); } if (s->damageMask) { evas_damage_rectangle_add(e_comp->evas, 0, 0, 1, 1); thaw = EINA_TRUE; } } if (eina_array_count(events) || thaw) ecore_animator_thaw(compiz_anim); else ecore_animator_freeze(compiz_anim); }
/* * Setup for paint screen */ static void smartputPreparePaintScreen (CompScreen *s, int msSinceLastPaint) { SMARTPUT_SCREEN (s); if (sps->animation && sps->grabIndex) { CompWindow *w; int stesps; float amount, chunk; amount = msSinceLastPaint * 0.025f * 2.5; stesps = amount / (0.5f * 0.5); if (!stesps) stesps = 1; chunk = amount / (float)stesps; while (stesps--) { Window endAnimationWindow = None; sps->animation = 0; for (w = s->windows; w; w = w->next) { SMARTPUT_WINDOW (w); if (spw->animation) { spw->animation = adjustSmartputVelocity (w); sps->animation |= spw->animation; spw->tx += spw->xVelocity * chunk; spw->ty += spw->yVelocity * chunk; if (!spw->animation) { /* animation done */ moveWindow (w, spw->targetX - w->attrib.x, spw->targetY - w->attrib.y, TRUE, TRUE); syncWindowPosition (w); updateWindowAttributes (w, CompStackingUpdateModeNone); endAnimationWindow = w->id; spw->tx = spw->ty = 0; } } } if (!sps->animation) { /* unfocus moved window if enabled */ if (endAnimationWindow) sendWindowActivationRequest (s, endAnimationWindow); break; } } } UNWRAP (sps, s, preparePaintScreen); (*s->preparePaintScreen) (s, msSinceLastPaint); WRAP (sps, s, preparePaintScreen, smartputPreparePaintScreen); }
void groupWindowUngrabNotify (CompWindow *w) { CompScreen *s = w->screen; GROUP_SCREEN (s); GROUP_DISPLAY (&display); GROUP_WINDOW (w); if (gw->group && !gd->ignoreMode && !gs->queued) { int i; XRectangle rect; groupDequeueMoveNotifies (s); if (gd->resizeInfo) { rect.x = WIN_X (w); rect.y = WIN_Y (w); rect.width = WIN_WIDTH (w); rect.height = WIN_HEIGHT (w); } for (i = 0; i < gw->group->nWins; i++) { CompWindow *cw = gw->group->windows[i]; if (!cw) continue; if (cw->id != w->id) { GROUP_WINDOW (cw); if (gw->resizeGeometry) { unsigned int mask; gw->resizeGeometry->x = WIN_X (cw); gw->resizeGeometry->y = WIN_Y (cw); gw->resizeGeometry->width = WIN_WIDTH (cw); gw->resizeGeometry->height = WIN_HEIGHT (cw); mask = groupUpdateResizeRectangle (cw, &rect, FALSE); if (mask) { XWindowChanges xwc; xwc.x = gw->resizeGeometry->x; xwc.y = gw->resizeGeometry->y; xwc.width = gw->resizeGeometry->width; xwc.height = gw->resizeGeometry->height; if (w->mapNum && (mask & (CWWidth | CWHeight))) sendSyncRequest (w); configureXWindow (cw, mask, &xwc); } else { free (gw->resizeGeometry); gw->resizeGeometry = NULL; } } if (gw->needsPosSync) { syncWindowPosition (cw); gw->needsPosSync = FALSE; } groupEnqueueUngrabNotify (cw); } } if (gd->resizeInfo) { free (gd->resizeInfo); gd->resizeInfo = NULL; } gw->group->grabWindow = None; gw->group->grabMask = 0; } UNWRAP (gs, s, windowUngrabNotify); (*s->windowUngrabNotify)(w); WRAP ( gs, s, windowUngrabNotify, groupWindowUngrabNotify); }