Some clean-ups which don't really solve any problem yet.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14201 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -703,6 +703,10 @@ WXColormap wxApp::GetMainColormap(WXDisplay* display)
|
||||
|
||||
Window wxGetWindowParent(Window window)
|
||||
{
|
||||
wxASSERT_MSG( window, "invalid window" );
|
||||
|
||||
return (Window) 0;
|
||||
|
||||
Window parent, root = 0;
|
||||
unsigned int noChildren = 0;
|
||||
Window* children = NULL;
|
||||
|
@@ -55,8 +55,6 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
||||
Window xparent = RootWindow( xdisplay, xscreen );
|
||||
|
||||
XSetWindowAttributes xattributes;
|
||||
XSizeHints size_hints;
|
||||
XWMHints wm_hints;
|
||||
|
||||
long xattributes_mask =
|
||||
CWOverrideRedirect |
|
||||
@@ -79,29 +77,14 @@ bool wxPopupWindow::Create( wxWindow *parent, int style )
|
||||
m_mainWidget = (WXWindow) xwindow;
|
||||
wxAddWindowToTable( xwindow, (wxWindow*) this );
|
||||
|
||||
// Probably shouldn't be here for an unmanaged window
|
||||
//XSetTransientForHint( xdisplay, xwindow, xparent );
|
||||
|
||||
// TODO: Will these calls cause decoration??
|
||||
|
||||
size_hints.flags = PSize;
|
||||
size_hints.width = size.x;
|
||||
size_hints.height = size.y;
|
||||
XSetWMNormalHints( xdisplay, xwindow, &size_hints);
|
||||
XSetTransientForHint( xdisplay, xwindow, xparent );
|
||||
|
||||
XWMHints wm_hints;
|
||||
wm_hints.flags = InputHint | StateHint /* | WindowGroupHint */;
|
||||
wm_hints.input = True;
|
||||
wm_hints.initial_state = NormalState;
|
||||
XSetWMHints( xdisplay, xwindow, &wm_hints);
|
||||
|
||||
// No decorations for this window
|
||||
#if 0
|
||||
Atom wm_delete_window = XInternAtom( xdisplay, "WM_DELETE_WINDOW", False);
|
||||
XSetWMProtocols( xdisplay, xwindow, &wm_delete_window, 1);
|
||||
|
||||
wxSetWMDecorations((Window) GetMainWindow(), style);
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -117,7 +100,15 @@ void wxPopupWindow::DoSetSize( int x, int y, int width, int height, int sizeFlag
|
||||
|
||||
bool wxPopupWindow::Show( bool show )
|
||||
{
|
||||
return wxWindowX11::Show( show );
|
||||
bool ret = wxWindowX11::Show( show );
|
||||
|
||||
#if 0
|
||||
int x,y;
|
||||
GetSize( &x, &y );
|
||||
printf( "popup size %d, %d\n", x, y );
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // wxUSE_POPUPWIN
|
||||
|
@@ -148,7 +148,7 @@ bool wxWindowX11::Create(wxWindow *parent, wxWindowID id,
|
||||
m_mainWidget = (WXWindow) window;
|
||||
|
||||
// Select event types wanted
|
||||
XSelectInput(wxGlobalDisplay(), window,
|
||||
XSelectInput( wxGlobalDisplay(), window,
|
||||
ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask |
|
||||
ButtonMotionMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask |
|
||||
KeymapStateMask | FocusChangeMask | ColormapChangeMask | StructureNotifyMask |
|
||||
@@ -206,40 +206,23 @@ wxWindowX11::~wxWindowX11()
|
||||
|
||||
void wxWindowX11::SetFocus()
|
||||
{
|
||||
Window wMain = (Window) GetMainWindow();
|
||||
if (wMain)
|
||||
{
|
||||
// TODO: set a m_needInputFocus flag and do the
|
||||
// the setting in OnIdle or Show, because we can't
|
||||
// set the focus for an unmapped window.
|
||||
// We need to figure out how to find out if the window
|
||||
// is mapped.
|
||||
#if 0
|
||||
XSetInputFocus(wxGlobalDisplay(), wMain, RevertToParent, CurrentTime);
|
||||
Window xwindow = (Window) GetMainWindow();
|
||||
|
||||
XWMHints wmhints;
|
||||
wmhints.flags = InputHint;
|
||||
wmhints.input = True;
|
||||
XSetWMHints(wxGlobalDisplay(), wMain, &wmhints);
|
||||
#endif
|
||||
}
|
||||
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||
|
||||
XSetInputFocus( wxGlobalDisplay(), xwindow, RevertToParent, CurrentTime );
|
||||
}
|
||||
|
||||
// Get the window with the focus
|
||||
wxWindow *wxWindowBase::FindFocus()
|
||||
{
|
||||
Window wFocus = (Window) 0;
|
||||
Window xfocus = (Window) 0;
|
||||
int revert = 0;
|
||||
|
||||
XGetInputFocus(wxGlobalDisplay(), & wFocus, & revert);
|
||||
if (wFocus)
|
||||
XGetInputFocus( wxGlobalDisplay(), &xfocus, &revert);
|
||||
if (xfocus)
|
||||
{
|
||||
wxWindow *win = NULL;
|
||||
do
|
||||
{
|
||||
win = wxGetWindowFromTable(wFocus);
|
||||
wFocus = wxGetWindowParent(wFocus);
|
||||
} while (wFocus && !win);
|
||||
wxWindow *win = wxGetWindowFromTable( xfocus );
|
||||
|
||||
return win;
|
||||
}
|
||||
@@ -313,6 +296,8 @@ void wxWindowX11::DoCaptureMouse()
|
||||
|
||||
Window xwindow = (Window) GetMainWindow();
|
||||
|
||||
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||
|
||||
g_captureWindow = (wxWindow*) this;
|
||||
|
||||
if (xwindow)
|
||||
@@ -422,16 +407,19 @@ bool wxWindowX11::SetCursor(const wxCursor& cursor)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxCursor* cursor2 = NULL;
|
||||
Window xwindow = (Window) GetMainWindow();
|
||||
|
||||
wxCHECK_MSG( xwindow, FALSE, wxT("invalid window") );
|
||||
|
||||
wxCursor cursorToUse;
|
||||
if (m_cursor.Ok())
|
||||
cursor2 = & m_cursor;
|
||||
cursorToUse = m_cursor;
|
||||
else
|
||||
cursor2 = wxSTANDARD_CURSOR;
|
||||
cursorToUse = *wxSTANDARD_CURSOR;
|
||||
|
||||
WXCursor x_cursor = cursor2->GetCursor();
|
||||
Cursor xcursor = (Cursor) cursorToUse.GetCursor();
|
||||
|
||||
Window win = (Window) GetMainWindow();
|
||||
XDefineCursor((Display*) wxGlobalDisplay(), win, (Cursor) x_cursor);
|
||||
XDefineCursor( (Display*) wxGlobalDisplay(), xwindow, xcursor );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -439,8 +427,11 @@ bool wxWindowX11::SetCursor(const wxCursor& cursor)
|
||||
// Coordinates relative to the window
|
||||
void wxWindowX11::WarpPointer (int x, int y)
|
||||
{
|
||||
if (m_mainWidget)
|
||||
XWarpPointer( wxGlobalDisplay(), None, (Window) m_mainWidget, 0, 0, 0, 0, x, y);
|
||||
Window xwindow = (Window) GetMainWindow();
|
||||
|
||||
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||
|
||||
XWarpPointer( wxGlobalDisplay(), None, xwindow, 0, 0, 0, 0, x, y);
|
||||
}
|
||||
|
||||
// Does a physical scroll
|
||||
@@ -656,11 +647,12 @@ bool wxWindowX11::PreResize()
|
||||
// Get total size
|
||||
void wxWindowX11::DoGetSize(int *x, int *y) const
|
||||
{
|
||||
Window window = (Window) m_mainWidget;
|
||||
if (window)
|
||||
{
|
||||
Window xwindow = (Window) GetMainWindow();
|
||||
|
||||
wxCHECK_RET( xwindow, wxT("invalid window") );
|
||||
|
||||
XWindowAttributes attr;
|
||||
Status status = XGetWindowAttributes(wxGlobalDisplay(), window, & attr);
|
||||
Status status = XGetWindowAttributes( wxGlobalDisplay(), xwindow, &attr );
|
||||
wxASSERT(status);
|
||||
|
||||
if (status)
|
||||
@@ -668,7 +660,6 @@ void wxWindowX11::DoGetSize(int *x, int *y) const
|
||||
*x = attr.width /* + 2*m_borderSize */ ;
|
||||
*y = attr.height /* + 2*m_borderSize */ ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxWindowX11::DoGetPosition(int *x, int *y) const
|
||||
@@ -1281,69 +1272,6 @@ bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, Window WXUNUSED(win
|
||||
// Colour stuff
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if 0
|
||||
|
||||
#define YAllocColor XAllocColor
|
||||
XColor g_itemColors[5];
|
||||
int wxComputeColours (Display *display, wxColour * back, wxColour * fore)
|
||||
{
|
||||
int result;
|
||||
static XmColorProc colorProc;
|
||||
|
||||
result = wxNO_COLORS;
|
||||
|
||||
if (back)
|
||||
{
|
||||
g_itemColors[0].red = (((long) back->Red ()) << 8);
|
||||
g_itemColors[0].green = (((long) back->Green ()) << 8);
|
||||
g_itemColors[0].blue = (((long) back->Blue ()) << 8);
|
||||
g_itemColors[0].flags = DoRed | DoGreen | DoBlue;
|
||||
if (colorProc == (XmColorProc) NULL)
|
||||
{
|
||||
// Get a ptr to the actual function
|
||||
colorProc = XmSetColorCalculation ((XmColorProc) NULL);
|
||||
// And set it back to motif.
|
||||
XmSetColorCalculation (colorProc);
|
||||
}
|
||||
(*colorProc) (&g_itemColors[wxBACK_INDEX],
|
||||
&g_itemColors[wxFORE_INDEX],
|
||||
&g_itemColors[wxSELE_INDEX],
|
||||
&g_itemColors[wxTOPS_INDEX],
|
||||
&g_itemColors[wxBOTS_INDEX]);
|
||||
result = wxBACK_COLORS;
|
||||
}
|
||||
if (fore)
|
||||
{
|
||||
g_itemColors[wxFORE_INDEX].red = (((long) fore->Red ()) << 8);
|
||||
g_itemColors[wxFORE_INDEX].green = (((long) fore->Green ()) << 8);
|
||||
g_itemColors[wxFORE_INDEX].blue = (((long) fore->Blue ()) << 8);
|
||||
g_itemColors[wxFORE_INDEX].flags = DoRed | DoGreen | DoBlue;
|
||||
if (result == wxNO_COLORS)
|
||||
result = wxFORE_COLORS;
|
||||
}
|
||||
|
||||
Display *dpy = display;
|
||||
Colormap cmap = (Colormap) wxTheApp->GetMainColormap((WXDisplay*) dpy);
|
||||
|
||||
if (back)
|
||||
{
|
||||
/* 5 Colours to allocate */
|
||||
for (int i = 0; i < 5; i++)
|
||||
if (!YAllocColor (dpy, cmap, &g_itemColors[i]))
|
||||
result = wxNO_COLORS;
|
||||
}
|
||||
else if (fore)
|
||||
{
|
||||
/* Only 1 colour to allocate */
|
||||
if (!YAllocColor (dpy, cmap, &g_itemColors[wxFORE_INDEX]))
|
||||
result = wxNO_COLORS;
|
||||
}
|
||||
|
||||
return (result);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
bool wxWindowX11::SetBackgroundColour(const wxColour& col)
|
||||
{
|
||||
wxWindowBase::SetBackgroundColour(col);
|
||||
|
Reference in New Issue
Block a user