[Bf-blender-cvs] [dd79a715c98] master: Merge branch 'blender-v2.92-release'

Nicholas Rishel noreply at git.blender.org
Tue Feb 16 08:29:10 CET 2021


Commit: dd79a715c98147dd1603b867502d3d8a0c8ca777
Author: Nicholas Rishel
Date:   Mon Feb 15 23:27:21 2021 -0800
Branches: master
https://developer.blender.org/rBdd79a715c98147dd1603b867502d3d8a0c8ca777

Merge branch 'blender-v2.92-release'

# Conflicts:
#	intern/ghost/intern/GHOST_SystemWin32.cpp
#	intern/ghost/intern/GHOST_WindowWin32.cpp
#	intern/ghost/intern/GHOST_WindowWin32.h

===================================================================



===================================================================

diff --cc intern/ghost/intern/GHOST_WindowWin32.cpp
index 2de86ff21fb,f443fc3153f..1a4ed753112
--- a/intern/ghost/intern/GHOST_WindowWin32.cpp
+++ b/intern/ghost/intern/GHOST_WindowWin32.cpp
@@@ -88,46 -86,97 +86,51 @@@ GHOST_WindowWin32::GHOST_WindowWin32(GH
        m_fpGetPointerInfoHistory(NULL),
        m_fpGetPointerPenInfoHistory(NULL),
        m_fpGetPointerTouchInfoHistory(NULL),
 -      m_parentWindowHwnd(parentwindow ? parentwindow->m_hWnd : NULL),
 +      m_parentWindowHwnd(parentwindow ? parentwindow->m_hWnd : HWND_DESKTOP),
        m_debug_context(is_debug)
  {
 +  wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
 +  RECT win_rect = {left, top, (long)(left + width), (long)(top + height)};
 +  RECT parent_rect = {0, 0, 0, 0};
++
+   // Initialize tablet variables
+   memset(&m_wintab, 0, sizeof(m_wintab));
+   m_tabletData = GHOST_TABLET_DATA_NONE;
+ 
 -  // Create window
 -  if (state != GHOST_kWindowStateFullScreen) {
 -    RECT rect;
 -    MONITORINFO monitor;
 -    GHOST_TUns32 tw, th;
 -
 -#ifndef _MSC_VER
 -    int cxsizeframe = GetSystemMetrics(SM_CXSIZEFRAME);
 -    int cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
 -#else
 -    // MSVC 2012+ returns bogus values from GetSystemMetrics, bug in Windows
 -    // http://connect.microsoft.com/VisualStudio/feedback/details/753224/regression-getsystemmetrics-delivers-different-values
 -    RECT cxrect = {0, 0, 0, 0};
 -    AdjustWindowRectEx(
 -        &cxrect, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_DLGFRAME, FALSE, 0);
 -
 -    int cxsizeframe = abs(cxrect.bottom);
 -    int cysizeframe = abs(cxrect.left);
 -#endif
 -
 -    width += cxsizeframe * 2;
 -    height += cysizeframe * 2 + GetSystemMetrics(SM_CYCAPTION);
 +  if (parentwindow) {
 +    GetWindowRect(m_parentWindowHwnd, &parent_rect);
 +  }
  
 -    rect.left = left;
 -    rect.right = left + width;
 -    rect.top = top;
 -    rect.bottom = top + height;
 +  DWORD style = parentwindow ?
 +                    WS_POPUPWINDOW | WS_CAPTION | WS_MAXIMIZEBOX | WS_MINIMIZEBOX | WS_SIZEBOX :
 +                    WS_OVERLAPPEDWINDOW;
  
 -    monitor.cbSize = sizeof(monitor);
 -    monitor.dwFlags = 0;
 +  if (state == GHOST_kWindowStateFullScreen) {
 +    style |= WS_MAXIMIZE;
 +  }
  
 -    // take taskbar into account
 -    GetMonitorInfo(MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST), &monitor);
 +  /* Forces owned windows onto taskbar and allows minimization. */
 +  DWORD extended_style = parentwindow ? WS_EX_APPWINDOW : 0;
  
 -    th = monitor.rcWork.bottom - monitor.rcWork.top;
 -    tw = monitor.rcWork.right - monitor.rcWork.left;
 +  /* Monitor details. */
 +  MONITORINFOEX monitor;
 +  monitor.cbSize = sizeof(MONITORINFOEX);
 +  monitor.dwFlags = 0;
 +  GetMonitorInfo(
 +      MonitorFromRect(parentwindow ? &parent_rect : &win_rect, MONITOR_DEFAULTTONEAREST),
 +      &monitor);
  
 -    if (tw < width) {
 -      width = tw;
 -      left = monitor.rcWork.left;
 -    }
 -    else if (monitor.rcWork.right < left + (int)width)
 -      left = monitor.rcWork.right - width;
 -    else if (left < monitor.rcWork.left)
 -      left = monitor.rcWork.left;
 -
 -    if (th < height) {
 -      height = th;
 -      top = monitor.rcWork.top;
 -    }
 -    else if (monitor.rcWork.bottom < top + (int)height)
 -      top = monitor.rcWork.bottom - height;
 -    else if (top < monitor.rcWork.top)
 -      top = monitor.rcWork.top;
 -
 -    int wintype = WS_OVERLAPPEDWINDOW;
 -    if ((m_parentWindowHwnd != 0) && !dialog) {
 -      wintype = WS_CHILD;
 -      GetWindowRect(m_parentWindowHwnd, &rect);
 -      left = 0;
 -      top = 0;
 -      width = rect.right - rect.left;
 -      height = rect.bottom - rect.top;
 -    }
 +  /* Adjust our requested size to allow for caption and borders and constrain to monitor. */
 +  AdjustWindowRectEx(&win_rect, WS_CAPTION, FALSE, 0);
 +  width = min(monitor.rcWork.right - monitor.rcWork.left, win_rect.right - win_rect.left);
 +  left = min(max(monitor.rcWork.left, win_rect.left), monitor.rcWork.right - width);
 +  height = min(monitor.rcWork.bottom - monitor.rcWork.top, win_rect.bottom - win_rect.top);
 +  top = min(max(monitor.rcWork.top, win_rect.top), monitor.rcWork.bottom - height);
  
 -    wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
 -    m_hWnd = ::CreateWindowW(s_windowClassName,                // pointer to registered class name
 -                             title_16,                         // pointer to window name
 -                             wintype,                          // window style
 -                             left,                             // horizontal position of window
 -                             top,                              // vertical position of window
 -                             width,                            // window width
 -                             height,                           // window height
 -                             dialog ? 0 : m_parentWindowHwnd,  // handle to parent or owner window
 -                             0,                     // handle to menu or child-window identifier
 -                             ::GetModuleHandle(0),  // handle to application instance
 -                             0);                    // pointer to window-creation data
 -    free(title_16);
 -  }
 -  else {
 -    wchar_t *title_16 = alloc_utf16_from_8((char *)title, 0);
 -    m_hWnd = ::CreateWindowW(s_windowClassName,     // pointer to registered class name
 +  m_hWnd = ::CreateWindowExW(extended_style,        // window extended style
 +                             s_windowClassName,     // pointer to registered class name
                               title_16,              // pointer to window name
 -                             WS_MAXIMIZE,           // window style
 +                             style,                 // window style
                               left,                  // horizontal position of window
                               top,                   // vertical position of window
                               width,                 // window width
diff --cc intern/ghost/intern/GHOST_WindowWin32.h
index 12eed243438,c65f6a3319f..71c97091189
--- a/intern/ghost/intern/GHOST_WindowWin32.h
+++ b/intern/ghost/intern/GHOST_WindowWin32.h
@@@ -600,51 -552,29 +554,29 @@@ class GHOST_WindowWin32 : public GHOST_
    static const wchar_t *s_windowClassName;
    static const int s_maxTitleLength;
  
+   /** Tablet data for GHOST */
+   GHOST_TabletData m_tabletData;
+ 
    /* Wintab API */
    struct {
 -    /** WinTab dll handle */
 -    HMODULE handle;
 +    /** WinTab DLL handle. */
 +    HMODULE handle = NULL;
  
      /** API functions */
-     GHOST_WIN32_WTInfo info = NULL;
-     GHOST_WIN32_WTGet get = NULL;
-     GHOST_WIN32_WTSet set = NULL;
-     GHOST_WIN32_WTOpen open = NULL;
-     GHOST_WIN32_WTClose close = NULL;
-     GHOST_WIN32_WTPacketsGet packetsGet = NULL;
-     GHOST_WIN32_WTQueueSizeGet queueSizeGet = NULL;
-     GHOST_WIN32_WTQueueSizeSet queueSizeSet = NULL;
-     GHOST_WIN32_WTEnable enable = NULL;
-     GHOST_WIN32_WTOverlap overlap = NULL;
- 
-     /** Stores the Tablet context if detected Tablet features using WinTab.dll. */
-     HCTX context = NULL;
-     /** Number of connected Wintab digitizers. */
-     UINT numDevices = 0;
-     /** Pressed button map. */
-     GHOST_TUns8 buttons = 0;
-     LONG maxPressure = 0;
-     LONG maxAzimuth = 0, maxAltitude = 0;
-     /** Reusable buffer to read in Wintab Packets. */
-     std::vector<PACKET> pkts;
+     GHOST_WIN32_WTInfo info;
+     GHOST_WIN32_WTOpen open;
+     GHOST_WIN32_WTClose close;
+     GHOST_WIN32_WTPacket packet;
+     GHOST_WIN32_WTEnable enable;
+     GHOST_WIN32_WTOverlap overlap;
+ 
+     /** Stores the Tablet context if detected Tablet features using WinTab.dll */
+     HCTX tablet;
+     LONG maxPressure;
+     LONG maxAzimuth, maxAltitude;
+     UINT numDevices;
    } m_wintab;
  
-   /** Most recent tablet data. */
-   GHOST_TabletData lastTabletData = GHOST_TABLET_DATA_NONE;
- 
-   /**
-    * Wintab setup.
-    */
-   void initializeWintab();
- 
-   /**
-    * Convert Wintab system mapped (mouse) buttons into Ghost button mask.
-    * \param cursor: The Wintab cursor associated to the button.
-    * \param physicalButton: The physical button ID to inspect.
-    * \return The system mapped button.
-    */
-   GHOST_TButtonMask wintabMouseToGhost(UINT cursor, WORD physicalButton);
- 
    GHOST_TWindowState m_normal_state;
  
    /** user32 dll handle*/



More information about the Bf-blender-cvs mailing list