From: Julian Smart Date: Thu, 18 Feb 1999 21:24:11 +0000 (+0000) Subject: Cured last focus bug (I hope); some wxMotif mods X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0492c5a094d1baac126331385d66d2f66aa5db52?hp=dd0e574a0eab1a67a0b4c9713c4252418be63593 Cured last focus bug (I hope); some wxMotif mods git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1724 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/latex/wx/ftp.tex b/docs/latex/wx/ftp.tex index b7e337ed92..c484054d96 100644 --- a/docs/latex/wx/ftp.tex +++ b/docs/latex/wx/ftp.tex @@ -101,3 +101,4 @@ An initialized write-only stream. \wxheading{See also} \helpref{wxOutputStream}{wxoutputstream} + diff --git a/docs/motif/install.txt b/docs/motif/install.txt index 1e4e0a68a2..25e82c7cfc 100644 --- a/docs/motif/install.txt +++ b/docs/motif/install.txt @@ -118,9 +118,9 @@ Troubleshooting functions, try putting the gcc fixinclude file paths early in the include path. -- If you get strange memory problems (for example in deletion - of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS to 0 in - setup.h, and recompile. +- If you operator-related compile errors or strange memory problems + (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS + and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile. - If you get an internal compiler error in gcc, turn off optimisations. @@ -128,7 +128,8 @@ Troubleshooting - Problems with XtDestroyWidget crashing in ~wxWindow have been reported on SGI IRIX 6.4. This has not yet been resolved, so any advice here would be very welcome. See bugs.txt for a - possible temporary workaround. + possible temporary workaround (comment out the final + XtDestroyWidget from ~wxWindow in window.cpp). Other Notes ----------- diff --git a/docs/msw/todo.txt b/docs/msw/todo.txt index 287bf16df9..091a048152 100644 --- a/docs/msw/todo.txt +++ b/docs/msw/todo.txt @@ -19,7 +19,7 @@ Update manual. Functions Makefiles and/or IDE files for other compilers: Symantec C++, -Salford C++. IDE files for BC++. +Salford C++. Check TODO entries in source and manual. diff --git a/include/wx/generic/panelg.h b/include/wx/generic/panelg.h index a6e983e024..c60d17f393 100644 --- a/include/wx/generic/panelg.h +++ b/include/wx/generic/panelg.h @@ -69,12 +69,12 @@ public: void OnFocus(wxFocusEvent& event); // called by wxWindow whenever it gets focus - void SetLastFocus(wxWindow *focus) { m_lastFocus = focus; } - wxWindow* GetLastFocus() const { return m_lastFocus; } + void SetLastFocus(long focus) { m_lastFocus = focus; } + long GetLastFocus() const { return m_lastFocus; } protected: // the child which had the focus last time this panel was activated - wxWindow *m_lastFocus; + long m_lastFocus; private: DECLARE_DYNAMIC_CLASS(wxPanel) diff --git a/samples/sashtest/sashtest.def b/samples/sashtest/sashtest.def index f323e40e57..021e6bc7bb 100644 --- a/samples/sashtest/sashtest.def +++ b/samples/sashtest/sashtest.def @@ -1,4 +1,3 @@ - * Last change: JS 8 Sep 98 9:19 pm NAME SashTest DESCRIPTION 'wxSashWindow Demo' EXETYPE WINDOWS diff --git a/src/generic/panelg.cpp b/src/generic/panelg.cpp index 83d3d1fd6e..f96bb1701b 100644 --- a/src/generic/panelg.cpp +++ b/src/generic/panelg.cpp @@ -42,7 +42,7 @@ END_EVENT_TABLE() wxPanel::wxPanel() { - m_lastFocus = NULL; + m_lastFocus = 0; } bool wxPanel::Create(wxWindow *parent, wxWindowID id, @@ -145,8 +145,12 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event ) void wxPanel::OnFocus(wxFocusEvent& event) { - if ( m_lastFocus ) - m_lastFocus->SetFocus(); + if (m_lastFocus != 0) + { + wxWindow* child = FindWindow(m_lastFocus); + if (child) + child->SetFocus(); + } else event.Skip(); } diff --git a/src/makeenvs/sgi.env b/src/makeenvs/sgi.env index 42c933aa66..64d10750c6 100644 --- a/src/makeenvs/sgi.env +++ b/src/makeenvs/sgi.env @@ -1,29 +1,31 @@ -# generic.env -# Linux/generic +# sgi.env +# SGI # # Common makefile settings for wxWindows programs # This file is included by all the other makefiles, thus changes # made here take effect everywhere (except where overriden). +# RCS-ID: $Id$ # ########################### Programs ################################# # Replace this with your own path if necessary -WXDIR = /home/mon/src/wx20 +WXWIN = /home/jds/wx2 +WXDIR = $(WXWIN) # C++ compiler -CC = CC -n32 -D__SGI__ -D__SGI_CC__ +CC = CC # C compiler -CCC = cc -n32 -Xcpluscomm -D__SGI__ -D__SGI_CC__ +CCC = cc # Compiler for lex/yacc .c programs CCLEX = $(CCC) -LEX = flex +LEX = lex YACC = yacc MAKE = make AROPTIONS = ruv -RANLIB = echo ranlib not required on SGI +RANLIB = echo ############################ Switches ################################# @@ -35,32 +37,31 @@ GUISUFFIX = _stubs ########################## Compiler flags ############################# # Misc options -OPTIONS = -D__WXDEBUG__ # -DDEBUG='$(DEBUG)' # -DWXDEBUG -COPTIONS = -DEBUGFLAGS = -g +OPTIONS = -32 -D__WXDEBUG__ -D__SGI__ -D__SGI_CC__ +COPTIONS = -32 -Xcpluscomm -D__SGI__ -D__SGI_CC__ +DEBUGFLAGS = -g3 INCLUDE = -WARN = -CWARN = -OPT = # -O2 +WARN = -w +CWARN = -w +OPT = ############################ Includes ################################# # Compiler or system-specific include paths -COMPPATHS = +COMPPATHS = XINCLUDE = -I/usr/include/X11 -I/usr/include/Xm \ -I/usr/include/X11/Xm -I/usr/include XLIB = -L/usr/local/X11/lib -L/usr/X11/lib -L/usr/X11R6/lib ############################ Libraries ################################ -COMPLIBS = #-lstdc++ +COMPLIBS = +#COMPLIBS = -lstdc++ +#COMPLIBS = -lPW GUILDLIBS = -lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lXpm -lX11 -lm ############################# Suffixes ################################ -# Change cpp to c if you want to use main.c instead of main.cpp. -# Edit wx_setup.h accordingly (USE_C_MAIN=1) - OBJSUFF =o SRCSUFF =cpp MAINSUFF =cpp @@ -111,9 +112,6 @@ cleanstubs: cleanmotif: make -f makefile.unx clean GUI='-D__WXMOTIF__ -D__UNIX__' GUISUFFIX='_motif' GUILDLIBS='-lwx_motif $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm' -cleangtk: - make -f makefile.unx clean GUI='-D__WXGTK__ -D__UNIX__' GUISUFFIX='_gtk' - $(OBJDIR): mkdir $(OBJDIR) diff --git a/src/makevc.env b/src/makevc.env index a7ee453187..b8166cc439 100644 --- a/src/makevc.env +++ b/src/makevc.env @@ -30,7 +30,8 @@ OBJSUFF=obj SRCSUFF=cpp # If you set wxUSE_IOSTREAMH to 0, remove -Dtry=__try -Dexcept=__except -Dleave=__leave -Dfinally=__finally -WINFLAGS=-c -W3 -Dtry=__try -Dexcept=__except -Dleave=__leave -Dfinally=__finally -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -DWIN32 -D__WIN32__ $(WINVERSION) +#WINFLAGS=-c -W3 -Dtry=__try -Dexcept=__except -Dleave=__leave -Dfinally=__finally -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -DWIN32 -D__WIN32__ $(WINVERSION) +WINFLAGS=-c -W3 -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -D_X86_=1 -DWIN32 -D__WIN32__ $(WINVERSION) #WINLINKFLAGS=/NODEFAULTLIB /INCREMENTAL:NO /NOLOGO -align:0x1000 -machine:$(CPU) -subsystem:windows,$(APPVER) WINLINKFLAGS=/INCREMENTAL:NO /NOLOGO -machine:$(CPU) -subsystem:windows,$(APPVER) #WINLIBS=kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib libc.lib oldnames.lib\ diff --git a/src/motif/frame.cpp b/src/motif/frame.cpp index 024c031119..d024c6db91 100644 --- a/src/motif/frame.cpp +++ b/src/motif/frame.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #if XmVersion > 1000 #include #endif @@ -56,6 +57,10 @@ void wxFrameFocusProc(Widget workArea, XtPointer clientData, static void wxFrameMapProc(Widget frameShell, XtPointer clientData, XCrossingEvent * event); +// From wxWindow +extern void wxCanvasRepaintProc (Widget, XtPointer, XmDrawingAreaCallbackStruct * cbs); +extern void wxCanvasInputEvent (Widget drawingArea, XtPointer data, XmDrawingAreaCallbackStruct * cbs); + extern wxList wxModelessWindows; extern wxList wxPendingDelete; @@ -190,11 +195,13 @@ bool wxFrame::Create(wxWindow *parent, // XmNresizePolicy, XmRESIZE_ANY, NULL); + XtAddCallback ((Widget) m_clientArea, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this); + XtAddCallback ((Widget) m_clientArea, XmNinputCallback, (XtCallbackProc) wxCanvasInputEvent, (XtPointer) this); + XtVaSetValues((Widget) m_frameWidget, XmNworkWindow, (Widget) m_workArea, NULL); - XtManageChild((Widget) m_clientArea); XtManageChild((Widget) m_workArea); @@ -289,7 +296,10 @@ wxFrame::~wxFrame() { if (GetMainWidget()) Show(FALSE); - + + XtRemoveCallback ((Widget) m_clientArea, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this); + XtRemoveCallback ((Widget) m_clientArea, XmNinputCallback, (XtCallbackProc) wxCanvasInputEvent, (XtPointer) this); + if (m_frameMenuBar) { m_frameMenuBar->DestroyMenuBar(); diff --git a/src/motif/mdi.cpp b/src/motif/mdi.cpp index 642a441daa..f6d2dc6e6b 100644 --- a/src/motif/mdi.cpp +++ b/src/motif/mdi.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -36,6 +37,10 @@ extern wxList wxModelessWindows; extern void wxFrameFocusProc(Widget workArea, XtPointer clientData, XmAnyCallbackStruct *cbs); +// From wxWindow +extern void wxCanvasRepaintProc (Widget, XtPointer, XmDrawingAreaCallbackStruct * cbs); +extern void wxCanvasInputEvent (Widget drawingArea, XtPointer data, XmDrawingAreaCallbackStruct * cbs); + #define wxID_NOTEBOOK_CLIENT_AREA wxID_HIGHEST + 100 #if !USE_SHARED_LIBRARY @@ -341,6 +346,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, XmNresizePolicy, XmRESIZE_NONE, NULL); + XtAddCallback ((Widget) m_mainWidget, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this); + SetCanAddEventHandler(TRUE); AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); @@ -363,6 +370,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent, wxMDIChildFrame::~wxMDIChildFrame() { + XtRemoveCallback ((Widget) m_mainWidget, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this); + if (GetMDIParentFrame()) { wxMDIParentFrame* parentFrame = GetMDIParentFrame(); diff --git a/src/motif/utilsexc.cpp b/src/motif/utilsexc.cpp index 82a89b652a..30788095c6 100644 --- a/src/motif/utilsexc.cpp +++ b/src/motif/utilsexc.cpp @@ -110,11 +110,9 @@ void xt_notify_end_process(XtPointer client, int *fid, process_data->end_process = TRUE; -/* double deletion! - if (process_data->pid > 0) + if (process_data->pid > 0) // synchronous delete process_data; else -*/ process_data->pid = 0; } @@ -165,9 +163,7 @@ long wxExecute(char **argv, bool sync, wxProcess *handler) printf ("wxWindows: could not execute '%s'\n", *argv); _exit (-1); } - if (!sync) - return pid; - + wxLocalProcessData *process_data = new wxLocalProcessData; process_data->end_process = 0; @@ -180,15 +176,17 @@ long wxExecute(char **argv, bool sync, wxProcess *handler) (XtInputCallbackProc) xt_notify_end_process, (XtPointer) process_data); - while (!process_data->end_process) - XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll); - - if (WIFEXITED(process_data->end_process) != 0) + if (sync) { - delete process_data; - return WEXITSTATUS(process_data->end_process); + while (!process_data->end_process) + XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll); + + if (WIFEXITED(process_data->end_process) != 0) + { +// delete process_data; // Double deletion + return WEXITSTATUS(process_data->end_process); + } } - delete process_data; return pid; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index c80243a3e8..00c1843de6 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -308,14 +308,6 @@ wxWindow::wxWindow() // Destructor wxWindow::~wxWindow() { - // Remove potential dangling pointer - if (GetParent() && GetParent()->IsKindOf(CLASSINFO(wxPanel))) - { - wxPanel* panel = (wxPanel*) GetParent(); - if (panel->GetLastFocus() == this) - panel->SetLastFocus((wxWindow*) NULL); - } - m_isBeingDeleted = TRUE; // first of all, delete the things on which nothing else depends @@ -1763,7 +1755,7 @@ bool wxWindow::MSWOnSetFocus(WXHWND WXUNUSED(hwnd)) wxWindow *parent = GetParent(); if ( parent && parent->IsKindOf(CLASSINFO(wxPanel)) ) { - ((wxPanel *)parent)->SetLastFocus(this); + ((wxPanel *)parent)->SetLastFocus(GetId()); } wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId); @@ -2201,7 +2193,7 @@ bool wxWindow::MSWOnCommand(WXWORD id, WXWORD cmd, WXHWND control) long wxWindow::MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam) { - switch (wParam && 0xFFFFFFF0) + switch (wParam & 0xFFFFFFF0) { case SC_MAXIMIZE: {