Revert commit, add proper code
This commit is contained in:
parent
61fe48941e
commit
70fe69af8c
|
@ -26,7 +26,7 @@
|
|||
#include <vector>
|
||||
|
||||
#if DISTRHO_OS_LINUX
|
||||
# include <X11/Xlib.h>
|
||||
# include "pugl/pugl_x11.h"
|
||||
#endif
|
||||
|
||||
START_NAMESPACE_DISTRHO
|
||||
|
@ -660,7 +660,7 @@ public:
|
|||
OpenGLDialog(PuglView* parentView, const Size& parentSize, const Image& image_, const char* title)
|
||||
: image(image_)
|
||||
{
|
||||
#if 0 //DISTRHO_OS_LINUX
|
||||
#if DISTRHO_OS_LINUX
|
||||
bool addToDesktop = false;
|
||||
#else
|
||||
bool addToDesktop = true;
|
||||
|
@ -682,10 +682,11 @@ public:
|
|||
puglSetReshapeFunc(view, onReshapeCallback);
|
||||
puglSetCloseFunc(view, onCloseCallback);
|
||||
|
||||
#if 0 //DISTRHO_OS_LINUX
|
||||
Display* display = view->impl->display;
|
||||
Window thisWindow = view->impl->win;
|
||||
Window parentWindow = parentView->impl->win;
|
||||
#if DISTRHO_OS_LINUX
|
||||
PuglInternals* impl = puglGetInternalsImpl(view);
|
||||
Display* display = impl->display;
|
||||
Window thisWindow = impl->win;
|
||||
Window parentWindow = puglGetInternalsImpl(parentView)->win;
|
||||
|
||||
int x = (parentSize.getWidth()-image.getWidth())/2;
|
||||
int y = (parentSize.getHeight()-image.getHeight())/2;
|
||||
|
@ -722,9 +723,10 @@ public:
|
|||
{
|
||||
if (view)
|
||||
{
|
||||
#if 0 //DISTRHO_OS_LINUX
|
||||
Display* display = view->impl->display;
|
||||
Window window = view->impl->win;
|
||||
#if DISTRHO_OS_LINUX
|
||||
PuglInternals* impl = puglGetInternalsImpl(view);
|
||||
Display* display = impl->display;
|
||||
Window window = impl->win;
|
||||
XRaiseWindow(display, window);
|
||||
XSetInputFocus(display, window, RevertToPointerRoot, CurrentTime);
|
||||
#endif
|
||||
|
@ -841,7 +843,7 @@ enum ObjectType {
|
|||
OBJECT_SLIDER = 3
|
||||
};
|
||||
|
||||
#if 0 //DISTRHO_OS_LINUX
|
||||
#if DISTRHO_OS_LINUX
|
||||
struct LinuxData {
|
||||
Display* display;
|
||||
Window window;
|
||||
|
@ -879,7 +881,7 @@ struct OpenGLExtUIPrivateData {
|
|||
std::vector<ImageSlider*> sliders;
|
||||
OpenGLDialog* dialog;
|
||||
|
||||
#if 0 //DISTRHO_OS_LINUX
|
||||
#if DISTRHO_OS_LINUX
|
||||
LinuxData linuxData;
|
||||
#endif
|
||||
|
||||
|
@ -896,7 +898,7 @@ struct OpenGLExtUIPrivateData {
|
|||
|
||||
void showCursor()
|
||||
{
|
||||
#if 0 //DISTRHO_OS_LINUX
|
||||
#if DISTRHO_OS_LINUX
|
||||
if (lastCursorPos != Point(-1, -2))
|
||||
XWarpPointer(linuxData.display, None, DefaultRootWindow(linuxData.display), 0, 0, 0, 0, lastCursorPos.getX(), lastCursorPos.getY());
|
||||
|
||||
|
@ -906,7 +908,7 @@ struct OpenGLExtUIPrivateData {
|
|||
|
||||
void hideCursor()
|
||||
{
|
||||
#if 0 //DISTRHO_OS_LINUX
|
||||
#if DISTRHO_OS_LINUX
|
||||
Window root, child;
|
||||
int rootX, rootY, winX, winY;
|
||||
unsigned int mask;
|
||||
|
@ -1022,9 +1024,10 @@ void OpenGLExtUI::d_onInit()
|
|||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
#if 0 //DISTRHO_OS_LINUX
|
||||
data->linuxData.display = OpenGLUI::data->widget->impl->display;
|
||||
data->linuxData.window = OpenGLUI::data->widget->impl->win;
|
||||
#if DISTRHO_OS_LINUX
|
||||
PuglInternals* dataImpl = puglGetInternalsImpl(OpenGLUI::data->widget);
|
||||
data->linuxData.display = dataImpl->display;
|
||||
data->linuxData.window = dataImpl->win;
|
||||
data->linuxData.pixmapBlack = XCreateBitmapFromData(data->linuxData.display, data->linuxData.window, data->linuxData.colorData, 8, 8);
|
||||
data->linuxData.cursorBlack = XCreatePixmapCursor(data->linuxData.display, data->linuxData.pixmapBlack, data->linuxData.pixmapBlack,
|
||||
&data->linuxData.colorBlack, &data->linuxData.colorBlack, 0, 0);
|
||||
|
|
|
@ -227,7 +227,7 @@ puglCreate(PuglNativeWindow parent,
|
|||
int height,
|
||||
bool resizable,
|
||||
bool addToDesktop = true,
|
||||
long* x11Display = NULL);
|
||||
const char* x11Display = NULL);
|
||||
|
||||
/**
|
||||
Set the handle to be passed to all callbacks.
|
||||
|
|
|
@ -229,7 +229,7 @@ puglCreate(PuglNativeWindow parent,
|
|||
int height,
|
||||
bool resizable,
|
||||
bool addToDesktop,
|
||||
long* x11Display)
|
||||
const char* x11Display)
|
||||
{
|
||||
PuglView* view = (PuglView*)calloc(1, sizeof(PuglView));
|
||||
PuglInternals* impl = (PuglInternals*)calloc(1, sizeof(PuglInternals));
|
||||
|
|
|
@ -47,7 +47,7 @@ puglCreate(PuglNativeWindow parent,
|
|||
int height,
|
||||
bool resizable,
|
||||
bool addToDesktop,
|
||||
long* x11Display)
|
||||
const char* x11Display)
|
||||
{
|
||||
PuglView* view = (PuglView*)calloc(1, sizeof(PuglView));
|
||||
PuglInternals* impl = (PuglInternals*)calloc(1, sizeof(PuglInternals));
|
||||
|
|
|
@ -23,22 +23,9 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
#include "pugl_x11.h"
|
||||
#include "pugl_internal.h"
|
||||
|
||||
struct PuglInternalsImpl {
|
||||
Display* display;
|
||||
int screen;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
Bool doubleBuffered;
|
||||
};
|
||||
|
||||
/**
|
||||
Attributes for single-buffered RGBA with at least
|
||||
4 bits per color and a 16 bit depth buffer.
|
||||
|
@ -72,7 +59,7 @@ puglCreate(PuglNativeWindow parent,
|
|||
int height,
|
||||
bool resizable,
|
||||
bool addToDesktop,
|
||||
long* x11Display)
|
||||
const char* x11Display)
|
||||
{
|
||||
PuglView* view = (PuglView*)calloc(1, sizeof(PuglView));
|
||||
PuglInternals* impl = (PuglInternals*)calloc(1, sizeof(PuglInternals));
|
||||
|
@ -84,7 +71,7 @@ puglCreate(PuglNativeWindow parent,
|
|||
view->width = width;
|
||||
view->height = height;
|
||||
|
||||
impl->display = XOpenDisplay(x11Display ? *x11Display : 0);
|
||||
impl->display = XOpenDisplay(x11Display);
|
||||
impl->screen = DefaultScreen(impl->display);
|
||||
|
||||
XVisualInfo* vi = glXChooseVisual(impl->display, impl->screen, attrListDbl);
|
||||
|
@ -384,3 +371,9 @@ puglGetNativeWindow(PuglView* view)
|
|||
{
|
||||
return view->impl->win;
|
||||
}
|
||||
|
||||
PuglInternals*
|
||||
puglGetInternalsImpl(PuglView* view)
|
||||
{
|
||||
return view->impl;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
Copyright 2012 David Robillard <http://drobilla.net>
|
||||
Copyright 2011-2012 Ben Loftis, Harrison Consoles
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/**
|
||||
@file pugl_x11.h X11 Pugl Implementation (PuglInternalsImpl only).
|
||||
*/
|
||||
|
||||
#include "pugl.h"
|
||||
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/Xatom.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
struct PuglInternalsImpl {
|
||||
Display* display;
|
||||
int screen;
|
||||
Window win;
|
||||
GLXContext ctx;
|
||||
Bool doubleBuffered;
|
||||
};
|
||||
|
||||
typedef struct PuglInternalsImpl PuglInternals;
|
||||
|
||||
PuglInternals*
|
||||
puglGetInternalsImpl(PuglView* view);
|
Loading…
Reference in New Issue