Small changes to wxX11
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14122 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -65,11 +65,13 @@ Pixmap XCreateInsensitivePixmap( Display *display, Pixmap pixmap );
|
|||||||
extern XColor g_itemColors[];
|
extern XColor g_itemColors[];
|
||||||
extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
|
extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore);
|
||||||
|
|
||||||
extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
|
|
||||||
extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
|
|
||||||
|
|
||||||
extern Window wxGetWindowParent(Window window);
|
extern Window wxGetWindowParent(Window window);
|
||||||
|
|
||||||
|
// Set the window manager decorations according to the
|
||||||
|
// given wxWindows style
|
||||||
|
bool wxSetWMDecorations(Window w, long style);
|
||||||
|
bool wxMWMIsRunning(Window w);
|
||||||
|
|
||||||
// For convenience
|
// For convenience
|
||||||
inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); }
|
inline Display* wxGlobalDisplay() { return (Display*) wxGetDisplay(); }
|
||||||
|
|
||||||
|
@@ -72,17 +72,6 @@ protected:
|
|||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
// create a new frame, return FALSE if it couldn't be created
|
|
||||||
bool CreateFrame(const wxString& title,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size);
|
|
||||||
|
|
||||||
// create a new dialog using the given dialog template from resources,
|
|
||||||
// return FALSE if it couldn't be created
|
|
||||||
bool CreateDialog(const wxString& title,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size);
|
|
||||||
|
|
||||||
// is the frame currently iconized?
|
// is the frame currently iconized?
|
||||||
bool m_iconized;
|
bool m_iconized;
|
||||||
|
|
||||||
@@ -98,5 +87,8 @@ protected:
|
|||||||
wxString m_title;
|
wxString m_title;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// list of all frames and modeless dialogs
|
||||||
|
//extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
|
||||||
|
|
||||||
#endif // _WX_X11_TOPLEVEL_H_
|
#endif // _WX_X11_TOPLEVEL_H_
|
||||||
|
|
||||||
|
@@ -81,12 +81,6 @@ public:
|
|||||||
const wxFont *theFont = (const wxFont *) NULL)
|
const wxFont *theFont = (const wxFont *) NULL)
|
||||||
const;
|
const;
|
||||||
|
|
||||||
virtual void SetScrollbar( int orient, int pos, int thumbVisible,
|
|
||||||
int range, bool refresh = TRUE );
|
|
||||||
virtual void SetScrollPos( int orient, int pos, bool refresh = TRUE );
|
|
||||||
virtual int GetScrollPos( int orient ) const;
|
|
||||||
virtual int GetScrollThumb( int orient ) const;
|
|
||||||
virtual int GetScrollRange( int orient ) const;
|
|
||||||
virtual void ScrollWindow( int dx, int dy,
|
virtual void ScrollWindow( int dx, int dy,
|
||||||
const wxRect* rect = (wxRect *) NULL );
|
const wxRect* rect = (wxRect *) NULL );
|
||||||
|
|
||||||
|
@@ -296,8 +296,6 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
while (window && !(win = wxGetWindowFromTable(window)))
|
while (window && !(win = wxGetWindowFromTable(window)))
|
||||||
window = wxGetWindowParent(window);
|
window = wxGetWindowParent(window);
|
||||||
|
|
||||||
// TODO: shouldn't all the ProcessEvents below
|
|
||||||
// be win->GetEventHandler()->ProcessEvent?
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
|
@@ -16,9 +16,7 @@
|
|||||||
#if wxUSE_POPUPWIN
|
#if wxUSE_POPUPWIN
|
||||||
|
|
||||||
#include "wx/popupwin.h"
|
#include "wx/popupwin.h"
|
||||||
#include "wx/frame.h"
|
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
#include "wx/cursor.h"
|
|
||||||
|
|
||||||
#include "wx/x11/private.h"
|
#include "wx/x11/private.h"
|
||||||
|
|
||||||
@@ -40,11 +38,58 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All dialogs should really have this style
|
// All dialogs should really have this style
|
||||||
|
m_windowStyle = style;
|
||||||
m_windowStyle |= wxTAB_TRAVERSAL;
|
m_windowStyle |= wxTAB_TRAVERSAL;
|
||||||
|
|
||||||
|
m_parent = parent;
|
||||||
if (m_parent) m_parent->AddChild( this );
|
if (m_parent) m_parent->AddChild( this );
|
||||||
|
|
||||||
// TODO: implementation
|
wxTopLevelWindows.Append(this);
|
||||||
|
|
||||||
|
Display *xdisplay = wxGlobalDisplay();
|
||||||
|
int xscreen = DefaultScreen( xdisplay );
|
||||||
|
Visual *xvisual = DefaultVisual( xdisplay, xscreen );
|
||||||
|
Window xparent = RootWindow( xdisplay, xscreen );
|
||||||
|
|
||||||
|
XSetWindowAttributes xattributes;
|
||||||
|
XSizeHints size_hints;
|
||||||
|
XWMHints wm_hints;
|
||||||
|
|
||||||
|
long xattributes_mask =
|
||||||
|
CWEventMask |
|
||||||
|
CWBorderPixel | CWBackPixel;
|
||||||
|
xattributes.background_pixel = BlackPixel( xdisplay, xscreen );
|
||||||
|
xattributes.border_pixel = BlackPixel( xdisplay, xscreen );
|
||||||
|
xattributes.override_redirect = False;
|
||||||
|
|
||||||
|
Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y,
|
||||||
|
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
||||||
|
|
||||||
|
XSelectInput( xdisplay, xwindow,
|
||||||
|
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||||
|
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||||
|
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||||
|
PropertyChangeMask );
|
||||||
|
|
||||||
|
m_mainWindow = (WXWindow) xwindow;
|
||||||
|
wxAddWindowToTable( xwindow, (wxWindow*) this );
|
||||||
|
|
||||||
|
XSetTransientForHint( xdisplay, xwindow, xparent );
|
||||||
|
|
||||||
|
size_hints.flags = PSize;
|
||||||
|
size_hints.width = size.x;
|
||||||
|
size_hints.height = size.y;
|
||||||
|
XSetWMNormalHints( xdisplay, xwindow, &size_hints);
|
||||||
|
|
||||||
|
wm_hints.flags = InputHint | StateHint /* | WindowGroupHint */;
|
||||||
|
wm_hints.input = True;
|
||||||
|
wm_hints.initial_state = NormalState;
|
||||||
|
XSetWMHints( xdisplay, xwindow, &wm_hints);
|
||||||
|
|
||||||
|
Atom wm_delete_window = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False);
|
||||||
|
XSetWMProtocols( xdisplay, xwindow, &wm_delete_window, 1);
|
||||||
|
|
||||||
|
wxSetWMDecorations((Window) GetMainWindow(), style);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -56,14 +101,12 @@ void wxPopupWindow::DoMoveWindow(int WXUNUSED(x), int WXUNUSED(y), int WXUNUSED(
|
|||||||
|
|
||||||
void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlags )
|
||||||
{
|
{
|
||||||
// TODO
|
wxWindowX11::DoSetSize(x, y, width, height, sizeFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPopupWindow::Show( bool show )
|
bool wxPopupWindow::Show( bool show )
|
||||||
{
|
{
|
||||||
// TODO?
|
return wxWindow11::Show( show );
|
||||||
bool ret = wxWindow::Show( show );
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_POPUPWIN
|
#endif // wxUSE_POPUPWIN
|
||||||
|
@@ -22,70 +22,8 @@
|
|||||||
|
|
||||||
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
wxColour wxSystemSettingsNative::GetColour(wxSystemColour index)
|
||||||
{
|
{
|
||||||
switch (index)
|
// Overridden by wxSystemSettings::GetColour in wxUniversal
|
||||||
{
|
// to do the Right Thing
|
||||||
case wxSYS_COLOUR_WINDOW:
|
|
||||||
{
|
|
||||||
return *wxWHITE;
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_SCROLLBAR:
|
|
||||||
// case wxSYS_COLOUR_DESKTOP: // Same as wxSYS_COLOUR_BACKGROUND
|
|
||||||
case wxSYS_COLOUR_BACKGROUND:
|
|
||||||
case wxSYS_COLOUR_ACTIVECAPTION:
|
|
||||||
case wxSYS_COLOUR_INACTIVECAPTION:
|
|
||||||
case wxSYS_COLOUR_MENU:
|
|
||||||
case wxSYS_COLOUR_WINDOWFRAME:
|
|
||||||
case wxSYS_COLOUR_ACTIVEBORDER:
|
|
||||||
case wxSYS_COLOUR_INACTIVEBORDER:
|
|
||||||
case wxSYS_COLOUR_BTNFACE:
|
|
||||||
// case wxSYS_COLOUR_3DFACE: // Same as wxSYS_COLOUR_BTNFACE
|
|
||||||
case wxSYS_COLOUR_GRAYTEXT:
|
|
||||||
{
|
|
||||||
return wxColour("LIGHT GREY");
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_BTNSHADOW:
|
|
||||||
// case wxSYS_COLOUR_3DSHADOW: // Same as wxSYS_COLOUR_BTNSHADOW
|
|
||||||
{
|
|
||||||
return wxColour("GREY");
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_3DDKSHADOW:
|
|
||||||
{
|
|
||||||
return *wxBLACK;
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_HIGHLIGHT:
|
|
||||||
{
|
|
||||||
return *wxBLUE;
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_BTNHIGHLIGHT:
|
|
||||||
case wxSYS_COLOUR_LISTBOX:
|
|
||||||
// case wxSYS_COLOUR_3DHIGHLIGHT: // Same as wxSYS_COLOUR_BTNHIGHLIGHT
|
|
||||||
{
|
|
||||||
return *wxWHITE;
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_3DLIGHT:
|
|
||||||
{
|
|
||||||
return wxColour("LIGHT GREY");
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_MENUTEXT:
|
|
||||||
case wxSYS_COLOUR_WINDOWTEXT:
|
|
||||||
case wxSYS_COLOUR_CAPTIONTEXT:
|
|
||||||
case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
|
|
||||||
case wxSYS_COLOUR_BTNTEXT:
|
|
||||||
case wxSYS_COLOUR_INFOTEXT:
|
|
||||||
{
|
|
||||||
return *wxBLACK;
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_HIGHLIGHTTEXT:
|
|
||||||
{
|
|
||||||
return *wxWHITE;
|
|
||||||
}
|
|
||||||
case wxSYS_COLOUR_INFOBK:
|
|
||||||
case wxSYS_COLOUR_APPWORKSPACE:
|
|
||||||
{
|
|
||||||
return wxColour("LIGHT GREY");
|
|
||||||
// return *wxWHITE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return *wxWHITE;
|
return *wxWHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -41,12 +41,8 @@
|
|||||||
#include "X11/Xatom.h"
|
#include "X11/Xatom.h"
|
||||||
#include "X11/Xutil.h"
|
#include "X11/Xutil.h"
|
||||||
|
|
||||||
// Set the window manager decorations according to the
|
// list of all frames and modeless dialogs
|
||||||
// given wxWindows style
|
// wxWindowList wxModelessWindows;
|
||||||
#if 0
|
|
||||||
static bool SetWMDecorations(Widget w, long style);
|
|
||||||
#endif
|
|
||||||
static bool MWMIsRunning(Window w);
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxTopLevelWindowX11 creation
|
// wxTopLevelWindowX11 creation
|
||||||
@@ -66,22 +62,6 @@ void wxTopLevelWindowX11::Init()
|
|||||||
m_fsIsShowing = FALSE;
|
m_fsIsShowing = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTopLevelWindowX11::CreateDialog(const wxString& title,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTopLevelWindowX11::CreateFrame(const wxString& title,
|
|
||||||
const wxPoint& pos,
|
|
||||||
const wxSize& size)
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
@@ -94,11 +74,15 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
|||||||
Init();
|
Init();
|
||||||
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
m_parent = parent;
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
m_windowId = id == -1 ? NewControlId() : id;
|
m_windowId = id == -1 ? NewControlId() : id;
|
||||||
|
|
||||||
|
if (parent)
|
||||||
|
parent->AddChild(this);
|
||||||
|
|
||||||
wxTopLevelWindows.Append(this);
|
wxTopLevelWindows.Append(this);
|
||||||
|
|
||||||
Display *xdisplay = wxGlobalDisplay();
|
Display *xdisplay = wxGlobalDisplay();
|
||||||
@@ -119,6 +103,7 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
|||||||
|
|
||||||
Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y,
|
Window xwindow = XCreateWindow( xdisplay, xparent, pos.x, pos.y, size.x, size.y,
|
||||||
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
0, DefaultDepth(xdisplay,xscreen), InputOutput, xvisual, xattributes_mask, &xattributes );
|
||||||
|
m_mainWindow = (WXWindow) xwindow;
|
||||||
|
|
||||||
XSelectInput( xdisplay, xwindow,
|
XSelectInput( xdisplay, xwindow,
|
||||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||||
@@ -143,9 +128,7 @@ bool wxTopLevelWindowX11::Create(wxWindow *parent,
|
|||||||
Atom wm_delete_window = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False);
|
Atom wm_delete_window = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False);
|
||||||
XSetWMProtocols( xdisplay, xwindow, &wm_delete_window, 1);
|
XSetWMProtocols( xdisplay, xwindow, &wm_delete_window, 1);
|
||||||
|
|
||||||
#if 0
|
wxSetWMDecorations((Window) GetMainWindow(), style);
|
||||||
SetWMDecorations((Window) GetMainWindow(), style);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SetTitle(title);
|
SetTitle(title);
|
||||||
|
|
||||||
@@ -262,7 +245,6 @@ void wxTopLevelWindowX11::SetIcon(const wxIcon& icon)
|
|||||||
|
|
||||||
if (icon.Ok() && GetMainWindow())
|
if (icon.Ok() && GetMainWindow())
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
XWMHints *wmHints = XAllocWMHints();
|
XWMHints *wmHints = XAllocWMHints();
|
||||||
wmHints.icon_pixmap = (Pixmap) icon.GetPixmap();
|
wmHints.icon_pixmap = (Pixmap) icon.GetPixmap();
|
||||||
|
|
||||||
@@ -277,7 +259,6 @@ void wxTopLevelWindowX11::SetIcon(const wxIcon& icon)
|
|||||||
XSetWMHints(wxGlobalDisplay(), (Window) GetMainWindow(),
|
XSetWMHints(wxGlobalDisplay(), (Window) GetMainWindow(),
|
||||||
wmHints);
|
wmHints);
|
||||||
XFree(wmHints);
|
XFree(wmHints);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,6 +271,8 @@ void wxTopLevelWindowX11::SetTitle(const wxString& title)
|
|||||||
(const char*) title);
|
(const char*) title);
|
||||||
XSetIconName(wxGlobalDisplay(), (Window) GetMainWindow(),
|
XSetIconName(wxGlobalDisplay(), (Window) GetMainWindow(),
|
||||||
(const char*) title);
|
(const char*) title);
|
||||||
|
|
||||||
|
// Use this if the platform doesn't supply the above functions.
|
||||||
#if 0
|
#if 0
|
||||||
XTextProperty textProperty;
|
XTextProperty textProperty;
|
||||||
textProperty.value = (unsigned char*) title;
|
textProperty.value = (unsigned char*) title;
|
||||||
@@ -335,8 +318,7 @@ struct MwmHints {
|
|||||||
|
|
||||||
// Set the window manager decorations according to the
|
// Set the window manager decorations according to the
|
||||||
// given wxWindows style
|
// given wxWindows style
|
||||||
#if 0
|
bool wxSetWMDecorations(Window w, long style)
|
||||||
static bool SetWMDecorations(Widget w, long style)
|
|
||||||
{
|
{
|
||||||
if (!MWMIsRunning(w))
|
if (!MWMIsRunning(w))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -398,9 +380,8 @@ static bool SetWMDecorations(Widget w, long style)
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
static bool MWMIsRunning(Window w)
|
bool wxMWMIsRunning(Window w)
|
||||||
{
|
{
|
||||||
Display *dpy = (Display*)wxGetDisplay();
|
Display *dpy = (Display*)wxGetDisplay();
|
||||||
Atom motifWmInfo = XInternAtom(dpy, "_MOTIF_WM_INFO", False);
|
Atom motifWmInfo = XInternAtom(dpy, "_MOTIF_WM_INFO", False);
|
||||||
|
@@ -180,25 +180,11 @@ void wxBell()
|
|||||||
|
|
||||||
int wxGetOsVersion(int *majorVsn, int *minorVsn)
|
int wxGetOsVersion(int *majorVsn, int *minorVsn)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
// FIXME TODO
|
|
||||||
// This code is WRONG!! Does NOT return the
|
|
||||||
// Motif version of the libs but the X protocol
|
|
||||||
// version!
|
|
||||||
Display *display = XtDisplay ((Widget) wxTheApp->GetTopLevelWidget());
|
|
||||||
if (majorVsn)
|
|
||||||
*majorVsn = ProtocolVersion (display);
|
|
||||||
if (minorVsn)
|
|
||||||
*minorVsn = ProtocolRevision (display);
|
|
||||||
|
|
||||||
return wxMOTIF_X;
|
|
||||||
#else
|
|
||||||
if (majorVsn)
|
if (majorVsn)
|
||||||
*majorVsn = 0;
|
*majorVsn = 0;
|
||||||
if (minorVsn)
|
if (minorVsn)
|
||||||
*minorVsn = 0;
|
*minorVsn = 0;
|
||||||
return wxX11;
|
return wxX11;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -127,21 +127,6 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
|||||||
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE);
|
||||||
m_foregroundColour = *wxBLACK;
|
m_foregroundColour = *wxBLACK;
|
||||||
|
|
||||||
#if 0
|
|
||||||
// TODO: How to create more interesting borders?
|
|
||||||
// Will presumably have to create multiple windows.
|
|
||||||
if (style & wxSIMPLE_BORDER)
|
|
||||||
{
|
|
||||||
m_borderSize = 1;
|
|
||||||
} else if (style & wxSUNKEN_BORDER)
|
|
||||||
{
|
|
||||||
m_borderSize = 1;
|
|
||||||
} else if (style & wxRAISED_BORDER)
|
|
||||||
{
|
|
||||||
m_borderSize = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int w = size.GetWidth();
|
int w = size.GetWidth();
|
||||||
int h = size.GetHeight();
|
int h = size.GetHeight();
|
||||||
int x = size.GetX();
|
int x = size.GetX();
|
||||||
@@ -173,12 +158,9 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
wxAddWindowToTable(window, (wxWindow*) this);
|
wxAddWindowToTable(window, (wxWindow*) this);
|
||||||
|
|
||||||
// If a subwindow, show.
|
// Is a subwindow, so map immediately
|
||||||
// if (parent && !parent->IsKindOf(CLASSINFO(wxTopLevelWindowX11)) && parent->IsShown())
|
|
||||||
{
|
|
||||||
m_isShown = TRUE;
|
m_isShown = TRUE;
|
||||||
XMapWindow(wxGlobalDisplay(), window);
|
XMapWindow(wxGlobalDisplay(), window);
|
||||||
}
|
|
||||||
|
|
||||||
// Without this, the cursor may not be restored properly (e.g. in splitter
|
// Without this, the cursor may not be restored properly (e.g. in splitter
|
||||||
// sample).
|
// sample).
|
||||||
@@ -226,8 +208,7 @@ wxWindowX11::~wxWindowX11()
|
|||||||
|
|
||||||
void wxWindowX11::SetFocus()
|
void wxWindowX11::SetFocus()
|
||||||
{
|
{
|
||||||
#if 0
|
Window wMain = (Window) GetMainWindow();
|
||||||
Window wMain = (Window) GetMainWidget();
|
|
||||||
if (wMain)
|
if (wMain)
|
||||||
{
|
{
|
||||||
XSetInputFocus(wxGlobalDisplay(), wMain, RevertToParent, CurrentTime);
|
XSetInputFocus(wxGlobalDisplay(), wMain, RevertToParent, CurrentTime);
|
||||||
@@ -237,7 +218,6 @@ void wxWindowX11::SetFocus()
|
|||||||
wmhints.input = True;
|
wmhints.input = True;
|
||||||
XSetWMHints(wxGlobalDisplay(), wMain, &wmhints)
|
XSetWMHints(wxGlobalDisplay(), wMain, &wmhints)
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the window with the focus
|
// Get the window with the focus
|
||||||
@@ -311,7 +291,6 @@ void wxWindowX11::DoCaptureMouse()
|
|||||||
if ( m_winCaptured )
|
if ( m_winCaptured )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// TODO: should we also call XGrabButton, XGrabKeyboard?
|
|
||||||
if (GetMainWindow())
|
if (GetMainWindow())
|
||||||
{
|
{
|
||||||
int res = XGrabPointer(wxGlobalDisplay(), (Window) GetMainWindow(),
|
int res = XGrabPointer(wxGlobalDisplay(), (Window) GetMainWindow(),
|
||||||
@@ -323,10 +302,45 @@ void wxWindowX11::DoCaptureMouse()
|
|||||||
None, /* cursor */ // TODO: This may need to be set to the cursor of this window
|
None, /* cursor */ // TODO: This may need to be set to the cursor of this window
|
||||||
CurrentTime);
|
CurrentTime);
|
||||||
|
|
||||||
if (res == GrabSuccess)
|
if (res != GrabSuccess)
|
||||||
{
|
{
|
||||||
m_winCaptured = TRUE;
|
wxLogDebug("Failed to grab pointer.");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res = XGrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
||||||
|
(Window) GetMainWindow(),
|
||||||
|
FALSE,
|
||||||
|
ButtonPressMask | ButtonReleaseMask | ButtonMotionMask,
|
||||||
|
GrabModeAsync,
|
||||||
|
GrabModeAsync,
|
||||||
|
None,
|
||||||
|
None);
|
||||||
|
|
||||||
|
if (res != GrabSuccess)
|
||||||
|
{
|
||||||
|
wxLogDebug("Failed to grab mouse buttons.");
|
||||||
|
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
res = XGrabKeyboard(wxGlobalDisplay(), (Window) GetMainWindow(),
|
||||||
|
FALSE,
|
||||||
|
ShiftMask, LockMask, Control-Mask, Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, and Mod5Mask.,
|
||||||
|
GrabModeAsync,
|
||||||
|
GrabModeAsync,
|
||||||
|
CurrentTime);
|
||||||
|
|
||||||
|
if (res != GrabSuccess)
|
||||||
|
{
|
||||||
|
wxLogDebug("Failed to grab keyboard.");
|
||||||
|
XUngrabPointer(wxGlobalDisplay(), CurrentTime);
|
||||||
|
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
||||||
|
(Window) GetMainWindow());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_winCaptured = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,9 +352,13 @@ void wxWindowX11::DoReleaseMouse()
|
|||||||
|
|
||||||
Window wMain = (Window)GetMainWindow();
|
Window wMain = (Window)GetMainWindow();
|
||||||
|
|
||||||
// TODO: should we also call XUngrabButton, XUngrabKeyboard?
|
|
||||||
if ( wMain )
|
if ( wMain )
|
||||||
|
{
|
||||||
XUngrabPointer(wxGlobalDisplay(), wMain);
|
XUngrabPointer(wxGlobalDisplay(), wMain);
|
||||||
|
XUngrabButton(wxGlobalDisplay(), AnyButton, AnyModifier,
|
||||||
|
wMain);
|
||||||
|
XUngrabKeyboard(wxGlobalDisplay(), CurrentTime);
|
||||||
|
}
|
||||||
|
|
||||||
m_winCaptured = FALSE;
|
m_winCaptured = FALSE;
|
||||||
}
|
}
|
||||||
@@ -386,40 +404,6 @@ void wxWindowX11::WarpPointer (int x, int y)
|
|||||||
XWarpPointer( wxGlobalDisplay(), None, (Window) m_mainWidget, 0, 0, 0, 0, x, y);
|
XWarpPointer( wxGlobalDisplay(), None, (Window) m_mainWidget, 0, 0, 0, 0, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// scrolling stuff
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
int wxWindowX11::GetScrollPos(int orient) const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// This now returns the whole range, not just the number of positions that we
|
|
||||||
// can scroll.
|
|
||||||
int wxWindowX11::GetScrollRange(int WXUNUSED(orient)) const
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int wxWindowX11::GetScrollThumb(int orient) const
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxWindowX11::SetScrollPos(int orient, int pos, bool WXUNUSED(refresh))
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
// New function that will replace some of the above.
|
|
||||||
void wxWindowX11::SetScrollbar(int WXUNUSED(orient), int WXUNUSED(pos), int WXUNUSED(thumbVisible),
|
|
||||||
int WXUNUSED(range), bool WXUNUSED(refresh))
|
|
||||||
{
|
|
||||||
// TODO
|
|
||||||
}
|
|
||||||
|
|
||||||
// Does a physical scroll
|
// Does a physical scroll
|
||||||
void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
|
void wxWindowX11::ScrollWindow(int dx, int dy, const wxRect *rect)
|
||||||
{
|
{
|
||||||
@@ -1082,79 +1066,6 @@ WXWindow wxWindowX11::GetMainWindow() const
|
|||||||
return m_mainWidget;
|
return m_mainWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// callbacks
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// TODO: implement wxWindow scrollbar, presumably using wxScrollBar
|
|
||||||
#if 0
|
|
||||||
static void wxScrollBarCallback(Widget scrollbar,
|
|
||||||
XtPointer clientData,
|
|
||||||
XmScrollBarCallbackStruct *cbs)
|
|
||||||
{
|
|
||||||
wxWindow *win = wxGetWindowFromTable(scrollbar);
|
|
||||||
int orientation = (int) clientData;
|
|
||||||
|
|
||||||
wxEventType eventType = wxEVT_NULL;
|
|
||||||
switch (cbs->reason)
|
|
||||||
{
|
|
||||||
case XmCR_INCREMENT:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_SCROLLWIN_LINEDOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XmCR_DECREMENT:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_SCROLLWIN_LINEUP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XmCR_DRAG:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_SCROLLWIN_THUMBTRACK;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XmCR_VALUE_CHANGED:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_SCROLLWIN_THUMBRELEASE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XmCR_PAGE_INCREMENT:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_SCROLLWIN_PAGEDOWN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XmCR_PAGE_DECREMENT:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_SCROLLWIN_PAGEUP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XmCR_TO_TOP:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_SCROLLWIN_TOP;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case XmCR_TO_BOTTOM:
|
|
||||||
{
|
|
||||||
eventType = wxEVT_SCROLLWIN_BOTTOM;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
// Should never get here
|
|
||||||
wxFAIL_MSG("Unknown scroll event.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxScrollWinEvent event(eventType,
|
|
||||||
cbs->value,
|
|
||||||
((orientation == XmHORIZONTAL) ?
|
|
||||||
wxHORIZONTAL : wxVERTICAL));
|
|
||||||
event.SetEventObject( win );
|
|
||||||
win->GetEventHandler()->ProcessEvent(event);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// TranslateXXXEvent() functions
|
// TranslateXXXEvent() functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1396,6 +1307,17 @@ bool wxWindowX11::SetBackgroundColour(const wxColour& col)
|
|||||||
if ( !wxWindowBase::SetBackgroundColour(col) )
|
if ( !wxWindowBase::SetBackgroundColour(col) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if (!GetMainWindow())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
XSetWindowAttributes attrib;
|
||||||
|
attrib.background_pixel = col.AllocColour(wxGlobalDisplay());
|
||||||
|
|
||||||
|
XChangeWindowAttributes(wxGlobalDisplay(),
|
||||||
|
(Window) GetMainWindow(),
|
||||||
|
CWBackPixel,
|
||||||
|
& attrib);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user