user32 revert lite ;-P
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 11 Jan 2009 23:08:47 +0000 (23:08 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sun, 11 Jan 2009 23:08:47 +0000 (23:08 +0000)
- revert 32934: remove the hack for disabled button font, as it's not needed anymore since we have tahoma
- partly revert 28055: use InvalidateRect and add it to ntwrapper.h
- add a define for SYSCOLOR_GetPen to reduce diff to wine

svn path=/trunk/; revision=38712

reactos/dll/win32/user32/controls/button.c
reactos/dll/win32/user32/controls/combo.c
reactos/dll/win32/user32/controls/edit.c
reactos/dll/win32/user32/controls/listbox.c
reactos/dll/win32/user32/controls/scrollbar.c
reactos/dll/win32/user32/include/ntwrapper.h
reactos/dll/win32/user32/include/user32p.h

index 0bfd70a..04cde19 100644 (file)
@@ -259,8 +259,8 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
     LONG state;
     HANDLE oldHbitmap;
 
-    pt.x = LOWORD(lParam);
-    pt.y = HIWORD(lParam);
+    pt.x = (short)LOWORD(lParam);
+    pt.y = (short)HIWORD(lParam);
 
     switch (uMsg)
     {
@@ -433,7 +433,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
         if (unicode) DefWindowProcW( hWnd, WM_SETTEXT, wParam, lParam );
         else DefWindowProcA( hWnd, WM_SETTEXT, wParam, lParam );
         if (btn_type == BS_GROUPBOX) /* Yes, only for BS_GROUPBOX */
-            NtUserInvalidateRect( hWnd, NULL, TRUE );
+            InvalidateRect( hWnd, NULL, TRUE );
         else
             paint_button( hWnd, btn_type, ODA_DRAWENTIRE );
         return 1; /* success. FIXME: check text length */
@@ -469,7 +469,7 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
         break;
 
     case WM_SYSCOLORCHANGE:
-        NtUserInvalidateRect( hWnd, NULL, FALSE );
+        InvalidateRect( hWnd, NULL, FALSE );
         break;
 
 #ifndef __REACTOS__
@@ -506,8 +506,8 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
             return 0;
         }
         oldHbitmap = (HBITMAP)SetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET, lParam );
-        NtUserInvalidateRect( hWnd, NULL, FALSE );
-        return (LRESULT)oldHbitmap;
+       InvalidateRect( hWnd, NULL, FALSE );
+       return (LRESULT)oldHbitmap;
 
     case BM_GETIMAGE:
         return GetWindowLongPtrW( hWnd, HIMAGE_GWL_OFFSET );
@@ -583,7 +583,6 @@ static LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
     return 0;
 }
 
-
 /***********************************************************************
  *           ButtonWndProcW
  * The button window procedure. This is just a wrapper which locks
@@ -826,22 +825,8 @@ static void BUTTON_DrawLabel(HWND hwnd, HDC hdc, UINT dtFlags, RECT *rc)
          return;
    }
 
-   /* ROS Hack to make font look less ugly */
-   if ( ((style & (BS_ICON|BS_BITMAP)) == BS_TEXT) &&
-        (flags & DSS_DISABLED) )
-   {
-      ++rc->left; ++rc->top; ++rc->right; ++rc->bottom;
-      SetTextColor(hdc, GetSysColor(COLOR_3DHILIGHT));
-      DrawTextW(hdc, (LPCWSTR)lp, -1, rc, (UINT)wp);
-      --rc->left; --rc->top; --rc->right; --rc->bottom;
-      SetTextColor(hdc, GetSysColor(COLOR_GRAYTEXT));
-      DrawTextW(hdc, (LPCWSTR)lp, -1, rc, (UINT)wp);
-   }
-   else
-   {
-      DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
-                 rc->right - rc->left, rc->bottom - rc->top, flags);
-   }
+   DrawStateW(hdc, hbr, lpOutputProc, lp, wp, rc->left, rc->top,
+              rc->right - rc->left, rc->bottom - rc->top, flags);
    HeapFree( GetProcessHeap(), 0, text );
 }
 
@@ -869,11 +854,7 @@ static void PB_Paint( HWND hwnd, HDC hDC, UINT action )
     parent = GetParent(hwnd);
     if (!parent) parent = hwnd;
     SendMessageW( parent, WM_CTLCOLORBTN, (WPARAM)hDC, (LPARAM)hwnd );
-#ifdef __REACTOS__
-    hOldPen = (HPEN)SelectObject(hDC, GetSysColorPen(COLOR_WINDOWFRAME));
-#else
     hOldPen = (HPEN)SelectObject(hDC, SYSCOLOR_GetPen(COLOR_WINDOWFRAME));
-#endif
     hOldBrush =(HBRUSH)SelectObject(hDC,GetSysColorBrush(COLOR_BTNFACE));
     oldBkMode = SetBkMode(hDC, TRANSPARENT);
 
index 14e358a..590006b 100644 (file)
@@ -1233,7 +1233,7 @@ BOOL COMBO_FlipListbox( LPHEADCOMBO lphc, BOOL ok, BOOL bRedrawButton )
  */
 static void CBRepaintButton( LPHEADCOMBO lphc )
    {
-  NtUserInvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
+  InvalidateRect(lphc->self, &lphc->buttonRect, TRUE);
   UpdateWindow(lphc->self);
 }
 
@@ -1252,9 +1252,7 @@ static void COMBO_SetFocus( LPHEADCOMBO lphc )
        /* lphc->wState |= CBF_FOCUSED;  */
 
        if( !(lphc->wState & CBF_EDIT) )
-       {
-            NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
-       }
+        InvalidateRect(lphc->self, &lphc->textRect, TRUE);
 
        CB_NOTIFY( lphc, CBN_SETFOCUS );
        lphc->wState |= CBF_FOCUSED;
@@ -1276,11 +1274,11 @@ static void COMBO_KillFocus( LPHEADCOMBO lphc )
            if( CB_GETTYPE(lphc) == CBS_DROPDOWNLIST )
                SendMessageW(lphc->hWndLBox, LB_CARETOFF, 0, 0);
 
-           lphc->wState &= ~CBF_FOCUSED;
+          lphc->wState &= ~CBF_FOCUSED;
 
            /* redraw text */
-           if( !(lphc->wState & CBF_EDIT) )
-                NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
+          if( !(lphc->wState & CBF_EDIT) )
+            InvalidateRect(lphc->self, &lphc->textRect, TRUE);
 
            CB_NOTIFY( lphc, CBN_KILLFOCUS );
        }
@@ -1298,12 +1296,12 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
 
        switch( HIWORD(wParam) >> 8 )
        {
-        case (EN_SETFOCUS >> 8):
+          case (EN_SETFOCUS >> 8):
 
                TRACE("[%p]: edit [%p] got focus\n", lphc->self, lphc->hWndEdit );
 
-               COMBO_SetFocus( lphc );
-               break;
+               COMBO_SetFocus( lphc );
+               break;
 
           case (EN_KILLFOCUS >> 8):
 
@@ -1379,7 +1377,7 @@ static LRESULT COMBO_Command( LPHEADCOMBO lphc, WPARAM wParam, HWND hWnd )
                       SendMessageW(lphc->hWndEdit, EM_SETSEL, 0, (LPARAM)(-1));
                   }
                   else
-                      NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
+                      InvalidateRect(lphc->self, &lphc->textRect, TRUE);
                }
 
                /* do not roll up if selection is being tracked
@@ -1699,7 +1697,7 @@ static LRESULT COMBO_SelectString( LPHEADCOMBO lphc, INT start, LPARAM pText, BO
        CBUpdateEdit( lphc, index );
      else
      {
-       NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
+       InvalidateRect(lphc->self, &lphc->textRect, TRUE);
      }
    }
    return (LRESULT)index;
@@ -2009,7 +2007,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
                EnableWindow( lphc->hWndLBox, (BOOL)wParam );
 
                /* Force the control to repaint when the enabled state changes. */
-               NtUserInvalidateRect(lphc->self, NULL, TRUE);
+               InvalidateRect(lphc->self, NULL, TRUE);
                return  TRUE;
        case WM_SETREDRAW:
                if( wParam )
@@ -2194,7 +2192,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
                     SendMessageW(lphc->hWndEdit, WM_SETTEXT, 0, (LPARAM)empty_stringW);
                }
                 else
-                    NtUserInvalidateRect(lphc->self, NULL, TRUE);
+                    InvalidateRect(lphc->self, NULL, TRUE);
                return  TRUE;
        case CB_INITSTORAGE:
                return SendMessageW(lphc->hWndLBox, LB_INITSTORAGE, wParam, lParam);
@@ -2283,7 +2281,7 @@ static LRESULT ComboWndProc_common( HWND hwnd, UINT message,
                if( lphc->wState & CBF_EDIT )
                    CBUpdateEdit( lphc, (INT)wParam );
                else
-                   NtUserInvalidateRect(lphc->self, &lphc->textRect, TRUE);
+                   InvalidateRect(lphc->self, &lphc->textRect, TRUE);
                lphc->wState &= ~CBF_SELCHANGE;
                return  lParam;
 #ifndef __REACTOS__
index ec8c553..7643f25 100644 (file)
@@ -5521,7 +5521,7 @@ static void EDIT_UpdateText(EDITSTATE *es, LPRECT rc, BOOL bErase)
         es->flags &= ~EF_UPDATE;
         EDIT_NOTIFY_PARENT(es, EN_UPDATE);
     }
-    NtUserInvalidateRect(es->hwndSelf, rc, bErase);
+    InvalidateRect(es->hwndSelf, rc, bErase);
 }
 
 /********************************************************************
index bb91d5d..c213afe 100644 (file)
@@ -396,7 +396,7 @@ static LRESULT LISTBOX_SetTopItem( LB_DESCR *descr, INT index, BOOL scroll )
         else
             scroll = FALSE;
     }
-    if (!scroll) NtUserInvalidateRect( descr->self, NULL, TRUE );
+    if (!scroll) InvalidateRect( descr->self, NULL, TRUE );
     descr->top_item = index;
     LISTBOX_UpdateScroll( descr );
     return LB_OKAY;
@@ -418,7 +418,7 @@ static void LISTBOX_UpdatePage( LB_DESCR *descr )
     if (page_size == descr->page_size) return;
     descr->page_size = page_size;
     if (descr->style & LBS_MULTICOLUMN)
-        NtUserInvalidateRect( descr->self, NULL, TRUE );
+        InvalidateRect( descr->self, NULL, TRUE );
     LISTBOX_SetTopItem( descr, descr->top_item, FALSE );
 }
 
@@ -473,7 +473,7 @@ static void LISTBOX_UpdateSize( LB_DESCR *descr )
     /* Invalidate the focused item so it will be repainted correctly */
     if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1)
     {
-        NtUserInvalidateRect( descr->self, &rect, FALSE );
+        InvalidateRect( descr->self, &rect, FALSE );
     }
 }
 
@@ -702,7 +702,7 @@ static void LISTBOX_SetRedraw( LB_DESCR *descr, BOOL on )
         descr->style &= ~LBS_NOREDRAW;
         if (descr->style & LBS_DISPLAYCHANGED)
         {     /* page was changed while setredraw false, refresh automatically */
-            NtUserInvalidateRect(descr->self, NULL, TRUE);
+            InvalidateRect(descr->self, NULL, TRUE);
             if ((descr->top_item + descr->page_size) > descr->nb_items)
             {      /* reset top of page if less than number of items/page */
                 descr->top_item = descr->nb_items - descr->page_size;
@@ -1240,14 +1240,14 @@ static void LISTBOX_InvalidateItems( LB_DESCR *descr, INT index )
             return;
         }
         rect.bottom = descr->height;
-        NtUserInvalidateRect( descr->self, &rect, TRUE );
+        InvalidateRect( descr->self, &rect, TRUE );
         if (descr->style & LBS_MULTICOLUMN)
         {
             /* Repaint the other columns */
             rect.left  = rect.right;
             rect.right = descr->width;
             rect.top   = 0;
-            NtUserInvalidateRect( descr->self, &rect, TRUE );
+            InvalidateRect( descr->self, &rect, TRUE );
         }
     }
 }
@@ -1257,7 +1257,7 @@ static void LISTBOX_InvalidateItemRect( LB_DESCR *descr, INT index )
     RECT rect;
 
     if (LISTBOX_GetItemRect( descr, index, &rect ) == 1)
-        NtUserInvalidateRect( descr->self, &rect, TRUE );
+        InvalidateRect( descr->self, &rect, TRUE );
 }
 
 /***********************************************************************
@@ -1308,7 +1308,7 @@ static LRESULT LISTBOX_SetItemHeight( LB_DESCR *descr, INT index, INT height, BO
         LISTBOX_UpdatePage( descr );
         LISTBOX_UpdateScroll( descr );
        if (repaint)
-           NtUserInvalidateRect( descr->self, 0, TRUE );
+           InvalidateRect( descr->self, 0, TRUE );
     }
     return LB_OKAY;
 }
@@ -1333,12 +1333,12 @@ static void LISTBOX_SetHorizontalPos( LB_DESCR *descr, INT pos )
         RECT rect;
         /* Invalidate the focused item so it will be repainted correctly */
         if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) == 1)
-            NtUserInvalidateRect( descr->self, &rect, TRUE );
+            InvalidateRect( descr->self, &rect, TRUE );
         ScrollWindowEx( descr->self, diff, 0, NULL, NULL, 0, NULL,
                           SW_INVALIDATE | SW_ERASE | SW_SCROLLCHILDREN );
     }
     else
-        NtUserInvalidateRect( descr->self, NULL, TRUE );
+        InvalidateRect( descr->self, NULL, TRUE );
 }
 
 
@@ -2719,7 +2719,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
     case LB_RESETCONTENT:
         LISTBOX_ResetContent( descr );
         LISTBOX_UpdateScroll( descr );
-        NtUserInvalidateRect( descr->self, NULL, TRUE );
+        InvalidateRect( descr->self, NULL, TRUE );
         return 0;
 
 #ifndef __REACTOS__
@@ -3256,7 +3256,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
         return LISTBOX_Destroy( descr );
 
     case WM_ENABLE:
-        NtUserInvalidateRect( hwnd, NULL, TRUE );
+        InvalidateRect( hwnd, NULL, TRUE );
         return 0;
 
     case WM_SETREDRAW:
@@ -3282,7 +3282,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg,
         return (LRESULT)descr->font;
     case WM_SETFONT:
         LISTBOX_SetFont( descr, (HFONT)wParam );
-        if (lParam) NtUserInvalidateRect( hwnd, 0, TRUE );
+        if (lParam) InvalidateRect( hwnd, 0, TRUE );
         return 0;
     case WM_SETFOCUS:
         descr->in_focus = TRUE;
index ca3fb1d..331574a 100644 (file)
@@ -1358,7 +1358,7 @@ ScrollBarWndProc(WNDPROC DefWindowProc, HWND Wnd, UINT Msg, WPARAM wParam, LPARA
               Rect.bottom = Rect.top + ThumbSize;
             }
           HideCaret(Wnd);
-          NtUserInvalidateRect(Wnd, &Rect, FALSE);
+          InvalidateRect(Wnd, &Rect, FALSE);
           DestroyCaret();
         }
         break;
index 0d42af6..9b00ecc 100644 (file)
@@ -498,3 +498,8 @@ SetCapture(HWND hWnd)
     return(NtUserSetCapture(hWnd));
 }
 
+EXTINLINE BOOL WINAPI
+InvalidateRect(HWND hWnd, CONST RECT* lpRect, BOOL bErase)
+{
+    return NtUserInvalidateRect(hWnd, lpRect, bErase);
+}
index 1d53d24..b03ad58 100644 (file)
@@ -228,5 +228,7 @@ extern PUSER_HANDLE_ENTRY gHandleEntries;
 PUSER_HANDLE_ENTRY FASTCALL GetUser32Handle(HANDLE);
 PVOID FASTCALL ValidateHandle(HANDLE, UINT);
 
+#define SYSCOLOR_GetPen(index) GetSysColorPen(index)
+
 #endif
 /* EOF */