View | Details | Raw Unified | Return to bug 10472 | Differences between
and this patch

Collapse All | Expand All

(-)a/hw/xwin/Makefile.am (+1 lines)
Lines 107-112 SRCS = InitInput.c \ Link Here
107
	winvalargs.c \
107
	winvalargs.c \
108
	winwakeup.c \
108
	winwakeup.c \
109
	winwindow.c \
109
	winwindow.c \
110
	winwindowedwindow.c \
110
	winwndproc.c \
111
	winwndproc.c \
111
	ddraw.h \
112
	ddraw.h \
112
	winclipboard.h \
113
	winclipboard.h \
(-)a/hw/xwin/glx/winpriv.c (-21 / +94 lines)
Lines 47-52 winCreateWindowsWindowHierarchy(WindowPtr pWin) Link Here
47
    }
47
    }
48
}
48
}
49
49
50
static
51
void
52
winCreateWindowedWindow(WindowPtr pWin, winPrivScreenPtr pWinScreen)
53
{
54
  winWindowPriv(pWin);
55
56
  // create window class if needed
57
#define WIN_GL_WINDOW_CLASS "cygwin/x X child GL window"
58
  {
59
    static wATOM glChildWndClass = 0;
60
    if (glChildWndClass == 0)
61
      {
62
        WNDCLASSEX wc;
63
        wc.cbSize = sizeof(WNDCLASSEX);
64
        wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
65
        wc.lpfnWndProc = DefWindowProc;
66
        wc.cbClsExtra = 0;
67
        wc.cbWndExtra = 0;
68
        wc.hInstance = GetModuleHandle(NULL);
69
        wc.hIcon = 0;
70
        wc.hCursor = 0;
71
        wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH);
72
        wc.lpszMenuName = NULL;
73
        wc.lpszClassName = WIN_GL_WINDOW_CLASS;
74
        wc.hIconSm = 0;
75
        RegisterClassEx (&wc);
76
      }
77
  }
78
79
  // ensure this window exists */
80
  if (pWinPriv->hWnd == NULL)
81
    {
82
      int ExtraClass = (pWin->realized) ? WS_VISIBLE : 0;
83
      pWinPriv->hWnd = CreateWindowExA(WS_EX_TRANSPARENT,
84
                                       WIN_GL_WINDOW_CLASS,
85
                                       "",
86
                                       WS_CHILD | WS_CLIPSIBLINGS | WS_CLIPCHILDREN  | WS_DISABLED | ExtraClass,
87
                                       pWin->drawable.x,
88
                                       pWin->drawable.y,
89
                                       pWin->drawable.width,
90
                                       pWin->drawable.height,
91
                                       pWinScreen->hwndScreen,
92
                                       (HMENU) NULL,
93
                                       g_hInstance,
94
                                       NULL);
95
    }
96
}
97
50
/**
98
/**
51
 * Return size and handles of a window.
99
 * Return size and handles of a window.
52
 * If pWin is NULL, then the information for the root window is requested.
100
 * If pWin is NULL, then the information for the root window is requested.
Lines 62-68 HWND winGetWindowInfo(WindowPtr pWin) Link Here
62
        ScreenPtr pScreen = pWin->drawable.pScreen;
110
        ScreenPtr pScreen = pWin->drawable.pScreen;
63
        winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
111
        winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
64
        winScreenInfoPtr pScreenInfo = NULL;
112
        winScreenInfoPtr pScreenInfo = NULL;
65
        HWND hwnd = NULL;
66
113
67
        if (pWinScreen == NULL)
114
        if (pWinScreen == NULL)
68
        {
115
        {
Lines 70-90 HWND winGetWindowInfo(WindowPtr pWin) Link Here
70
            return NULL;
117
            return NULL;
71
        }
118
        }
72
119
73
        hwnd = pWinScreen->hwndScreen;
120
        winWindowPriv(pWin);
121
        if (pWinPriv == NULL)
122
          {
123
            ErrorF("winGetWindowInfo: window has no privates\n");
124
            return pWinScreen->hwndScreen;
125
          }
74
126
75
        pScreenInfo = pWinScreen->pScreenInfo;
127
        pScreenInfo = pWinScreen->pScreenInfo;
76
#ifdef XWIN_MULTIWINDOW
128
#ifdef XWIN_MULTIWINDOW
77
        /* check for multiwindow mode */
129
        /* check for multiwindow mode */
78
        if (pScreenInfo->fMultiWindow)
130
        if (pScreenInfo->fMultiWindow)
79
        {
131
        {
80
            winWindowPriv(pWin);
81
82
            if (pWinPriv == NULL)
83
            {
84
                ErrorF("winGetWindowInfo: window has no privates\n");
85
                return hwnd;
86
            }
87
88
            if (pWinPriv->hWnd == NULL)
132
            if (pWinPriv->hWnd == NULL)
89
            {
133
            {
90
              ErrorF("winGetWindowInfo: forcing window to exist\n");
134
              ErrorF("winGetWindowInfo: forcing window to exist\n");
Lines 93-107 HWND winGetWindowInfo(WindowPtr pWin) Link Here
93
137
94
            if (pWinPriv->hWnd != NULL)
138
            if (pWinPriv->hWnd != NULL)
95
              {
139
              {
96
                /* copy window handle */
97
                hwnd = pWinPriv->hWnd;
98
99
                /* mark GLX active on that hwnd */
140
                /* mark GLX active on that hwnd */
100
                pWinPriv->fWglUsed = TRUE;
141
                pWinPriv->fWglUsed = TRUE;
101
              }
142
              }
102
143
103
            return hwnd;
144
            return pWinPriv->hWnd;
104
        }
145
        }
146
        else
105
#endif
147
#endif
106
#ifdef XWIN_MULTIWINDOWEXTWM
148
#ifdef XWIN_MULTIWINDOWEXTWM
107
        /* check for multiwindow external wm mode */
149
        /* check for multiwindow external wm mode */
Lines 110-128 HWND winGetWindowInfo(WindowPtr pWin) Link Here
110
            win32RootlessWindowPtr pRLWinPriv
152
            win32RootlessWindowPtr pRLWinPriv
111
                = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
153
                = (win32RootlessWindowPtr) RootlessFrameForWindow (pWin, FALSE);
112
154
113
            if (pRLWinPriv == NULL) {
155
            if (pRLWinPriv == NULL)
156
            {
114
                ErrorF("winGetWindowInfo: window has no privates\n");
157
                ErrorF("winGetWindowInfo: window has no privates\n");
115
                return hwnd;
158
                return pWinScreen->hwndScreen;
116
            }
159
            }
117
160
118
            if (pRLWinPriv->hWnd != NULL)
161
            return pRLWinPriv->hWnd;
162
        }
163
        else
164
#endif
165
        /* check for windowed mode */
166
        if (TRUE
167
#ifdef XWIN_MULTIWINDOW
168
	      && !pScreenInfo->fMultiWindow
169
#endif
170
#ifdef XWIN_MULTIWINDOWEXTWM
171
	      && !pScreenInfo->fMWExtWM
172
#endif
173
	      && !pScreenInfo->fRootless)
174
        {
175
          if (pWinPriv->hWnd == NULL)
176
            {
177
              winCreateWindowedWindow(pWin, pWinScreen);
178
            }
179
180
          if (pWinPriv->hWnd != NULL)
119
            {
181
            {
120
                /* copy window handle */
182
              /* mark GLX active on that hwnd */
121
                hwnd = pRLWinPriv->hWnd;
183
              pWinPriv->fWglUsed = TRUE;
122
            }
184
            }
123
            return hwnd;
185
186
          return pWinPriv->hWnd;
124
        }
187
        }
125
#endif
126
    }
188
    }
127
    else
189
    else
128
    {
190
    {
Lines 159-163 winCheckScreenAiglxIsSupported(ScreenPtr pScreen) Link Here
159
    return TRUE;
221
    return TRUE;
160
#endif
222
#endif
161
223
224
  if (TRUE
225
#ifdef XWIN_MULTIWINDOW
226
      && !pScreenInfo->fMultiWindow
227
#endif
228
#ifdef XWIN_MULTIWINDOWEXTWM
229
      && !pScreenInfo->fMWExtWM
230
#endif
231
      && !pScreenInfo->fRootless)
232
    return TRUE;
233
162
  return FALSE;
234
  return FALSE;
235
  /* I think that adds up to return !pScreenInfo->fRootless :-)  */
163
}
236
}
(-)a/hw/xwin/win.h (+12 lines)
Lines 1310-1315 int Link Here
1310
winAdjustXWindow (WindowPtr pWin, HWND hwnd);
1310
winAdjustXWindow (WindowPtr pWin, HWND hwnd);
1311
#endif
1311
#endif
1312
1312
1313
/*
1314
 * winwindowedwindow.c
1315
 */
1316
Bool
1317
winMapWindowWindowed (WindowPtr pWin);
1318
1319
Bool
1320
winPositionWindowWindowed (WindowPtr pWin, int x, int y);
1321
1322
Bool
1323
winDestroyWindowWindowed (WindowPtr pWin);
1324
1313
1325
1314
#ifdef XWIN_MULTIWINDOW
1326
#ifdef XWIN_MULTIWINDOW
1315
/*
1327
/*
(-)a/hw/xwin/winscrinit.c (-21 / +32 lines)
Lines 459-468 winFinishScreenInitFB (int index, Link Here
459
    }
459
    }
460
#endif
460
#endif
461
461
462
  /* Handle rootless mode */
462
  /* Define the WRAP macro temporarily for local use */
463
  if (pScreenInfo->fRootless)
464
    {
465
      /* Define the WRAP macro temporarily for local use */
466
#define WRAP(a) \
463
#define WRAP(a) \
467
    if (pScreen->a) { \
464
    if (pScreen->a) { \
468
        pScreenPriv->a = pScreen->a; \
465
        pScreenPriv->a = pScreen->a; \
Lines 471-476 winFinishScreenInitFB (int index, Link Here
471
        pScreenPriv->a = NULL; \
468
        pScreenPriv->a = NULL; \
472
    }
469
    }
473
470
471
  /* Handle rootless mode */
472
  if (pScreenInfo->fRootless)
473
    {
474
      /* Save a pointer to each lower-level window procedure */
474
      /* Save a pointer to each lower-level window procedure */
475
      WRAP(CreateWindow);
475
      WRAP(CreateWindow);
476
      WRAP(DestroyWindow);
476
      WRAP(DestroyWindow);
Lines 488-512 winFinishScreenInitFB (int index, Link Here
488
      pScreen->RealizeWindow = winMapWindowRootless;
488
      pScreen->RealizeWindow = winMapWindowRootless;
489
      pScreen->UnrealizeWindow = winUnmapWindowRootless;
489
      pScreen->UnrealizeWindow = winUnmapWindowRootless;
490
      pScreen->SetShape = winSetShapeRootless;
490
      pScreen->SetShape = winSetShapeRootless;
491
492
      /* Undefine the WRAP macro, as it is not needed elsewhere */
493
#undef WRAP
494
    }
491
    }
495
496
497
#ifdef XWIN_MULTIWINDOW
492
#ifdef XWIN_MULTIWINDOW
498
  /* Handle multi window mode */
493
  /* Handle multi window mode */
499
  else if (pScreenInfo->fMultiWindow)
494
  else if (pScreenInfo->fMultiWindow)
500
    {
495
    {
501
      /* Define the WRAP macro temporarily for local use */
502
#define WRAP(a) \
503
    if (pScreen->a) { \
504
        pScreenPriv->a = pScreen->a; \
505
    } else { \
506
        winDebug("null screen fn " #a "\n"); \
507
        pScreenPriv->a = NULL; \
508
    }
509
510
      /* Save a pointer to each lower-level window procedure */
496
      /* Save a pointer to each lower-level window procedure */
511
      WRAP(CreateWindow);
497
      WRAP(CreateWindow);
512
      WRAP(DestroyWindow);
498
      WRAP(DestroyWindow);
Lines 534-544 winFinishScreenInitFB (int index, Link Here
534
      pScreen->MoveWindow = winMoveWindowMultiWindow;
520
      pScreen->MoveWindow = winMoveWindowMultiWindow;
535
      pScreen->CopyWindow = winCopyWindowMultiWindow;
521
      pScreen->CopyWindow = winCopyWindowMultiWindow;
536
      pScreen->SetShape = winSetShapeMultiWindow;
522
      pScreen->SetShape = winSetShapeMultiWindow;
537
538
      /* Undefine the WRAP macro, as it is not needed elsewhere */
539
#undef WRAP
540
    }
523
    }
541
#endif
524
#endif
525
#ifdef XWIN_MULTIWINDOWEXTWM
526
  else if (pScreenInfo->fMWExtWM)
527
    {
528
      /* Doesn't need any screen window procedures, uses rootless frame procedures */
529
    }
530
#endif
531
  else
532
    /* Handle windowed mode */
533
    {
534
      /* At the moment, only need to do something special to help WGL mdoe */
535
      if (g_fNativeGl)
536
        {
537
          /* WRAP(CreateWindow); */
538
          WRAP(DestroyWindow);
539
          WRAP(RealizeWindow);
540
          /* WRAP(UnrealizeWindow); */
541
          WRAP(PositionWindow);
542
543
          /* pScreen->CreateWindow = winCreateWindowWindowed; */
544
          pScreen->DestroyWindow = winDestroyWindowWindowed;
545
          pScreen->PositionWindow = winPositionWindowWindowed;
546
          pScreen->RealizeWindow = winMapWindowWindowed;
547
          /* pScreen->UnrealizeWindow = winUnmapWindowWindowed; */
548
        }
549
    }
550
551
  /* Undefine the WRAP macro, as it is not needed elsewhere */
552
#undef WRAP
542
553
543
  /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
554
  /* Wrap either fb's or shadow's CloseScreen with our CloseScreen */
544
  pScreenPriv->CloseScreen = pScreen->CloseScreen;
555
  pScreenPriv->CloseScreen = pScreen->CloseScreen;
(-)a/hw/xwin/winwindowedwindow.c (-1 / +114 lines)
Line 0 Link Here
0
- 
1
/*
2
  File: winwindowedwindow.c
3
  Purpose: Screen window functions for windowed mode
4
5
  Permission is hereby granted, free of charge, to any person obtaining a
6
  copy of this software and associated documentation files (the "Software"),
7
  to deal in the Software without restriction, including without limitation
8
  the rights to use, copy, modify, merge, publish, distribute, sublicense,
9
  and/or sell copies of the Software, and to permit persons to whom the
10
  Software is furnished to do so, subject to the following conditions:
11
12
  The above copyright notice and this permission notice (including the next
13
  paragraph) shall be included in all copies or substantial portions of the
14
  Software.
15
16
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19
  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21
  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22
  DEALINGS IN THE SOFTWARE.
23
*/
24
25
#ifdef HAVE_XWIN_CONFIG_H
26
#include <xwin-config.h>
27
#endif
28
#include "win.h"
29
30
/*
31
  At the moment, these only need to do do things when the window is an AIGLX
32
  window
33
*/
34
35
/*
36
 * MapWindow - See Porting Layer Definition - p. 37
37
 * Also referred to as RealizeWindow
38
 */
39
40
Bool
41
winMapWindowWindowed(WindowPtr pWin)
42
{
43
  Bool fResult = TRUE;
44
  ScreenPtr pScreen = pWin->drawable.pScreen;
45
  winWindowPriv(pWin);
46
  winScreenPriv(pScreen);
47
48
  winDebug("winMapWindowWindowed: pWin: %08x\n", pWin);
49
50
  WIN_UNWRAP(RealizeWindow);
51
  fResult =  (*pScreen->RealizeWindow)(pWin);
52
  WIN_WRAP(RealizeWindow, winMapWindowWindowed);
53
54
  /* Check if we need to show the window */
55
  if (pWinPriv->fWglUsed && pWinPriv->hWnd)
56
    ShowWindow(pWinPriv->hWnd, SW_SHOW);
57
58
  return fResult;
59
}
60
61
/*
62
 * PositionWindow - See Porting Layer Definition - p. 37
63
 */
64
65
Bool
66
winPositionWindowWindowed(WindowPtr pWin, int x, int y)
67
{
68
  Bool fResult = TRUE;
69
  ScreenPtr pScreen = pWin->drawable.pScreen;
70
  winWindowPriv(pWin);
71
  winScreenPriv(pScreen);
72
73
  WIN_UNWRAP(PositionWindow);
74
  fResult = (*pScreen->PositionWindow)(pWin, x, y);
75
  WIN_WRAP(PositionWindow, winPositionWindowWindowed);
76
77
  if (pWinPriv->fWglUsed && pWinPriv->hWnd)
78
    {
79
      MoveWindow(pWinPriv->hWnd,
80
                 pWin->drawable.x,
81
                 pWin->drawable.y,
82
                 pWin->drawable.width,
83
                 pWin->drawable.height,
84
                 FALSE);
85
    }
86
87
  return fResult;
88
}
89
90
/*
91
 * DestroyWindow - See Porting Layer Definition - p. 37
92
 */
93
94
Bool
95
winDestroyWindowWindowed(WindowPtr pWin)
96
{
97
  Bool fResult = TRUE;
98
  ScreenPtr pScreen = pWin->drawable.pScreen;
99
  winWindowPriv(pWin);
100
  winScreenPriv(pScreen);
101
102
  WIN_UNWRAP(DestroyWindow);
103
  fResult = (*pScreen->DestroyWindow)(pWin);
104
  WIN_WRAP(DestroyWindow, winDestroyWindowWindowed);
105
106
  if (pWinPriv->fWglUsed && pWinPriv->hWnd)
107
    {
108
      DestroyWindow(pWinPriv->hWnd);
109
      pWinPriv->hWnd = NULL;
110
      pWinPriv->fWglUsed = FALSE;
111
    }
112
113
  return fResult;
114
}

Return to bug 10472