X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/256d631aaf9ec4028bac066ea21c15337c6e4214..0b06ac1f24a3e25aa88f813ac6d91452b907e993:/src/x11/app.cpp diff --git a/src/x11/app.cpp b/src/x11/app.cpp index 71650e7b23..511b5fb034 100644 --- a/src/x11/app.cpp +++ b/src/x11/app.cpp @@ -26,6 +26,9 @@ #include "wx/intl.h" #include "wx/evtloop.h" +#include "wx/univ/theme.h" +#include "wx/univ/renderer.h" + #if wxUSE_THREADS #include "wx/thread.h" #endif @@ -197,11 +200,11 @@ int wxEntryStart( int& argc, char *argv[] ) if (i < (argc - 1)) { i ++; - windowGeometry = argv[i]; + wxString windowGeometry = argv[i]; int w, h; if (wxSscanf(windowGeometry.c_str(), _T("%dx%d"), &w, &h) != 2) { - wxLogError(_("Invalid geometry specification '%s'", windowGeometry.c_str()); + wxLogError(_("Invalid geometry specification '%s'"), windowGeometry.c_str()); } else { @@ -248,7 +251,7 @@ int wxEntryStart( int& argc, char *argv[] ) XSelectInput( xdisplay, XDefaultRootWindow(xdisplay), PropertyChangeMask); -// wxSetDetectableAutoRepeat( TRUE ); + wxSetDetectableAutoRepeat( TRUE ); if (!wxApp::Initialize()) return -1; @@ -405,7 +408,7 @@ void wxApp::ProcessXEvent(WXEvent* _event) wxWindow* win = NULL; Window window = event->xany.window; Window actualWindow = window; - + // Find the first wxWindow that corresponds to this event window // Because we're receiving events after a window // has been destroyed, assume a 1:1 match between @@ -481,8 +484,8 @@ void wxApp::ProcessXEvent(WXEvent* _event) if (win && !win->IsEnabled()) return; - Atom wm_delete_window = XInternAtom(wxGlobalDisplay(), "WM_DELETE_WINDOW", True);; - Atom wm_protocols = XInternAtom(wxGlobalDisplay(), "WM_PROTOCOLS", True);; + Atom wm_delete_window = XInternAtom(wxGlobalDisplay(), "WM_DELETE_WINDOW", True); + Atom wm_protocols = XInternAtom(wxGlobalDisplay(), "WM_PROTOCOLS", True); if (event->xclient.message_type == wm_protocols) { @@ -548,21 +551,49 @@ void wxApp::ProcessXEvent(WXEvent* _event) return; } + case GraphicsExpose: + { + if (win) + { + // wxLogDebug( "GraphicsExpose from %s", win->GetName().c_str(), + // event->xgraphicsexpose.x, event->xgraphicsexpose.y, + // event->xgraphicsexpose.width, event->xgraphicsexpose.height); + + win->GetUpdateRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y, + event->xgraphicsexpose.width, event->xgraphicsexpose.height); + + win->GetClearRegion().Union( event->xgraphicsexpose.x, event->xgraphicsexpose.y, + event->xgraphicsexpose.width, event->xgraphicsexpose.height); + + // if (event->xgraphicsexpose.count == 0) + // win->Update(); + } + + return; + } case EnterNotify: case LeaveNotify: case ButtonPress: case ButtonRelease: case MotionNotify: { - if (win && !win->IsEnabled()) + if (!win) return; - - if (win) + + if (!win->IsEnabled()) + return; + +#if 1 + if (event->type == ButtonPress) { - wxMouseEvent wxevent; - wxTranslateMouseEvent(wxevent, win, window, event); - win->GetEventHandler()->ProcessEvent( wxevent ); + if ((win != wxWindow::FindFocus()) && win->AcceptsFocus()) + win->SetFocus(); } +#endif + + wxMouseEvent wxevent; + wxTranslateMouseEvent(wxevent, win, window, event); + win->GetEventHandler()->ProcessEvent( wxevent ); return; } case FocusIn: @@ -585,7 +616,7 @@ void wxApp::ProcessXEvent(WXEvent* _event) if (win && event->xfocus.detail != NotifyPointer) #endif { - wxLogDebug( "FocusOut from %s\n", win->GetName().c_str() ); + wxLogDebug( "FocusOut from %s", win->GetName().c_str() ); wxFocusEvent focusEvent(wxEVT_KILL_FOCUS, win->GetId()); focusEvent.SetEventObject(win); @@ -838,37 +869,9 @@ bool wxApp::Yield(bool onlyIfNeeded) return TRUE; } -// XPM hack: make the arrays const -#define static static const - -#include "wx/generic/info.xpm" -#include "wx/generic/error.xpm" -#include "wx/generic/question.xpm" -#include "wx/generic/warning.xpm" - -#undef static - -wxIcon -wxApp::GetStdIcon(int which) const +wxIcon wxApp::GetStdIcon(int which) const { - switch(which) - { - case wxICON_INFORMATION: - return wxIcon(info_xpm); - - case wxICON_QUESTION: - return wxIcon(question_xpm); - - case wxICON_EXCLAMATION: - return wxIcon(warning_xpm); - - default: - wxFAIL_MSG("requested non existent standard icon"); - // still fall through - - case wxICON_HAND: - return wxIcon(error_xpm); - } + return wxTheme::Get()->GetRenderer()->GetStdIcon(which); } void wxApp::OnAssert(const wxChar *file, int line, const wxChar *msg)