/* ** Temporary event handlers for keys pressed after the mark or goto-mark ** commands, If the key is valid, grab the key event and call the action ** procedure to mark (or go to) the selection, otherwise, remove the handler ** and give up. */ static void processMarkEvent(Widget w, XtPointer clientData, XEvent *event, Boolean *continueDispatch, char *action, int extend) { XKeyEvent *e = (XKeyEvent *)event; WindowInfo *window = WidgetToWindow(w); Modifiers modifiers; KeySym keysym; char *params[2], string[2]; XtTranslateKeycode(TheDisplay, e->keycode, e->state, &modifiers, &keysym); if ((keysym >= 'A' && keysym <= 'Z') || (keysym >= 'a' && keysym <= 'z')) { string[0] = toupper(keysym); string[1] = '\0'; params[0] = string; params[1] = "extend"; XtCallActionProc(window->lastFocus, action, event, params, extend ? 2 : 1); *continueDispatch = False; } XtRemoveEventHandler(w, KeyPressMask, False, markKeyCB, window); XtRemoveEventHandler(w, KeyPressMask, False, gotoMarkKeyCB, window); XtRemoveEventHandler(w, KeyPressMask, False, gotoMarkExtendKeyCB, window); XtRemoveTimeOut(window->markTimeoutID); }
/*----------------------------------------------------------------------*/ /* extern */ void XfeChildrenRemoveEventHandler(Widget w, EventMask event_mask, Boolean nonmaskable, XtEventHandler proc, XtPointer data) { Widget * children; Cardinal num_children; Cardinal i; assert( _XfeIsAlive(w) ); assert( XtIsComposite(w) ); XfeChildrenGet(w,&children,&num_children); for (i = 0; i < num_children; i++) { if (_XfeIsAlive(w)) { XtRemoveEventHandler(children[i],event_mask,nonmaskable,proc,data); } XtRemoveEventHandler(children[i],event_mask,nonmaskable,proc,data); } }
wxFrame::~wxFrame() { m_isBeingDeleted = true; if (m_clientArea) { XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, False, wxUniversalRepaintProc, (XtPointer) this); } if (GetMainWidget()) Show(false); if (m_frameMenuBar) { m_frameMenuBar->DestroyMenuBar(); delete m_frameMenuBar; m_frameMenuBar = NULL; } if (m_frameStatusBar) { delete m_frameStatusBar; m_frameStatusBar = NULL; } PreDestroy(); Widget frameShell = (Widget)GetShellWidget(); if( frameShell ) XtRemoveEventHandler( frameShell, StructureNotifyMask, False, (XtEventHandler)wxFrameMapProc, (XtPointer)this ); if( m_clientArea ) { wxDeleteWindowFromTable( (Widget)m_clientArea ); XtDestroyWidget( (Widget)m_clientArea ); } if( m_workArea ) { XtVaSetValues( (Widget)m_mainWidget, XmNworkWindow, (Widget)NULL, NULL ); wxDeleteWindowFromTable( (Widget)m_workArea ); XtDestroyWidget( (Widget)m_workArea ); } if( m_mainWidget ) XtDestroyWidget( (Widget)m_mainWidget ); if( frameShell ) XtDestroyWidget( frameShell ); }
/* ** Xt timer procedure for removing event handler if user failed to type a ** mark character withing the allowed time */ static void markTimeoutProc(XtPointer clientData, XtIntervalId *id) { Widget w = (Widget)clientData; WindowInfo *window = WidgetToWindow(w); XtRemoveEventHandler(w, KeyPressMask, False, markKeyCB, window); XtRemoveEventHandler(w, KeyPressMask, False, gotoMarkKeyCB, window); XtRemoveEventHandler(w, KeyPressMask, False, gotoMarkExtendKeyCB, window); window->markTimeoutID = 0; }
void AttachArea::unmanage() { int i; Attachment **list = getList(); // Unmanage the widgets it currently has for (i=0; i<getIconCount(); i++) list[i]->unmanageIconWidget(); XtRemoveCallback( _clipWindow, XmNresizeCallback, &AttachArea::resizeCallback, (XtPointer) this ); XtRemoveCallback( _clipWindow, XmNinputCallback, &AttachArea::inputCallback, (XtPointer) this ); XtRemoveEventHandler( _clipWindow, ButtonPressMask, FALSE, MenuButtonHandler, (XtPointer) this); UIComponent::unmanage(); }
void wxTopLevelWindowMotif::PreDestroy() { #ifdef __VMS #pragma message disable codcauunr #endif if ( (GetWindowStyleFlag() & wxDIALOG_MODAL) != wxDIALOG_MODAL ) wxModelessWindows.DeleteObject(this); #ifdef __VMS #pragma message enable codcauunr #endif m_icons.m_icons.Empty(); DestroyChildren(); // MessageDialog and FileDialog do not have a client widget if( GetClientWidget() ) { XtRemoveEventHandler( (Widget)GetClientWidget(), ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask, False, wxTLWEventHandler, (XtPointer)this ); } }
extern void XltWaitTillMapped(Widget dialog) { XWindowAttributes window_attributes; Boolean mapped = False; Widget w = dialog; while (!XtIsShell(w)) w = XtParent(w); XGetWindowAttributes(XtDisplay(w), XtWindow(w), &window_attributes); if (window_attributes.map_state == IsUnmapped) { XtAddEventHandler(w, StructureNotifyMask, False, (XtEventHandler)StructureNotifyHandler, (XtPointer)&mapped); while (/*XtIsManaged(w) &&*/ !mapped) { XtAppProcessEvent(XtWidgetToApplicationContext(w), XtIMXEvent); } XtRemoveEventHandler(w, StructureNotifyMask, False, (XtEventHandler)StructureNotifyHandler, (XtPointer)&mapped); } XmUpdateDisplay(w); }
static void PropertyChangeXtHandler(Widget w, XtPointer closure, XEvent *event, Boolean *continue_to_dispatch) { if (w == topLevel && event->type == PropertyNotify && event->xproperty.atom == wmStateAtom) { XtRemoveEventHandler (topLevel, PropertyChangeMask, False, PropertyChangeXtHandler, NULL); /* * Restart the rest of the session aware clients. */ Restart (RESTART_REST_OF_CLIENTS); /* * Start apps that aren't session aware that were specified * by the user. */ StartNonSessionAwareApps (); } }
wxFrame::~wxFrame() { m_isBeingDeleted = true; if (m_clientArea) { XtRemoveEventHandler((Widget) m_clientArea, ExposureMask, False, wxUniversalRepaintProc, (XtPointer) this); } if (GetMainWidget()) Show(false); if (m_frameMenuBar) { m_frameMenuBar->DestroyMenuBar(); // Hack to stop core dump on Ultrix, OSF, for some strange reason. #if MOTIF_MENUBAR_DELETE_FIX GetMenuBar()->SetMainWidget((WXWidget) NULL); #endif delete m_frameMenuBar; m_frameMenuBar = NULL; } if (m_frameStatusBar) { delete m_frameStatusBar; m_frameStatusBar = NULL; } PreDestroy(); DoDestroy(); }
/* * EventHandler: rubberband action is completed... * Call rubberband_finish() which calls the rubber * band func. */ static void rubberband_release( Widget widget, XtPointer client_data, XEvent *event, Boolean *cont_dispatch ) { if (event->type != ButtonRelease) return; if (rband_in_progress) { XtUngrabPointer(widget, CurrentTime); XtRemoveEventHandler(widget, ButtonReleaseMask, False, rubberband_release, client_data); rband_in_progress = False; if (just_rbanded) { rubberband_finish(widget, event, client_data); just_rbanded = False; *cont_dispatch = False; } } }
wxDialog::~wxDialog() { m_isBeingDeleted = true; delete m_eventLoop; if (m_mainWidget) { XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask, False, wxUniversalRepaintProc, (XtPointer) this); } m_modalShowing = false; #if !wxUSE_INVISIBLE_RESIZE if (m_mainWidget) { XtUnmapWidget((Widget) m_mainWidget); } #endif PreDestroy(); if ( m_mainWidget ) { wxDeleteWindowFromTable( (Widget)m_mainWidget ); XtDestroyWidget( (Widget)m_mainWidget ); } }
int EZX_WaitForButtonIn(XtAppContext app_context, Widget widget, int *xp, int *yp) { XEvent event; int button_was_pressed = FALSE; XtAddEventHandler(widget, ButtonPressMask, FALSE, (XtEventHandler) do_nothing, NULL); do { XtAppNextEvent(app_context, &event); if (event.type == ButtonPress) { button_was_pressed = TRUE; theButtonEvent=event.xbutton; } } while (!button_was_pressed); /* Disable being able to press the mouse button over the bitmap */ XtRemoveEventHandler(widget, ButtonPressMask, FALSE, (XtEventHandler) do_nothing, NULL); *xp = theButtonEvent.x; *yp = theButtonEvent.y; if (theButtonEvent.button == Button1) return(LEFT_BUTTON); else if (theButtonEvent.button == Button2) return(MIDDLE_BUTTON); else if (theButtonEvent.button == Button3) return(RIGHT_BUTTON); else return(OTHER_BUTTON); }
wxDialog::~wxDialog() { SendDestroyEvent(); // if the dialog is modal, this will end its event loop Show(false); delete m_eventLoop; if (m_mainWidget) { XtRemoveEventHandler((Widget) m_mainWidget, ExposureMask, False, wxUniversalRepaintProc, (XtPointer) this); } m_modalShowing = false; #if !wxUSE_INVISIBLE_RESIZE if (m_mainWidget) { XtUnmapWidget((Widget) m_mainWidget); } #endif PreDestroy(); if ( m_mainWidget ) { wxDeleteWindowFromTable( (Widget)m_mainWidget ); XtDestroyWidget( (Widget)m_mainWidget ); } }
void wxFrame::DoDestroy() { Widget frameShell = (Widget)GetShellWidget(); if( frameShell ) XtRemoveEventHandler( frameShell, StructureNotifyMask, False, (XtEventHandler)wxFrameMapProc, (XtPointer)this ); if( m_clientArea ) { wxDeleteWindowFromTable( (Widget)m_clientArea ); XtDestroyWidget( (Widget)m_clientArea ); } if( m_workArea ) { XtVaSetValues( (Widget)m_mainWidget, XmNworkWindow, (Widget)NULL, NULL ); wxDeleteWindowFromTable( (Widget)m_workArea ); XtDestroyWidget( (Widget)m_workArea ); } if( m_mainWidget ) XtDestroyWidget( (Widget)m_mainWidget ); if( frameShell ) XtDestroyWidget( frameShell ); }
// Relacement for Qt function - add Xt stuff for top-level widgets void qt_XDestroyWindow( const QWidget* qw, Display *display, Window window ) { if ( qw->isTopLevel() && !qw->isA("QNPWidget") ) { Widget xtw = XtWindowToWidget( display, window ); if ( xtw ) { XtRemoveEventHandler(xtw, LeaveWindowMask, TRUE, leave_event_handler, 0); XtRemoveEventHandler(xtw, EnterWindowMask, TRUE, enter_event_handler, 0); XtDestroyWidget( xtw ); } else { XDestroyWindow( display, window ); } } else { XDestroyWindow( display, window ); } }
/*! For internal use only. */ void QNPWidget::unsetWindow() { #ifdef _WS_X11_ WId wi = winId(); Widget w = XtWindowToWidget (qt_xdisplay(), wi); if ( w ) { XtRemoveEventHandler(w, LeaveWindowMask, FALSE, leave_event_handler, pi); XtRemoveEventHandler(w, EnterWindowMask, FALSE, enter_event_handler, pi); } destroy( FALSE, FALSE ); // Xt has already destroyed all the windows #endif #ifdef _WS_WIN_ // Nothing special destroy( FALSE, TRUE ); // Browser will the window, but not the subwindows #endif }
void Container::DoEndUpdate() { XtRemoveEventHandler(XtParent(_workArea), ExposureMask, FALSE, &Container::UpdateAreaMessage, (XtPointer) this); StringFree(_xm_update_message); if (XtIsRealized(_workArea)) XClearArea(display, XtWindow(XtParent(_workArea)), 0, 0, 0, 0, TRUE); _xm_update_message = NULL; if (_container_type == SCROLLED_WORK_AREA || _container_type == WORK_AREA || _container_type == SCROLLED_ICON_LIST || _container_type == ICON_LIST) { if (XtIsRealized(_workArea)) XtMapWidget(_workArea); GuiWorkAreaEnableRedisplay(_workArea); XmDropSiteEndUpdate(XtParent(_workArea)); } else { XtManageChild(_workArea); if (_container_type == SCROLLED_HORIZONTAL_ROW_COLUMN) XtAppAddTimeOut(appContext, 500, ResizeTimeOut, this); } }
// Doc in superclass. void SoXtKeyboard::disable(Widget widget, SoXtEventHandler * handler, void * closure) { // FIXME: should explicitly convert eventmask to bitmask with X11/Xt // bitflag values, just in case either our or X11's enum values // should ever change (yeah, I know, slim chance, but still.. that'd // be better design). 20020625 mortene. XtRemoveEventHandler(widget, PRIVATE(this)->eventmask, FALSE, handler, closure); }
static void xt_remove_focus_listener(Widget w, XtPointer user_data) { trap_errors (); XtRemoveEventHandler(w, SubstructureNotifyMask | ButtonReleaseMask, TRUE, (XtEventHandler)xt_client_focus_listener, user_data); untrap_error(); }
static void xt_client_destroy (XtClient* xtclient) { if(xtclient->top_widget) { XtRemoveEventHandler(xtclient->child_widget, 0x0FFFFF, TRUE, (XtEventHandler)xt_client_event_handler, xtclient); XtDestroyWidget(xtclient->top_widget); xtclient->top_widget = NULL; } }
void ui_remove_window_iconify_handler( Widget shell, XtEventHandler iconify_proc, XtPointer client_data ) { XtRemoveEventHandler(shell, StructureNotifyMask, False, iconify_proc, (XtPointer)client_data); }
void xt_client_destroy (XtClient* xtclient) { if(xtclient->top_widget) { XtRemoveEventHandler(xtclient->child_widget, StructureNotifyMask | KeyPressMask, TRUE, (XtEventHandler)xt_client_event_handler, xtclient); XtDestroyWidget(xtclient->top_widget); xtclient->top_widget = NULL; } }
static void motDialogUnMapMethod(Ihandle* ih) { Widget dialog_manager; if (ih->data->menu) { ih->data->menu->handle = NULL; /* the dialog will destroy the native menu */ IupDestroy(ih->data->menu); } dialog_manager = XtNameToWidget(ih->handle, "*dialog_manager"); XtVaSetValues(dialog_manager, XmNuserData, NULL, NULL); XtRemoveEventHandler(ih->handle, FocusChangeMask, False, (XtEventHandler)iupmotFocusChangeEvent, (XtPointer)ih); XtRemoveEventHandler(ih->handle, KeyPressMask, False, (XtEventHandler)iupmotKeyPressEvent, (XtPointer)ih); XtRemoveEventHandler(ih->handle, StructureNotifyMask, False, (XtEventHandler)motDialogCBStructureNotifyEvent, (XtPointer)ih); XtRemoveCallback(ih->handle, XmNdestroyCallback, (XtCallbackProc)motDialogDestroyCallback, (XtPointer)ih); XtRemoveEventHandler(dialog_manager, KeyPressMask, False, (XtEventHandler)iupmotKeyPressEvent, (XtPointer)ih); XtRemoveCallback(dialog_manager, XmNhelpCallback, (XtCallbackProc)iupmotHelpCallback, (XtPointer)ih); iupdrvBaseUnMapMethod(ih); }
/*ARGSUSED*/ static void TreeUpdateHandler( Widget w, XtPointer client, XtPointer call ) { XmAnyCallbackStruct *anyCB = (XmAnyCallbackStruct *)call; XmDisplay dd = (XmDisplay) XmGetXmDisplay(XtDisplay(w)); if (dd->display.dragReceiverProtocolStyle == XmDRAG_NONE) return; switch(anyCB->reason) { case XmCR_DROP_SITE_TREE_ADD: { XmDropSiteTreeAddCallback cb = (XmDropSiteTreeAddCallback)anyCB; if (XtIsRealized(cb->rootShell)) { _XmSetDragReceiverInfo(dd, cb->rootShell); } else { XtAddEventHandler(cb->rootShell, StructureNotifyMask, False, SetDragReceiverInfo, (XtPointer)cb->rootShell); } /* * ClientMessages are not maskable so all we have to * do is indicate interest in non-maskable events. */ XtAddEventHandler(cb->rootShell, NoEventMask, True, ReceiverShellExternalSourceHandler, (XtPointer)dd); } break; case XmCR_DROP_SITE_TREE_REMOVE: { XmDropSiteTreeRemoveCallback cb = (XmDropSiteTreeRemoveCallback)anyCB; XtRemoveEventHandler(cb->rootShell, NoEventMask, True, ReceiverShellExternalSourceHandler, (XtPointer)dd); if (XtIsRealized(cb->rootShell)) _XmClearDragReceiverInfo(cb->rootShell); } break; default: break; } }
static void errParentMap( Widget w, XtPointer client_data, XEvent *event ) { if (event->type == MapNotify) { XtManageChild(style.errDialog); /* ring the bell (PM behavior) */ XBell(style.display, 0); XtRemoveEventHandler(XtParent(style.errParent), StructureNotifyMask, 0, (XtEventHandler)errParentMap, NULL); } }
/*ARGSUSED*/ static void SetDragReceiverInfo( Widget w, XtPointer client_data, XEvent *event, Boolean *dontSwallow ) { XmDisplay dd = (XmDisplay) XmGetXmDisplay(XtDisplay(w)); if (XtIsRealized(w)) { _XmSetDragReceiverInfo(dd, (Widget)client_data); XtRemoveEventHandler(w, StructureNotifyMask, False, SetDragReceiverInfo, client_data); } }
static void DelayedConnect(Widget W, Widget FD, XConfigureEvent * event) { #ifdef DEBUG printf("DelayedConnect()\n"); #endif if (event->type == MapNotify) { XtRemoveEventHandler(W, StructureNotifyMask, False, (XtEventHandler)DelayedConnect, FD); Connect(FD); } }
void wxTopLevelWindowMotif::PreDestroy() { wxModelessWindows.DeleteObject(this); DestroyChildren(); // MessageDialog and FileDialog do not have a client widget if( GetClientWidget() ) { XtRemoveEventHandler( (Widget)GetClientWidget(), ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask, False, wxTLWEventHandler, (XtPointer)this ); } }
void FakeFocusIn( Widget focus_widget, XtPointer client_data, XEvent *eventprm, Boolean *continue_to_dispatch ) { XEvent event; XEvent * eventPtr = &event; #ifdef VG_TRACE vg_TRACE_EXECUTION("main: entered FakeFocusIn ..."); #endif /* VG_TRACE */ /* * set the input focus to the login text widget... */ XSetInputFocus( XtDisplay(focus_widget), XtWindow(focus_widget), RevertToNone, CurrentTime); /* * create a synthetic focus-in event. * * Note: The above call to XSetInputFocus() was not originally included * in this routine. A bug fix to Motif made it necessary to add * the call. The synthetic focus-in event is probably now * unnecessary but is left in for caution's sake. (12/08/92) */ /* focus_widget = login_shell; */ eventPtr->type = FocusIn; eventPtr->xfocus.serial = LastKnownRequestProcessed(XtDisplay(focus_widget)); eventPtr->xfocus.send_event = True; eventPtr->xfocus.display = XtDisplay(focus_widget); eventPtr->xfocus.window = XtWindow(focus_widget); eventPtr->xfocus.mode = NotifyNormal; eventPtr->xfocus.detail = NotifyAncestor; XtDispatchEvent (eventPtr); ProcessTraversal(focus_widget, XmTRAVERSE_CURRENT); XtRemoveEventHandler(focus_widget, ExposureMask, FALSE, FakeFocusIn, NULL); }
void SoXtGLWidgetP::cleanupGLWidget(void) { if (this->glxwidget) { XtRemoveEventHandler(this->glxwidget, ExposureMask | StructureNotifyMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask | KeyPressMask | KeyReleaseMask, False, (void (*)(_WidgetRec *, void *, _XEvent *, char *)) SoXtGLWidget::eventHandler, PUBLIC(this)); XtRemoveCallback(this->glxwidget, SoXtNexposeCallback, SoXtGLWidgetP::exposeCB, this); PUBLIC(this)->unregisterWidget(this->glxwidget); this->glxwidget = NULL; } }