Browse Source

Import X11 and Win32 code changed by Harrison

gh-pages
falkTX 10 years ago
parent
commit
7bc2a5d9ef
2 changed files with 27 additions and 5 deletions
  1. +9
    -3
      dgl/src/pugl/pugl_win.cpp
  2. +18
    -2
      dgl/src/pugl/pugl_x11.c

+ 9
- 3
dgl/src/pugl/pugl_win.cpp View File

@@ -71,7 +71,7 @@ puglCreate(PuglNativeWindow parent,
// Should class be a parameter? Does this make sense on other platforms?
static int wc_count = 0;
char classNameBuf[256];
_snprintf(classNameBuf, sizeof(classNameBuf), "%s_%d\n", title, wc_count++);
sprintf(classNameBuf, "%s_%d\n", title, wc_count++);

impl->wc.style = CS_OWNDC;
impl->wc.lpfnWndProc = wndProc;
@@ -91,6 +91,7 @@ puglCreate(PuglNativeWindow parent,
}

// Adjust the overall window size to accomodate our requested client size
// If there's any doubt that Windows is laughably outdated, here's the proof
RECT wr = { 0, 0, width, height };
AdjustWindowRectEx(&wr, winFlags, FALSE, WS_EX_TOPMOST);

@@ -145,7 +146,7 @@ puglDestroy(PuglView* view)
free(view);
}

static void
void
puglReshape(PuglView* view, int width, int height)
{
wglMakeCurrent(view->impl->hdc, view->impl->hglrc);
@@ -266,21 +267,27 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
}
break;
case WM_LBUTTONDOWN:
view->event_timestamp_ms = (GetMessageTime());
processMouseEvent(view, 1, true, lParam);
break;
case WM_MBUTTONDOWN:
view->event_timestamp_ms = (GetMessageTime());
processMouseEvent(view, 2, true, lParam);
break;
case WM_RBUTTONDOWN:
view->event_timestamp_ms = (GetMessageTime());
processMouseEvent(view, 3, true, lParam);
break;
case WM_LBUTTONUP:
view->event_timestamp_ms = (GetMessageTime());
processMouseEvent(view, 1, false, lParam);
break;
case WM_MBUTTONUP:
view->event_timestamp_ms = (GetMessageTime());
processMouseEvent(view, 2, false, lParam);
break;
case WM_RBUTTONUP:
view->event_timestamp_ms = (GetMessageTime());
processMouseEvent(view, 3, false, lParam);
break;
case WM_MOUSEWHEEL:
@@ -331,7 +338,6 @@ puglProcessEvents(PuglView* view)
handleMessage(view, msg.message, msg.wParam, msg.lParam);
}


if (view->redisplay) {
InvalidateRect(view->impl->hwnd, NULL, FALSE);
}


+ 18
- 2
dgl/src/pugl/pugl_x11.c View File

@@ -163,6 +163,21 @@ puglCreate(PuglNativeWindow parent,
XSetWMProtocols(impl->display, impl->win, &wmDelete, 1);
}

#if 0
if (true) { // stay on top
Atom type = XInternAtom(impl->display, "_NET_WM_STATE_ABOVE", False);
XChangeProperty(impl->display,
impl->win,
XInternAtom(impl->display, "_NET_WM_STATE", False),
XInternAtom(impl->display, "ATOM", False),
32,
PropModeReplace,
(unsigned char *)&type,
1
);
}
#endif

if (visible) {
XMapRaised(impl->display, impl->win);
}
@@ -170,6 +185,7 @@ puglCreate(PuglNativeWindow parent,
if (glXIsDirect(impl->display, impl->ctx)) {
#ifdef VERBOSE_PUGL
printf("puGL: DRI enabled\n");
printf("If you have drawing issues, try setting LIBGL_ALWAYS_INDIRECT=1 in your environment.\n" );
#endif
} else {
#ifdef VERBOSE_PUGL
@@ -196,7 +212,7 @@ puglDestroy(PuglView* view)
free(view);
}

static void
void
puglReshape(PuglView* view, int width, int height)
{
glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx);
@@ -211,7 +227,7 @@ puglReshape(PuglView* view, int width, int height)
view->height = height;
}

static void
void
puglDisplay(PuglView* view)
{
glXMakeCurrent(view->impl->display, view->impl->win, view->impl->ctx);


Loading…
Cancel
Save