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
This commit is contained in:
Julian Smart
1999-02-18 21:24:11 +00:00
parent dd0e574a0e
commit 0492c5a094
12 changed files with 72 additions and 59 deletions

View File

@@ -101,3 +101,4 @@ An initialized write-only stream.
\wxheading{See also} \wxheading{See also}
\helpref{wxOutputStream}{wxoutputstream} \helpref{wxOutputStream}{wxoutputstream}

View File

@@ -118,9 +118,9 @@ Troubleshooting
functions, try putting the gcc fixinclude file paths early in the functions, try putting the gcc fixinclude file paths early in the
include path. include path.
- If you get strange memory problems (for example in deletion - If you operator-related compile errors or strange memory problems
of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS to 0 in (for example in deletion of string arrays), set wxUSE_GLOBAL_MEMORY_OPERATORS
setup.h, and recompile. and wxUSE_MEMORY_TRACING to 0 in setup.h, and recompile.
- If you get an internal compiler error in gcc, turn off - If you get an internal compiler error in gcc, turn off
optimisations. optimisations.
@@ -128,7 +128,8 @@ Troubleshooting
- Problems with XtDestroyWidget crashing in ~wxWindow have been - Problems with XtDestroyWidget crashing in ~wxWindow have been
reported on SGI IRIX 6.4. This has not yet been resolved, so 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 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 Other Notes
----------- -----------

View File

@@ -19,7 +19,7 @@ Update manual.
Functions Functions
Makefiles and/or IDE files for other compilers: Symantec C++, 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. Check TODO entries in source and manual.

View File

@@ -69,12 +69,12 @@ public:
void OnFocus(wxFocusEvent& event); void OnFocus(wxFocusEvent& event);
// called by wxWindow whenever it gets focus // called by wxWindow whenever it gets focus
void SetLastFocus(wxWindow *focus) { m_lastFocus = focus; } void SetLastFocus(long focus) { m_lastFocus = focus; }
wxWindow* GetLastFocus() const { return m_lastFocus; } long GetLastFocus() const { return m_lastFocus; }
protected: protected:
// the child which had the focus last time this panel was activated // the child which had the focus last time this panel was activated
wxWindow *m_lastFocus; long m_lastFocus;
private: private:
DECLARE_DYNAMIC_CLASS(wxPanel) DECLARE_DYNAMIC_CLASS(wxPanel)

View File

@@ -1,4 +1,3 @@
* Last change: JS 8 Sep 98 9:19 pm
NAME SashTest NAME SashTest
DESCRIPTION 'wxSashWindow Demo' DESCRIPTION 'wxSashWindow Demo'
EXETYPE WINDOWS EXETYPE WINDOWS

View File

@@ -42,7 +42,7 @@ END_EVENT_TABLE()
wxPanel::wxPanel() wxPanel::wxPanel()
{ {
m_lastFocus = NULL; m_lastFocus = 0;
} }
bool wxPanel::Create(wxWindow *parent, wxWindowID id, bool wxPanel::Create(wxWindow *parent, wxWindowID id,
@@ -145,8 +145,12 @@ void wxPanel::OnNavigationKey( wxNavigationKeyEvent& event )
void wxPanel::OnFocus(wxFocusEvent& event) void wxPanel::OnFocus(wxFocusEvent& event)
{ {
if ( m_lastFocus ) if (m_lastFocus != 0)
m_lastFocus->SetFocus(); {
wxWindow* child = FindWindow(m_lastFocus);
if (child)
child->SetFocus();
}
else else
event.Skip(); event.Skip();
} }

View File

@@ -1,29 +1,31 @@
# generic.env # sgi.env
# Linux/generic # SGI
# #
# Common makefile settings for wxWindows programs # Common makefile settings for wxWindows programs
# This file is included by all the other makefiles, thus changes # This file is included by all the other makefiles, thus changes
# made here take effect everywhere (except where overriden). # made here take effect everywhere (except where overriden).
# RCS-ID: $Id$
# #
########################### Programs ################################# ########################### Programs #################################
# Replace this with your own path if necessary # Replace this with your own path if necessary
WXDIR = /home/mon/src/wx20 WXWIN = /home/jds/wx2
WXDIR = $(WXWIN)
# C++ compiler # C++ compiler
CC = CC -n32 -D__SGI__ -D__SGI_CC__ CC = CC
# C compiler # C compiler
CCC = cc -n32 -Xcpluscomm -D__SGI__ -D__SGI_CC__ CCC = cc
# Compiler for lex/yacc .c programs # Compiler for lex/yacc .c programs
CCLEX = $(CCC) CCLEX = $(CCC)
LEX = flex LEX = lex
YACC = yacc YACC = yacc
MAKE = make MAKE = make
AROPTIONS = ruv AROPTIONS = ruv
RANLIB = echo ranlib not required on SGI RANLIB = echo
############################ Switches ################################# ############################ Switches #################################
@@ -35,32 +37,31 @@ GUISUFFIX = _stubs
########################## Compiler flags ############################# ########################## Compiler flags #############################
# Misc options # Misc options
OPTIONS = -D__WXDEBUG__ # -DDEBUG='$(DEBUG)' # -DWXDEBUG OPTIONS = -32 -D__WXDEBUG__ -D__SGI__ -D__SGI_CC__
COPTIONS = COPTIONS = -32 -Xcpluscomm -D__SGI__ -D__SGI_CC__
DEBUGFLAGS = -g DEBUGFLAGS = -g3
INCLUDE = INCLUDE =
WARN = WARN = -w
CWARN = CWARN = -w
OPT = # -O2 OPT =
############################ Includes ################################# ############################ Includes #################################
# Compiler or system-specific include paths # Compiler or system-specific include paths
COMPPATHS = COMPPATHS =
XINCLUDE = -I/usr/include/X11 -I/usr/include/Xm \ XINCLUDE = -I/usr/include/X11 -I/usr/include/Xm \
-I/usr/include/X11/Xm -I/usr/include -I/usr/include/X11/Xm -I/usr/include
XLIB = -L/usr/local/X11/lib -L/usr/X11/lib -L/usr/X11R6/lib XLIB = -L/usr/local/X11/lib -L/usr/X11/lib -L/usr/X11R6/lib
############################ Libraries ################################ ############################ Libraries ################################
COMPLIBS = #-lstdc++ COMPLIBS =
#COMPLIBS = -lstdc++
#COMPLIBS = -lPW
GUILDLIBS = -lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lXpm -lX11 -lm GUILDLIBS = -lwx_stubs $(COMPLIBS) -lXm -lXmu -lXt -lXpm -lX11 -lm
############################# Suffixes ################################ ############################# 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 OBJSUFF =o
SRCSUFF =cpp SRCSUFF =cpp
MAINSUFF =cpp MAINSUFF =cpp
@@ -111,9 +112,6 @@ cleanstubs:
cleanmotif: cleanmotif:
make -f makefile.unx clean GUI='-D__WXMOTIF__ -D__UNIX__' GUISUFFIX='_motif' GUILDLIBS='-lwx_motif $(COMPLIBS) -lXm -lXmu -lXt -lX11 -lm' 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): $(OBJDIR):
mkdir $(OBJDIR) mkdir $(OBJDIR)

View File

@@ -30,7 +30,8 @@ OBJSUFF=obj
SRCSUFF=cpp SRCSUFF=cpp
# If you set wxUSE_IOSTREAMH to 0, remove -Dtry=__try -Dexcept=__except -Dleave=__leave -Dfinally=__finally # 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=/NODEFAULTLIB /INCREMENTAL:NO /NOLOGO -align:0x1000 -machine:$(CPU) -subsystem:windows,$(APPVER)
WINLINKFLAGS=/INCREMENTAL:NO /NOLOGO -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\ #WINLIBS=kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib libc.lib oldnames.lib\

View File

@@ -44,6 +44,7 @@
#include <Xm/AtomMgr.h> #include <Xm/AtomMgr.h>
#include <Xm/LabelG.h> #include <Xm/LabelG.h>
#include <Xm/Frame.h> #include <Xm/Frame.h>
#include <Xm/DrawingA.h>
#if XmVersion > 1000 #if XmVersion > 1000
#include <Xm/Protocols.h> #include <Xm/Protocols.h>
#endif #endif
@@ -56,6 +57,10 @@ void wxFrameFocusProc(Widget workArea, XtPointer clientData,
static void wxFrameMapProc(Widget frameShell, XtPointer clientData, static void wxFrameMapProc(Widget frameShell, XtPointer clientData,
XCrossingEvent * event); 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 wxModelessWindows;
extern wxList wxPendingDelete; extern wxList wxPendingDelete;
@@ -190,11 +195,13 @@ bool wxFrame::Create(wxWindow *parent,
// XmNresizePolicy, XmRESIZE_ANY, // XmNresizePolicy, XmRESIZE_ANY,
NULL); NULL);
XtAddCallback ((Widget) m_clientArea, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this);
XtAddCallback ((Widget) m_clientArea, XmNinputCallback, (XtCallbackProc) wxCanvasInputEvent, (XtPointer) this);
XtVaSetValues((Widget) m_frameWidget, XtVaSetValues((Widget) m_frameWidget,
XmNworkWindow, (Widget) m_workArea, XmNworkWindow, (Widget) m_workArea,
NULL); NULL);
XtManageChild((Widget) m_clientArea); XtManageChild((Widget) m_clientArea);
XtManageChild((Widget) m_workArea); XtManageChild((Widget) m_workArea);
@@ -289,7 +296,10 @@ wxFrame::~wxFrame()
{ {
if (GetMainWidget()) if (GetMainWidget())
Show(FALSE); Show(FALSE);
XtRemoveCallback ((Widget) m_clientArea, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this);
XtRemoveCallback ((Widget) m_clientArea, XmNinputCallback, (XtCallbackProc) wxCanvasInputEvent, (XtPointer) this);
if (m_frameMenuBar) if (m_frameMenuBar)
{ {
m_frameMenuBar->DestroyMenuBar(); m_frameMenuBar->DestroyMenuBar();

View File

@@ -25,6 +25,7 @@
#include <Xm/CascadeBG.h> #include <Xm/CascadeBG.h>
#include <Xm/Text.h> #include <Xm/Text.h>
#include <Xm/PushBG.h> #include <Xm/PushBG.h>
#include <Xm/DrawingA.h>
#include <Xm/AtomMgr.h> #include <Xm/AtomMgr.h>
#include <Xm/Protocols.h> #include <Xm/Protocols.h>
@@ -36,6 +37,10 @@ extern wxList wxModelessWindows;
extern void wxFrameFocusProc(Widget workArea, XtPointer clientData, extern void wxFrameFocusProc(Widget workArea, XtPointer clientData,
XmAnyCallbackStruct *cbs); 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 #define wxID_NOTEBOOK_CLIENT_AREA wxID_HIGHEST + 100
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
@@ -341,6 +346,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
XmNresizePolicy, XmRESIZE_NONE, XmNresizePolicy, XmRESIZE_NONE,
NULL); NULL);
XtAddCallback ((Widget) m_mainWidget, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this);
SetCanAddEventHandler(TRUE); SetCanAddEventHandler(TRUE);
AttachWidget (parent, m_mainWidget, (WXWidget) NULL, pos.x, pos.y, size.x, size.y); 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() wxMDIChildFrame::~wxMDIChildFrame()
{ {
XtRemoveCallback ((Widget) m_mainWidget, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this);
if (GetMDIParentFrame()) if (GetMDIParentFrame())
{ {
wxMDIParentFrame* parentFrame = GetMDIParentFrame(); wxMDIParentFrame* parentFrame = GetMDIParentFrame();

View File

@@ -110,11 +110,9 @@ void xt_notify_end_process(XtPointer client, int *fid,
process_data->end_process = TRUE; process_data->end_process = TRUE;
/* double deletion! if (process_data->pid > 0) // synchronous
if (process_data->pid > 0)
delete process_data; delete process_data;
else else
*/
process_data->pid = 0; process_data->pid = 0;
} }
@@ -165,9 +163,7 @@ long wxExecute(char **argv, bool sync, wxProcess *handler)
printf ("wxWindows: could not execute '%s'\n", *argv); printf ("wxWindows: could not execute '%s'\n", *argv);
_exit (-1); _exit (-1);
} }
if (!sync)
return pid;
wxLocalProcessData *process_data = new wxLocalProcessData; wxLocalProcessData *process_data = new wxLocalProcessData;
process_data->end_process = 0; process_data->end_process = 0;
@@ -180,15 +176,17 @@ long wxExecute(char **argv, bool sync, wxProcess *handler)
(XtInputCallbackProc) xt_notify_end_process, (XtInputCallbackProc) xt_notify_end_process,
(XtPointer) process_data); (XtPointer) process_data);
while (!process_data->end_process) if (sync)
XtAppProcessEvent((XtAppContext) wxTheApp->GetAppContext(), XtIMAll);
if (WIFEXITED(process_data->end_process) != 0)
{ {
delete process_data; while (!process_data->end_process)
return WEXITSTATUS(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; delete process_data;
return pid; return pid;

View File

@@ -308,14 +308,6 @@ wxWindow::wxWindow()
// Destructor // Destructor
wxWindow::~wxWindow() 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; m_isBeingDeleted = TRUE;
// first of all, delete the things on which nothing else depends // first of all, delete the things on which nothing else depends
@@ -1763,7 +1755,7 @@ bool wxWindow::MSWOnSetFocus(WXHWND WXUNUSED(hwnd))
wxWindow *parent = GetParent(); wxWindow *parent = GetParent();
if ( parent && parent->IsKindOf(CLASSINFO(wxPanel)) ) if ( parent && parent->IsKindOf(CLASSINFO(wxPanel)) )
{ {
((wxPanel *)parent)->SetLastFocus(this); ((wxPanel *)parent)->SetLastFocus(GetId());
} }
wxFocusEvent event(wxEVT_SET_FOCUS, m_windowId); 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) long wxWindow::MSWOnSysCommand(WXWPARAM wParam, WXLPARAM lParam)
{ {
switch (wParam && 0xFFFFFFF0) switch (wParam & 0xFFFFFFF0)
{ {
case SC_MAXIMIZE: case SC_MAXIMIZE:
{ {