]> git.saurik.com Git - wxWidgets.git/commitdiff
Cured last focus bug (I hope); some wxMotif mods
authorJulian Smart <julian@anthemion.co.uk>
Thu, 18 Feb 1999 21:24:11 +0000 (21:24 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 18 Feb 1999 21:24:11 +0000 (21:24 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1724 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
docs/latex/wx/ftp.tex
docs/motif/install.txt
docs/msw/todo.txt
include/wx/generic/panelg.h
samples/sashtest/sashtest.def
src/generic/panelg.cpp
src/makeenvs/sgi.env
src/makevc.env
src/motif/frame.cpp
src/motif/mdi.cpp
src/motif/utilsexc.cpp
src/msw/window.cpp

index b7e337ed920cb482faa342c02dfebb550d00b692..c484054d96f039878327aa2a66ccf7a22aa22572 100644 (file)
@@ -101,3 +101,4 @@ An initialized write-only stream.
 \wxheading{See also}
 
 \helpref{wxOutputStream}{wxoutputstream}
+
index 1e4e0a68a261aed4ad4eb51d883bd1e79fe1f33b..25e82c7cfcd09c18e187706c165b83be290f29b0 100644 (file)
@@ -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
 -----------
index 287bf16df9b58b7971d248eee5da5a1c67792dd6..091a048152a5ba6ef29a654bb6cfe1a0cce631a6 100644 (file)
@@ -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.
 
index a6e983e0244bc427e70b45050cf0e6943db746a3..c60d17f393e0962c10da0a6d2bb7d5d61f4a36e7 100644 (file)
@@ -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)
index f323e40e57fb7921f8844a5d21fd0802e7dc7dd4..021e6bc7bb634862eb9982e4160ac682d95d9827 100644 (file)
@@ -1,4 +1,3 @@
-      *   Last change:  JS    8 Sep 98    9:19 pm
 NAME         SashTest
 DESCRIPTION  'wxSashWindow Demo'
 EXETYPE      WINDOWS
index 83d3d1fd6e6f90b0c3e6918cb322cd2d79893fd6..f96bb1701b8c1fa32cde06ec55ffe081a5eded92 100644 (file)
@@ -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();
 }
index 42c933aa66868957d11a0a3ab204bf917df303d3..64d10750c65c7a98eb1fbd8636c5813298b08330 100644 (file)
@@ -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)
 
index a7ee45318724204a994bd1f8b21a37033644d0a2..b8166cc439a1f9eb9b589ad564c998146c753a34 100644 (file)
@@ -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\
index 024c031119bdd08bcb27c906cdf73f9bf718683b..d024c6db916724d7f65fc6edfcf80aec869fcd3d 100644 (file)
@@ -44,6 +44,7 @@
 #include <Xm/AtomMgr.h>
 #include <Xm/LabelG.h>
 #include <Xm/Frame.h>
+#include <Xm/DrawingA.h>
 #if   XmVersion > 1000
 #include <Xm/Protocols.h>
 #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();
index 642a441daaa365a2f1a4807d2674a47e748b4b4a..f6d2dc6e6b0772e958d1cf41ae50229978c76915 100644 (file)
@@ -25,6 +25,7 @@
 #include <Xm/CascadeBG.h>
 #include <Xm/Text.h>
 #include <Xm/PushBG.h>
+#include <Xm/DrawingA.h>
 #include <Xm/AtomMgr.h>
 #include <Xm/Protocols.h>
 
@@ -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();
index 82a89b652a8b81f6f1046784239b4efe118b599f..30788095c6854c8a2ad059fb5be3ef44f32d61a1 100644 (file)
@@ -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;
index c80243a3e837d6e01e258ae7c5789e6b16b31113..00c1843de60d38e461260dd9c26e7c0956a167a3 100644 (file)
@@ -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:
         {