Changeset 17521


Ignore:
Timestamp:
Oct 7, 2001, 1:48:29 PM (24 years ago)
Author:
sandervl
Message:

frame tracking updates + fixes

Location:
tags/trunk/src/user32
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified tags/trunk/src/user32/Makefile

    r17501 r17521  
    1 # $Id: Makefile,v 1.96 2001-10-03 18:37:51 sandervl Exp $
     1# $Id: Makefile,v 1.97 2001-10-07 11:48:27 sandervl Exp $
    22
    33#
     
    6464$(OBJDIR)\winproc.obj \
    6565$(OBJDIR)\oslibmsg.obj \
    66 $(OBJDIR)\wintrack.obj \
    6766$(OBJDIR)\hook.obj \
    6867$(OBJDIR)\win32wmdiclient.obj \
     
    9998$(OBJDIR)\caret.obj \
    10099$(OBJDIR)\text.obj \
     100$(OBJDIR)\wintrack.obj \
    101101$(OBJDIR)\oldnls32.obj \
    102102$(OBJDIR)\user32rsrc.obj \
  • TabularUnified tags/trunk/src/user32/pmwindow.cpp

    r17501 r17521  
    1 /* $Id: pmwindow.cpp,v 1.152 2001-10-03 18:37:52 sandervl Exp $ */
     1/* $Id: pmwindow.cpp,v 1.153 2001-10-07 11:48:28 sandervl Exp $ */
    22/*
    33 * Win32 Window Managment Code for OS/2
     
    14061406        if(fOS2Look) {//sent by titlebar control
    14071407#ifdef CUSTOM_TRACKFRAME
    1408             Frame_SysCommandSizeMove(win32wnd, SC_MOVE_W);
     1408            Frame_SysCommandSizeMove(win32wnd, SC_MOVE_W+HTCAPTION_W);
    14091409#else
    14101410            FrameTrackFrame(win32wnd, TF_MOVE);
  • TabularUnified tags/trunk/src/user32/uitools.cpp

    r15619 r17521  
    1 /* $Id: uitools.cpp,v 1.29 2001-02-02 19:04:02 sandervl Exp $ */
     1/* $Id: uitools.cpp,v 1.30 2001-10-07 11:48:28 sandervl Exp $ */
    22/*
    33 * User Interface Functions
     
    16161616BOOL WIN32API DrawFocusRect( HDC hdc, const RECT *lpRect)
    16171617{
     1618#if 0
     1619    //TODO: This doens't work. Find out why
     1620
     1621    HBRUSH hOldBrush;
     1622    HPEN hOldPen, hNewPen;
     1623    INT oldDrawMode, oldBkMode;
     1624
     1625    dprintf(("USER32: DrawFocusRect %x %x", hdc, lpRect));
     1626
     1627    hOldBrush = SelectObject(hdc, GetStockObject(NULL_BRUSH));
     1628    hNewPen = CreatePen(PS_ALTERNATE, 1, GetSysColor(COLOR_WINDOWTEXT));
     1629    hOldPen = SelectObject(hdc, hNewPen);
     1630    oldDrawMode = SetROP2(hdc, R2_XORPEN);
     1631    oldBkMode = SetBkMode(hdc, TRANSPARENT);
     1632
     1633    Rectangle(hdc, lpRect->left, lpRect->top, lpRect->right, lpRect->bottom);
     1634
     1635    SetBkMode(hdc, oldBkMode);
     1636    SetROP2(hdc, oldDrawMode);
     1637    SelectObject(hdc, hOldPen);
     1638    DeleteObject(hNewPen);
     1639    SelectObject(hdc, hOldBrush);
     1640
     1641    return TRUE;
     1642#else
    16181643 BOOL rc;
    16191644
     
    16211646    dprintf(("USER32:  DrawFocusRect %x %x returned %d", hdc, lpRect, rc));
    16221647    return rc;
     1648#endif
    16231649}
    16241650//******************************************************************************
  • TabularUnified tags/trunk/src/user32/wintrack.cpp

    r17501 r17521  
    11/*
    2  * Window position related functions.
     2 * Window tracking related functions.
     3 *
     4 * Copyright 2001 Sander van Leeuwen
     5 *
     6 * Changes from Wine code: (20011004)
     7 * - Only draw changed track frame instead of clearing the old one and
     8 *   drawing the new one (less flickering)
     9 * - Send WM_MOVING when moving a window (not done in Wine)
     10 * - Send WM_SIZING only when sizing a window
     11 * - Fixed handling of rectangles changed by WM_SIZING/MOVING
     12 *
     13 * Based on Wine code: (dlls\x11drv\winpos.c)
    314 *
    415 * Copyright 1993, 1994, 1995, 2001 Alexandre Julliard
    516 * Copyright 1995, 1996, 1999 Alex Korobka
    6  *
    7  * TODO: too much flickering when drawing sizing border.
    8  *       should be rewritten to only draw changed borders
    917 *
    1018 */
     
    3745 * FIXME:  This causes problems in Win95 mode.  (why?)
    3846 */
    39 static void draw_moving_frame( HDC hdc, RECT *rect, BOOL thickframe )
     47static void draw_moving_frame( HDC hdc, RECT *rect, BOOL thickframe, DWORD hittest, BOOL fRedraw)
    4048{
    4149    if (thickframe)
     
    4452        const int height = GetSystemMetrics(SM_CYFRAME);
    4553
     54        static RECT oldRect = {0};
     55
     56        if(fRedraw && EqualRect(&oldRect, rect)) {
     57            return;
     58        }
     59
    4660        HBRUSH hbrush = SelectObject( hdc, GetStockObject( GRAY_BRUSH ) );
    47         PatBlt( hdc, rect->left, rect->top,
    48                 rect->right - rect->left - width, height, PATINVERT );
    49         PatBlt( hdc, rect->left, rect->top + height, width,
    50                 rect->bottom - rect->top - height, PATINVERT );
    51         PatBlt( hdc, rect->left + width, rect->bottom - 1,
    52                 rect->right - rect->left - width, -height, PATINVERT );
    53         PatBlt( hdc, rect->right - 1, rect->top, -width,
    54                 rect->bottom - rect->top - height, PATINVERT );
     61        if(fRedraw && hittest != HTCAPTION)
     62        {
     63             int x, y, linewidth, lineheight;
     64
     65             //This should be done in a better way (less code), but at least
     66             //it works.
     67             switch(hittest) {
     68             case HTLEFT:
     69                 //clear old edge
     70                 PatBlt( hdc, oldRect.left, oldRect.top + height,
     71                         width, RECT_HEIGHT(&oldRect) - 2*height, PATINVERT );
     72                 //and draw new one
     73                 PatBlt( hdc, rect->left, rect->top + height,
     74                         width, RECT_HEIGHT(rect) - 2*height, PATINVERT );
     75
     76                 if(oldRect.left > rect->left) {
     77                     x = rect->left;
     78                     linewidth = oldRect.left - rect->left;
     79                 }
     80                 else {
     81                     x = oldRect.left;
     82                     linewidth = rect->left - oldRect.left;
     83                 }
     84                 PatBlt(hdc, x, oldRect.top,      linewidth, height,  PATINVERT);
     85                 PatBlt(hdc, x, oldRect.bottom-1, linewidth, -height, PATINVERT);
     86                 break;
     87             case HTRIGHT:
     88                 //clear old edge
     89                 PatBlt( hdc, oldRect.right-1, oldRect.top + height,
     90                         -width, RECT_HEIGHT(&oldRect) - 2*height, PATINVERT );
     91                 //and draw new one
     92                 PatBlt( hdc, rect->right-1, rect->top + height,
     93                         -width, RECT_HEIGHT(rect) - 2*height, PATINVERT );
     94
     95                 if(oldRect.right > rect->right) {
     96                     x = rect->right;
     97                     linewidth = oldRect.right - rect->right;
     98                 }
     99                 else {
     100                     x = oldRect.right;
     101                     linewidth = rect->right - oldRect.right;
     102                 }
     103                 PatBlt( hdc, x, oldRect.top,      linewidth,  height, PATINVERT );
     104                 PatBlt( hdc, x, oldRect.bottom-1, linewidth, -height, PATINVERT );
     105                 break;
     106
     107             case HTTOP:
     108                 //clear old edge
     109                 PatBlt( hdc, oldRect.left + width, oldRect.top,
     110                         RECT_WIDTH(&oldRect) - 2*width, height, PATINVERT );
     111                 //and draw new one
     112                 PatBlt( hdc, rect->left + width, rect->top,
     113                         RECT_WIDTH(rect) - 2*width, height, PATINVERT );
     114
     115                 if(oldRect.top > rect->top) {
     116                     y = rect->top;
     117                     lineheight = oldRect.top - rect->top;
     118                 }
     119                 else {
     120                     y = oldRect.top;
     121                     lineheight = rect->top - oldRect.top;
     122                 }
     123
     124                 PatBlt( hdc, oldRect.left,      y,  width, lineheight, PATINVERT );
     125                 PatBlt( hdc, oldRect.right - 1, y, -width, lineheight, PATINVERT );
     126                 break;
     127
     128             case HTBOTTOM:
     129                 //clear old edge
     130                 PatBlt( hdc, oldRect.left + width, oldRect.bottom-1,
     131                         RECT_WIDTH(&oldRect) - 2*width, -height, PATINVERT );
     132                 //and draw new one
     133                 PatBlt( hdc, rect->left + width, rect->bottom-1,
     134                         RECT_WIDTH(rect) - 2*width, -height, PATINVERT );
     135
     136                 if(oldRect.bottom > rect->bottom) {
     137                     y = rect->bottom;
     138                     lineheight = oldRect.bottom - rect->bottom;
     139                 }
     140                 else {
     141                     y = oldRect.bottom;
     142                     lineheight = rect->bottom - oldRect.bottom;
     143                 }
     144
     145                 PatBlt( hdc, oldRect.left,      y,  width, lineheight, PATINVERT );
     146                 PatBlt( hdc, oldRect.right - 1, y, -width, lineheight, PATINVERT );
     147                 break;
     148
     149             case HTBOTTOMLEFT:
     150                 //clear old edge (bottom)
     151                 PatBlt( hdc, oldRect.left, oldRect.bottom-1,
     152                         RECT_WIDTH(&oldRect) - width, -height, PATINVERT );
     153                 //and draw new one
     154                 PatBlt( hdc, rect->left, rect->bottom-1,
     155                         RECT_WIDTH(rect) - width, -height, PATINVERT );
     156
     157                 //clear old edge (left)
     158                 PatBlt( hdc, oldRect.left, oldRect.top + height,
     159                         width, RECT_HEIGHT(&oldRect) - 2*height, PATINVERT );
     160                 //and draw new one
     161                 PatBlt( hdc, rect->left, rect->top + height,
     162                         width, RECT_HEIGHT(rect) - 2*height, PATINVERT );
     163
     164                 //right
     165                 if(oldRect.bottom > rect->bottom) {
     166                     y = rect->bottom;
     167                     lineheight = oldRect.bottom - rect->bottom;
     168                 }
     169                 else {
     170                     y = oldRect.bottom;
     171                     lineheight = rect->bottom - oldRect.bottom;
     172                 }
     173                 PatBlt( hdc, oldRect.right-1, y,  -width, lineheight, PATINVERT );
     174
     175                 //top
     176                 if(oldRect.left > rect->left) {
     177                     x = rect->left;
     178                     linewidth = oldRect.left - rect->left;
     179                 }
     180                 else {
     181                     x = oldRect.left;
     182                     linewidth = rect->left - oldRect.left;
     183                 }
     184                 PatBlt(hdc, x, oldRect.top, linewidth, height,  PATINVERT);
     185                 break;
     186
     187             case HTBOTTOMRIGHT:
     188                 //clear old edge (bottom)
     189                 PatBlt( hdc, oldRect.left + width, oldRect.bottom-1,
     190                         RECT_WIDTH(&oldRect) - width, -height, PATINVERT );
     191                 //and draw new one
     192                 PatBlt( hdc, rect->left + width, rect->bottom-1,
     193                         RECT_WIDTH(rect) - width, -height, PATINVERT );
     194
     195                 //clear old edge (right)
     196                 PatBlt( hdc, oldRect.right-1, oldRect.top + height,
     197                         -width, RECT_HEIGHT(&oldRect) - 2*height, PATINVERT );
     198                 //and draw new one
     199                 PatBlt( hdc, rect->right-1, rect->top + height,
     200                         -width, RECT_HEIGHT(rect) - 2*height, PATINVERT );
     201
     202                 //left
     203                 if(oldRect.bottom > rect->bottom) {
     204                     y = rect->bottom;
     205                     lineheight = oldRect.bottom - rect->bottom;
     206                 }
     207                 else {
     208                     y = oldRect.bottom;
     209                     lineheight = rect->bottom - oldRect.bottom;
     210                 }
     211                 PatBlt( hdc, oldRect.left, y, width, lineheight, PATINVERT );
     212
     213                 //top
     214                 if(oldRect.right > rect->right) {
     215                     x = rect->right;
     216                     linewidth = oldRect.right - rect->right;
     217                 }
     218                 else {
     219                     x = oldRect.right;
     220                     linewidth = rect->right - oldRect.right;
     221                 }
     222                 PatBlt(hdc, x, oldRect.top, linewidth, height,  PATINVERT);
     223                 break;
     224
     225             case HTTOPLEFT:
     226                 //clear old edge (top)
     227                 PatBlt( hdc, oldRect.left, oldRect.top,
     228                         RECT_WIDTH(&oldRect) - width, height, PATINVERT );
     229                 //and draw new one
     230                 PatBlt( hdc, rect->left, rect->top,
     231                         RECT_WIDTH(rect) - width, height, PATINVERT );
     232
     233                 //clear old edge (left)
     234                 PatBlt( hdc, oldRect.left, oldRect.top + height,
     235                         width, RECT_HEIGHT(&oldRect) - 2*height, PATINVERT );
     236                 //and draw new one
     237                 PatBlt( hdc, rect->left, rect->top + height,
     238                         width, RECT_HEIGHT(rect) - 2*height, PATINVERT );
     239
     240                 //right
     241                 if(oldRect.top > rect->top) {
     242                     y = rect->top;
     243                     lineheight = oldRect.top - rect->top;
     244                 }
     245                 else {
     246                     y = oldRect.top;
     247                     lineheight = rect->top - oldRect.top;
     248                 }
     249                 PatBlt( hdc, oldRect.right-1, y,  -width, lineheight, PATINVERT );
     250
     251                 //bottom
     252                 if(oldRect.left > rect->left) {
     253                     x = rect->left;
     254                     linewidth = oldRect.left - rect->left;
     255                 }
     256                 else {
     257                     x = oldRect.left;
     258                     linewidth = rect->left - oldRect.left;
     259                 }
     260                 PatBlt(hdc, x, oldRect.bottom-1, linewidth, -height,  PATINVERT);
     261                 break;
     262
     263             case HTTOPRIGHT:
     264                 //clear old edge (top)
     265                 PatBlt( hdc, oldRect.left+width, oldRect.top,
     266                         RECT_WIDTH(&oldRect) - width, height, PATINVERT );
     267                 //and draw new one
     268                 PatBlt( hdc, rect->left+width, rect->top,
     269                         RECT_WIDTH(rect) - width, height, PATINVERT );
     270
     271                 //clear old edge (right)
     272                 PatBlt( hdc, oldRect.right-1, oldRect.top + height,
     273                         -width, RECT_HEIGHT(&oldRect) - 2*height, PATINVERT );
     274                 //and draw new one
     275                 PatBlt( hdc, rect->right-1, rect->top + height,
     276                         -width, RECT_HEIGHT(rect) - 2*height, PATINVERT );
     277
     278                 //left
     279                 if(oldRect.top > rect->top) {
     280                     y = rect->top;
     281                     lineheight = oldRect.top - rect->top;
     282                 }
     283                 else {
     284                     y = oldRect.top;
     285                     lineheight = rect->top - oldRect.top;
     286                 }
     287                 PatBlt( hdc, oldRect.left, y,  width, lineheight, PATINVERT);
     288
     289                 //bottom
     290                 if(oldRect.right > rect->right) {
     291                     x = rect->right;
     292                     linewidth = oldRect.right - rect->right;
     293                 }
     294                 else {
     295                     x = oldRect.right;
     296                     linewidth = rect->right - oldRect.right;
     297                 }
     298                 PatBlt(hdc, x, oldRect.bottom-1, linewidth, -height,  PATINVERT);
     299                 break;
     300             }
     301             oldRect = *rect;
     302        }
     303        else {
     304             if(fRedraw) {
     305                 PatBlt( hdc, oldRect.left, oldRect.top,
     306                         RECT_WIDTH(&oldRect) - width, height, PATINVERT );
     307                 PatBlt( hdc, oldRect.left, oldRect.top + height, width,
     308                         RECT_HEIGHT(&oldRect) - height, PATINVERT );
     309                 PatBlt( hdc, oldRect.left + width, oldRect.bottom - 1,
     310                         RECT_WIDTH(&oldRect) - width, -height, PATINVERT );
     311                 PatBlt( hdc, oldRect.right - 1, oldRect.top, -width,
     312                         RECT_HEIGHT(&oldRect) - height, PATINVERT );
     313             }
     314             oldRect = *rect;
     315             PatBlt( hdc, rect->left, rect->top,
     316                     rect->right - rect->left - width, height, PATINVERT );
     317             PatBlt( hdc, rect->left, rect->top + height, width,
     318                     rect->bottom - rect->top - height, PATINVERT );
     319             PatBlt( hdc, rect->left + width, rect->bottom - 1,
     320                     rect->right - rect->left - width, -height, PATINVERT );
     321             PatBlt( hdc, rect->right - 1, rect->top, -width,
     322                     rect->bottom - rect->top - height, PATINVERT );
     323        }
    55324        SelectObject( hdc, hbrush );
    56325    }
     
    158427    HWND hwnd = win32wnd->getWindowHandle();
    159428    MSG msg;
    160     RECT sizingRect, mouseRect, origRect;
     429    RECT sizingRect, mouseRect, origRect, lastsizingRect;
    161430    HDC hdc;
    162431    HWND parent;
     
    321590                }
    322591                else if(!DragFullWindows)
    323                     draw_moving_frame( hdc, &sizingRect, thickframe );
     592                    draw_moving_frame( hdc, &sizingRect, thickframe, hittest, FALSE );
    324593            }
    325594
     
    340609                if (ON_BOTTOM_BORDER(hittest)) newRect.bottom += dy;
    341610
    342                 if(!iconic && !DragFullWindows) draw_moving_frame( hdc, &sizingRect, thickframe );
     611////                if(!iconic && !DragFullWindows) draw_moving_frame( hdc, &sizingRect, thickframe, hittest, TRUE);
    343612
    344613                /* determine the hit location */
     
    360629                dprintf(("WM_SIZING rect (%d,%d)(%d,%d)", newRect.left, newRect.top, newRect.right, newRect.bottom));
    361630
    362 #ifdef __WIN32OS2__
    363                 if(RECT_EQUAL(&newRect, &tempRect) ||
    364                    (dy > 0 && RECT_HEIGHT(&newRect) > RECT_HEIGHT(&tempRect)) ||
    365                    (dx > 0 && RECT_WIDTH(&newRect) > RECT_WIDTH(&tempRect)) )
    366                 {
    367                     dprintf(("update capture point dx %d dy %d", dx, dy));
    368                     capturePoint = pt;
    369                     sizingRect = newRect;
    370                 }
    371 #endif
     631                dprintf(("update capture point dx %d dy %d", dx, dy));
     632                capturePoint   = pt;
     633                sizingRect     = tempRect;
     634                lastsizingRect = newRect;
     635
    372636                if (!iconic)
    373637                {
    374638                    if(!DragFullWindows)
    375                         draw_moving_frame( hdc, &newRect, thickframe );
     639                        draw_moving_frame( hdc, &newRect, thickframe, hittest, TRUE );
    376640                    else {
    377641                        /* To avoid any deadlocks, all the locks on the windows
     
    404668    }
    405669    else if (moved && !DragFullWindows)
    406         draw_moving_frame( hdc, &sizingRect, thickframe );
     670        draw_moving_frame( hdc, &lastsizingRect, thickframe, hittest, FALSE);
    407671
    408672    ReleaseDC( parent, hdc );
     
    419683//    wine_tsx11_unlock();
    420684
    421     if (HOOK_CallHooksA( WH_CBT, HCBT_MOVESIZE, (WPARAM)hwnd, (LPARAM)&sizingRect )) moved = FALSE;
     685    if (HOOK_CallHooksA( WH_CBT, HCBT_MOVESIZE, (WPARAM)hwnd, (LPARAM)&lastsizingRect )) moved = FALSE;
    422686
    423687    SendMessageA( hwnd, WM_EXITSIZEMOVE, 0, 0 );
     
    438702            /* NOTE: SWP_NOACTIVATE prevents document window activation in Word 6 */
    439703            if(!DragFullWindows)
    440                 SetWindowPos( hwnd, 0, sizingRect.left, sizingRect.top,
    441                               sizingRect.right - sizingRect.left,
    442                               sizingRect.bottom - sizingRect.top,
     704                SetWindowPos( hwnd, 0, lastsizingRect.left, lastsizingRect.top,
     705                              lastsizingRect.right - lastsizingRect.left,
     706                              lastsizingRect.bottom - lastsizingRect.top,
    443707                              ( hittest == HTCAPTION ) ? SWP_NOSIZE : 0 );
    444708        }
Note: See TracChangeset for help on using the changeset viewer.