Fixed wxMotif's wxExecute again, added OnPaint capability to wxFrame,

removed old focus code from wxGTK's ~wxWindow


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1725 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1999-02-18 22:51:03 +00:00
parent 0492c5a094
commit 2e35f56f6d
10 changed files with 67 additions and 88 deletions

View File

@@ -17,10 +17,12 @@ wxMSW:
with names wx.lib, wx_d.lib, wx200.lib(dll), wx200_d.lib(dll). with names wx.lib, wx_d.lib, wx200.lib(dll), wx200_d.lib(dll).
- Added BC++ 5 IDE files and instructions. - Added BC++ 5 IDE files and instructions.
- Fixed wxChoice, wxComboBox constructor bugs (m_noStrings initialisation). - Fixed wxChoice, wxComboBox constructor bugs (m_noStrings initialisation).
- Fixed focus-related crash.
wxMotif: wxMotif:
- Cured asynchronous wxExecute crash. - Cured asynchronous wxExecute crash.
- Added repaint event handlers to wxFrame, wxMDIChildFrame.
General: General:

View File

@@ -32,6 +32,8 @@ High Priority
- Use wxImage to load other formats into wxBitmaps, such as PNG, BMP. - Use wxImage to load other formats into wxBitmaps, such as PNG, BMP.
- Allow wxFrame and other widgets to have mouse event handlers.
Low Priority Low Priority
------------ ------------

View File

@@ -41,6 +41,9 @@ extern int wxComputeColours (Display *display, wxColour * back, wxColour * fore)
extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour); extern void wxDoChangeForegroundColour(WXWidget widget, wxColour& foregroundColour);
extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE); extern void wxDoChangeBackgroundColour(WXWidget widget, wxColour& backgroundColour, bool changeArmColour = FALSE);
// For repainting arbitrary windows
void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *);
#define wxNO_COLORS 0x00 #define wxNO_COLORS 0x00
#define wxBACK_COLORS 0x01 #define wxBACK_COLORS 0x01
#define wxFORE_COLORS 0x02 #define wxFORE_COLORS 0x02

View File

@@ -1526,14 +1526,6 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
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_hasVMT = FALSE; m_hasVMT = FALSE;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP

View File

@@ -1526,14 +1526,6 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id,
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_hasVMT = FALSE; m_hasVMT = FALSE;
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP

View File

@@ -42,7 +42,6 @@
#include "wx/motif/private.h" #include "wx/motif/private.h"
static void wxCloseDialogCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs); static void wxCloseDialogCallback(Widget widget, XtPointer client_data, XmAnyCallbackStruct *cbs);
static void wxDialogBoxRepaintProc(Widget w, XtPointer c_data, XEvent *event, char *);
static void wxDialogBoxEventHandler (Widget wid, static void wxDialogBoxEventHandler (Widget wid,
XtPointer client_data, XtPointer client_data,
XEvent* event, XEvent* event,
@@ -231,7 +230,7 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
SetSize(pos.x, pos.y, size.x, size.y); SetSize(pos.x, pos.y, size.x, size.y);
} }
XtAddEventHandler(dialogShell,ExposureMask,FALSE, XtAddEventHandler(dialogShell,ExposureMask,FALSE,
wxDialogBoxRepaintProc, (XtPointer) this); wxUniversalRepaintProc, (XtPointer) this);
XtAddEventHandler(dialogShell, XtAddEventHandler(dialogShell,
ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask, ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask,
@@ -259,6 +258,10 @@ void wxDialog::SetModal(bool flag)
wxDialog::~wxDialog() wxDialog::~wxDialog()
{ {
if (m_mainWidget)
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask, FALSE,
wxUniversalRepaintProc, (XtPointer) this);
m_modalShowing = FALSE; m_modalShowing = FALSE;
if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget) if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget)
{ {
@@ -615,45 +618,7 @@ static void wxCloseDialogCallback( Widget WXUNUSED(widget), XtPointer client_dat
dialog->GetEventHandler()->ProcessEvent(closeEvent); dialog->GetEventHandler()->ProcessEvent(closeEvent);
} }
// TODO: Preferably, we should have a universal repaint proc. void wxDialogBoxEventHandler (Widget wid,
// Meanwhile, use a special one for dialogs.
static void wxDialogBoxRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *)
{
Window window;
Display *display;
wxWindow* win = (wxWindow *)wxWidgetHashTable->Get((long)w);
if (!win)
return;
switch(event -> type)
{
case Expose :
{
window = (Window) win -> GetXWindow();
display = (Display *) win -> GetXDisplay();
wxRect* rect = new wxRect(event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
win->m_updateRects.Append((wxObject*) rect);
if (event -> xexpose.count == 0)
{
win->DoPaint();
win->ClearUpdateRects();
}
break;
}
default :
{
cout << "\n\nNew Event ! is = " << event -> type << "\n";
break;
}
}
}
static void wxDialogBoxEventHandler (Widget wid,
XtPointer WXUNUSED(client_data), XtPointer WXUNUSED(client_data),
XEvent* event, XEvent* event,
Boolean *continueToDispatch) Boolean *continueToDispatch)

View File

@@ -44,7 +44,6 @@
#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
@@ -57,10 +56,6 @@ 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;
@@ -195,8 +190,8 @@ bool wxFrame::Create(wxWindow *parent,
// XmNresizePolicy, XmRESIZE_ANY, // XmNresizePolicy, XmRESIZE_ANY,
NULL); NULL);
XtAddCallback ((Widget) m_clientArea, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this); XtAddEventHandler((Widget) m_clientArea, ExposureMask,FALSE,
XtAddCallback ((Widget) m_clientArea, XmNinputCallback, (XtCallbackProc) wxCanvasInputEvent, (XtPointer) this); wxUniversalRepaintProc, (XtPointer) this);
XtVaSetValues((Widget) m_frameWidget, XtVaSetValues((Widget) m_frameWidget,
XmNworkWindow, (Widget) m_workArea, XmNworkWindow, (Widget) m_workArea,
@@ -294,12 +289,13 @@ bool wxFrame::Create(wxWindow *parent,
wxFrame::~wxFrame() wxFrame::~wxFrame()
{ {
if (m_clientArea)
XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, FALSE,
wxUniversalRepaintProc, (XtPointer) this);
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,7 +25,6 @@
#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>
@@ -37,10 +36,6 @@ 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
@@ -346,7 +341,8 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
XmNresizePolicy, XmRESIZE_NONE, XmNresizePolicy, XmRESIZE_NONE,
NULL); NULL);
XtAddCallback ((Widget) m_mainWidget, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this); XtAddEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
wxUniversalRepaintProc, (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);
@@ -370,7 +366,9 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
wxMDIChildFrame::~wxMDIChildFrame() wxMDIChildFrame::~wxMDIChildFrame()
{ {
XtRemoveCallback ((Widget) m_mainWidget, XmNexposeCallback, (XtCallbackProc) wxCanvasRepaintProc, (XtPointer) this); if (m_mainWidget)
XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask,FALSE,
wxUniversalRepaintProc, (XtPointer) this);
if (GetMDIParentFrame()) if (GetMDIParentFrame())
{ {

View File

@@ -109,11 +109,13 @@ void xt_notify_end_process(XtPointer client, int *fid,
process_data->process->OnTerminate(process_data->pid, 0); // What should 'status' be? process_data->process->OnTerminate(process_data->pid, 0); // What should 'status' be?
process_data->end_process = TRUE; process_data->end_process = TRUE;
/*
if (process_data->pid > 0) // synchronous if (process_data->pid > 0) // synchronous
delete process_data; delete process_data;
else else
process_data->pid = 0; process_data->pid = 0;
*/
delete process_data;
} }
long wxExecute(char **argv, bool sync, wxProcess *handler) long wxExecute(char **argv, bool sync, wxProcess *handler)
@@ -183,11 +185,9 @@ long wxExecute(char **argv, bool sync, wxProcess *handler)
if (WIFEXITED(process_data->end_process) != 0) if (WIFEXITED(process_data->end_process) != 0)
{ {
// delete process_data; // Double deletion
return WEXITSTATUS(process_data->end_process); return WEXITSTATUS(process_data->end_process);
} }
} }
delete process_data;
return pid; return pid;
#endif #endif

View File

@@ -144,14 +144,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);
}
//// Motif-specific //// Motif-specific
if (GetMainWidget()) if (GetMainWidget())
@@ -3588,3 +3580,40 @@ bool wxNoOptimize::CanOptimize()
return (m_count == 0); return (m_count == 0);
} }
// For repainting arbitrary windows
void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), XEvent *event, char *)
{
Window window;
Display *display;
wxWindow* win = (wxWindow *)wxWidgetHashTable->Get((long)w);
if (!win)
return;
switch(event -> type)
{
case Expose :
{
window = (Window) win -> GetXWindow();
display = (Display *) win -> GetXDisplay();
wxRect* rect = new wxRect(event->xexpose.x, event->xexpose.y,
event->xexpose.width, event->xexpose.height);
win->m_updateRects.Append((wxObject*) rect);
if (event -> xexpose.count == 0)
{
win->DoPaint();
win->ClearUpdateRects();
}
break;
}
default :
{
cout << "\n\nNew Event ! is = " << event -> type << "\n";
break;
}
}
}