Don't #include Motif headers from src/x11/glcanvas.cpp.
prepare for using src/x11/glcanvas.cpp for wxMotif. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22130 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
9b51403d37
commit
1807c27dbc
@ -122,6 +122,7 @@ public:
|
|||||||
virtual WXWidget GetTopWidget() const;
|
virtual WXWidget GetTopWidget() const;
|
||||||
|
|
||||||
// Get the underlying X window and display
|
// Get the underlying X window and display
|
||||||
|
WXWindow GetClientXWindow() const;
|
||||||
WXWindow GetXWindow() const;
|
WXWindow GetXWindow() const;
|
||||||
WXDisplay *GetXDisplay() const;
|
WXDisplay *GetXDisplay() const;
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ wxWindow *wxWindowBase::FindFocus()
|
|||||||
// (2) The widget with the focus may not be in the widget table
|
// (2) The widget with the focus may not be in the widget table
|
||||||
// depending on which widgets I put in the table
|
// depending on which widgets I put in the table
|
||||||
wxWindow *winFocus = (wxWindow *)NULL;
|
wxWindow *winFocus = (wxWindow *)NULL;
|
||||||
for ( wxWindowList::Node *node = wxTopLevelWindows.GetFirst();
|
for ( wxWindowList::compatibility_iterator node = wxTopLevelWindows.GetFirst();
|
||||||
node;
|
node;
|
||||||
node = node->GetNext() )
|
node = node->GetNext() )
|
||||||
{
|
{
|
||||||
@ -904,7 +904,7 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
|
|||||||
wxBrush brush(GetBackgroundColour(), wxSOLID);
|
wxBrush brush(GetBackgroundColour(), wxSOLID);
|
||||||
dc.SetBrush(brush); // FIXME: needed?
|
dc.SetBrush(brush); // FIXME: needed?
|
||||||
|
|
||||||
wxWindowList::Node *cnode = m_children.GetFirst();
|
wxWindowList::compatibility_iterator cnode = m_children.GetFirst();
|
||||||
while (cnode)
|
while (cnode)
|
||||||
{
|
{
|
||||||
wxWindow *child = cnode->GetData();
|
wxWindow *child = cnode->GetData();
|
||||||
@ -1000,7 +1000,7 @@ void wxWindow::ScrollWindow(int dx, int dy, const wxRect *rect)
|
|||||||
|
|
||||||
// Now send expose events
|
// Now send expose events
|
||||||
|
|
||||||
wxList::Node* node = updateRects.GetFirst();
|
wxList::compatibility_iterator node = updateRects.GetFirst();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxRect* rect = (wxRect*) node->GetData();
|
wxRect* rect = (wxRect*) node->GetData();
|
||||||
@ -1666,7 +1666,7 @@ void wxWindow::DoPaint()
|
|||||||
// Responds to colour changes: passes event on to children.
|
// Responds to colour changes: passes event on to children.
|
||||||
void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
|
void wxWindow::OnSysColourChanged(wxSysColourChangedEvent& event)
|
||||||
{
|
{
|
||||||
wxWindowList::Node *node = GetChildren().GetFirst();
|
wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
|
||||||
while ( node )
|
while ( node )
|
||||||
{
|
{
|
||||||
// Only propagate to non-top-level windows
|
// Only propagate to non-top-level windows
|
||||||
@ -1867,6 +1867,15 @@ bool wxWindow::DetachWidget(WXWidget widget)
|
|||||||
// Motif-specific accessors
|
// Motif-specific accessors
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
WXWindow wxWindow::GetClientXWindow() const
|
||||||
|
{
|
||||||
|
Widget wMain = (Widget)GetClientWidget();
|
||||||
|
if ( wMain )
|
||||||
|
return (WXWindow) XtWindow(wMain);
|
||||||
|
else
|
||||||
|
return (WXWindow) 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Get the underlying X window
|
// Get the underlying X window
|
||||||
WXWindow wxWindow::GetXWindow() const
|
WXWindow wxWindow::GetXWindow() const
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: glcanvas.cpp
|
// Name: glcanvas.cpp
|
||||||
// Purpose: wxGLCanvas, for using OpenGL with wxWindows 2.0 for Motif.
|
// Purpose: wxGLCanvas, for using OpenGL with wxWindows
|
||||||
// Uses the GLX extension.
|
// Uses the GLX extension.
|
||||||
// Author: Julian Smart and Wolfram Gloger
|
// Author: Julian Smart and Wolfram Gloger
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
#if wxUSE_GLCANVAS
|
#if wxUSE_GLCANVAS
|
||||||
|
|
||||||
// #error Sorry, wxGLCanvas does not work yet with wxX11
|
|
||||||
|
|
||||||
#include "wx/glcanvas.h"
|
#include "wx/glcanvas.h"
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
@ -28,11 +26,20 @@
|
|||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
# pragma message disable nosimpint
|
# pragma message disable nosimpint
|
||||||
#endif
|
#endif
|
||||||
#include <Xm/Xm.h>
|
#include <X11/Xlib.h>
|
||||||
#ifdef __VMS
|
#ifdef __VMS
|
||||||
# pragma message enable nosimpint
|
# pragma message enable nosimpint
|
||||||
#endif
|
#endif
|
||||||
#include "wx/motif/private.h"
|
#include "wx/x11/private.h"
|
||||||
|
|
||||||
|
static inline WXWindow wxGetClientAreaWindow(wxWindow* win)
|
||||||
|
{
|
||||||
|
#ifdef __WXMOTIF__
|
||||||
|
return win->GetClientXWindow();
|
||||||
|
#else
|
||||||
|
return win->GetClientAreaWindow();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef OLD_MESA
|
#ifdef OLD_MESA
|
||||||
// workaround for bug in Mesa's glx.c
|
// workaround for bug in Mesa's glx.c
|
||||||
@ -111,7 +118,7 @@ void wxGLContext::SwapBuffers()
|
|||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
{
|
{
|
||||||
Display* display = (Display*) wxGetDisplay();
|
Display* display = (Display*) wxGetDisplay();
|
||||||
glXSwapBuffers(display, (Window) m_window->GetClientAreaWindow());
|
glXSwapBuffers(display, (Window) wxGetClientAreaWindow(m_window));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +127,7 @@ void wxGLContext::SetCurrent()
|
|||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
{
|
{
|
||||||
Display* display = (Display*) wxGetDisplay();
|
Display* display = (Display*) wxGetDisplay();
|
||||||
glXMakeCurrent(display, (Window) m_window->GetClientAreaWindow(),
|
glXMakeCurrent(display, (Window) wxGetClientAreaWindow(m_window),
|
||||||
m_glContext );;
|
m_glContext );;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +143,11 @@ void wxGLContext::SetColour(const char *colour)
|
|||||||
the_colour->Green(),
|
the_colour->Green(),
|
||||||
the_colour->Blue());
|
the_colour->Blue());
|
||||||
} else {
|
} else {
|
||||||
|
#ifdef __WXMOTIF__
|
||||||
|
the_colour->AllocColour(m_window->GetXDisplay());
|
||||||
|
#else
|
||||||
the_colour->CalcPixel(wxTheApp->GetMainColormap(wxGetDisplay()));
|
the_colour->CalcPixel(wxTheApp->GetMainColormap(wxGetDisplay()));
|
||||||
|
#endif
|
||||||
GLint pix = (GLint)the_colour->GetPixel();
|
GLint pix = (GLint)the_colour->GetPixel();
|
||||||
if(pix == -1)
|
if(pix == -1)
|
||||||
{
|
{
|
||||||
@ -297,7 +308,7 @@ bool wxGLCanvas::Create( wxWindow *parent,
|
|||||||
} else {
|
} else {
|
||||||
// By default, we use the visual of xwindow
|
// By default, we use the visual of xwindow
|
||||||
// NI: is this really senseful ? opengl in e.g. color index mode ?
|
// NI: is this really senseful ? opengl in e.g. color index mode ?
|
||||||
XGetWindowAttributes(display, (Window) GetClientAreaWindow(), &xwa);
|
XGetWindowAttributes(display, (Window)wxGetClientAreaWindow(this), &xwa);
|
||||||
vi_templ.visualid = XVisualIDFromVisual(xwa.visual);
|
vi_templ.visualid = XVisualIDFromVisual(xwa.visual);
|
||||||
vi = XGetVisualInfo(display, VisualIDMask, &vi_templ, &n);
|
vi = XGetVisualInfo(display, VisualIDMask, &vi_templ, &n);
|
||||||
if(!vi) return FALSE;
|
if(!vi) return FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user