Esempio n. 1
0
/*!
  For internal use only.
*/
void QNPWidget::setWindow(bool delold)
{
    saveWId = winId(); // ### Don't need this anymore

    create((WId)pi->window, FALSE, delold);

   if ( delold ) {
      // Make sure they get a show()
      clearWState( WState_Visible );
   }

#ifdef _WS_X11_
    Widget w = XtWindowToWidget (qt_xdisplay(), pi->window);
    XtAddEventHandler(w, EnterWindowMask, FALSE, enter_event_handler, pi);
    XtAddEventHandler(w, LeaveWindowMask, FALSE, leave_event_handler, pi);
    Pixmap bgpm=0;
    XColor col;
    XtVaGetValues(w,
	XtNbackground, &col.pixel,
	XtNbackgroundPixmap, &bgpm,
	0, 0);
    XQueryColor(qt_xdisplay(), x11Colormap(), &col);
    setBackgroundColor(QColor(col.red >> 8, col.green >> 8, col.blue >> 8));
    if (bgpm) {
	// ### Need an under-the-hood function here, or we have to
	// ### rewrite lots of code from QPixmap::convertToImage().
	// ### Doesn't matter yet, because Netscape doesn't ever set
	// ### the background image of the window it gives us.
    }
#endif

    createNewWindowsForAllChildren(this);

    setGeometry( pi->x, pi->y, pi->width, pi->height );
}
Esempio n. 2
0
/*-------------------------------------------------------------------------*/
static Widget qmonCreateCalendarAsk(
Widget parent 
) {
   Widget cal_ok, cal_cancel;

   DENTER(GUI_LAYER, "qmonCreateCalendarAsk");
   
   cal_ask_layout = XmtBuildQueryDialog( parent, "cal_ask_shell",
                           NULL, 0,
                           "cal_ok", &cal_ok,
                           "cal_cancel", &cal_cancel,
                           "cal_name", &cal_name_w,
                           "cal_year", &cal_year_w,
                           "cal_week", &cal_week_w,
                           NULL);

   XtAddCallback(cal_ok, XmNactivateCallback, 
                     qmonCalendarOk, NULL);
   XtAddCallback(cal_cancel, XmNactivateCallback, 
                     qmonCalendarCancel, NULL);

   XtAddEventHandler(XtParent(cal_ask_layout), StructureNotifyMask, False, 
                        SetMinShellSize, NULL);
   XtAddEventHandler(XtParent(cal_ask_layout), StructureNotifyMask, False, 
                        SetMaxShellSize, NULL);

   DEXIT;
   return cal_ask_layout;
}
Esempio n. 3
0
Widget make_text_widget(char *name, Widget parent, Arg *args, int n)
{
  /* white background when active, emacs translations */
  /* used only for comment widget in file data box (snd-xfile.c), but needs to be in this file to pick up actions etc */
  Widget df;
  if (!actions_loaded) 
    {
      XtAppAddActions(MAIN_APP(ss), acts, NUM_ACTS); 
      actions_loaded = true;
    }
  XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
  /* XmNblinkRate 0 turns off the cursor blink */
  XtSetArg(args[n], XmNcursorPositionVisible, false); n++;
  XtSetArg(args[n], XmNhighlightThickness, 1); n++;
  df = XmCreateScrolledText(parent, name, args, n);
  XtManageChild(df);
  XtAddCallback(df, XmNfocusCallback, textfield_focus_callback, NULL);
  XtAddCallback(df, XmNlosingFocusCallback, textfield_unfocus_callback, NULL);
  XtAddEventHandler(df, EnterWindowMask, false, mouse_enter_text_callback, NULL);
  XtAddEventHandler(df, LeaveWindowMask, false, mouse_leave_text_callback, NULL);
  if (!transTable3) 
    transTable3 = XtParseTranslationTable(TextTrans3);
  XtOverrideTranslations(df, transTable3);
  return(df);
}
Esempio n. 4
0
/*====================================================== DndRegisterDropWidget
 * Each widget that accepts a drop must register within the protocol. This
 * function binds two functions to the widget:
 * 
 * DndUpdateTargetProc : called by EnterWindow and LeaveWindow events.
 * user handler        : called by the Dnd Event sent by DndDispatchEvent.
 *==========================================================================*/
void
MwDndRegisterDropWidget(Widget widget,XtEventHandler handler,XtPointer data)
{
    XtAddEventHandler(widget,EnterWindowMask|LeaveWindowMask,
		      False,MwDndUpdateTargetProc,data);
    XtAddEventHandler(widget,NoEventMask,True,handler,data);
}
Esempio n. 5
0
/*-------------------------------------------------------------------------*/
void qmonQueuePopup(Widget w, XtPointer cld, XtPointer cad)
{
   lList *alp = NULL;
   
   DENTER(GUI_LAYER, "qmonQueuePopup");

   /* set busy cursor */
   XmtDisplayBusyCursor(w);

   qmonMirrorMultiAnswer(CQUEUE_T | EXECHOST_T | CENTRY_T, &alp);
   if (alp) {
      qmonMessageBox(w, alp, 0);
      lFreeList(&alp);
      /* set busy cursor */
      XmtDisplayDefaultCursor(w);
      DEXIT;
      return;
   }

   if (!qmon_queue) {

      qmonCreateQueueControl(AppShell);

      /*
      ** create queue customize dialog
      */
/*       qmonCreateQCU(qmon_queue, NULL); */

      /* 
      ** set the close button callback 
      ** set the icon and icon name
      */
      XmtCreatePixmapIcon(qmon_queue, qmonGetIcon("toolbar_queue"), None); 
      XtVaSetValues(qmon_queue, XtNiconName, "qmon:Queue Control", NULL);
      XmtAddDeleteCallback(qmon_queue, XmDO_NOTHING, qmonQueuePopdown,  NULL);
      XtAddEventHandler(qmon_queue, StructureNotifyMask, False, 
                        SetMinShellSize, NULL);
      XtAddEventHandler(qmon_queue, StructureNotifyMask, False, 
                        SetMaxShellSize, (XtPointer) SHELL_WIDTH);
      
   }

   xmui_manage(qmon_queue);
/*    ForceUpdate(qmon_queue); */

   updateQueueList();

#if 0
   /*
   ** workaround for display problem of DrawingArea under some WMs
   */
   XtUnmapWidget(queue_da);
   XtMapWidget(queue_da);
#endif   

   /* set busy cursor */
   XmtDisplayDefaultCursor(w);

   DEXIT;
}
Esempio n. 6
0
void notes_create_add_event_handlers()
{

   XtAddEventHandler(notes_equip_txt, KeyPressMask,False,
      check_for_spec_key, notes_equip_btn);
   XtAddEventHandler(notes_type_txt, KeyPressMask,False,
      check_for_spec_key, notes_type_btn);
}
Esempio n. 7
0
/* ARGSUSED */
static void
XawVendorShellInitialize(Widget req, Widget cnew,
			 ArgList args, Cardinal *num_args)
{
    XtAddEventHandler(cnew, (EventMask) 0, TRUE, _XEditResCheckMessages, NULL);
    XtAddEventHandler(cnew, (EventMask) 0, TRUE, XmuRegisterExternalAgent, NULL);
    XtCreateWidget("shellext", xawvendorShellExtWidgetClass,
		   cnew, args, *num_args);
}
Esempio n. 8
0
static void make_command_widget(int height)
{
  if (!listener_text)
    {
      Arg args[32];
      Widget wv, wh;
      int n;

      if (!actions_loaded) {XtAppAddActions(MAIN_APP(ss), acts, NUM_ACTS); actions_loaded = true;}

      n = attach_all_sides(args, 0);
      XtSetArg(args[n], XmNheight, height); n++;
      if ((sound_style(ss) == SOUNDS_IN_NOTEBOOK) || (sound_style(ss) == SOUNDS_HORIZONTAL))
	listener_pane = XtCreateManagedWidget("frm", xmFormWidgetClass, SOUND_PANE_BOX(ss), args, n);
      else listener_pane = XtCreateManagedWidget("frm", xmFormWidgetClass, SOUND_PANE(ss), args, n);
      /* this widget is not redundant at least in Metroworks Motif */

      n = 0;
      XtSetArg(args[n], XmNbackground, ss->sgx->listener_color); n++;
      XtSetArg(args[n], XmNforeground, ss->sgx->listener_text_color); n++;
      if (ss->sgx->listener_fontlist) {XtSetArg(args[n], XM_FONT_RESOURCE, ss->sgx->listener_fontlist); n++;}
      n = attach_all_sides(args, n);
      XtSetArg(args[n], XmNeditMode, XmMULTI_LINE_EDIT); n++;
      XtSetArg(args[n], XmNskipAdjust, true); n++;
      XtSetArg(args[n], XmNvalue, listener_prompt(ss)); n++;
      XtSetArg(args[n], XmNpendingDelete, false); n++; /* don't cut selection upon paste */
      XtSetArg(args[n], XmNpositionIndex, XmLAST_POSITION); n++;
      XtSetArg(args[n], XmNhighlightThickness, 1); n++;
      listener_text = XmCreateScrolledText(listener_pane, "lisp-listener", args, n);
      ss->sgx->listener_pane = listener_text;

      XtVaSetValues(MAIN_SHELL(ss), XmNallowShellResize, false, NULL);

      XtManageChild(listener_text);
      XmTextSetCursorPosition(listener_text, 1);
      if (!transTable4) 
	transTable4 = XtParseTranslationTable(TextTrans4);
      XtOverrideTranslations(listener_text, transTable4);
      printout_end = 0;
      XtAddCallback(listener_text, XmNactivateCallback, command_return_callback, NULL);
      XtAddCallback(listener_text, XmNmodifyVerifyCallback, command_modify_callback, NULL);
      XtAddCallback(listener_text, XmNmotionVerifyCallback, command_motion_callback, NULL);

      lisp_window = XtParent(listener_text);
      XtAddEventHandler(lisp_window, EnterWindowMask, false, listener_focus_callback, NULL);
      XtAddEventHandler(lisp_window, LeaveWindowMask, false, listener_unfocus_callback, NULL);
      
      XmChangeColor(lisp_window, ss->sgx->basic_color);
      XtVaGetValues(lisp_window, XmNverticalScrollBar, &wv, XmNhorizontalScrollBar, &wh, NULL);
      XmChangeColor(wv, ss->sgx->basic_color);
      XmChangeColor(wh, ss->sgx->basic_color);
      map_over_children(SOUND_PANE(ss), color_sashes);

      if (auto_resize(ss))
	XtVaSetValues(MAIN_SHELL(ss), XmNallowShellResize, true, NULL);
    }
}
Esempio n. 9
0
void
display_notes_screen(Widget w,
                     XtPointer client_data,
                     XtPointer call_data)
{
   /* Bring up the main notes screen that has filter/sort/browse. */

   show_busy_cursor(custinfo_shell, ON);

   if (notes_shell == NULL)
   {
      create_notes_shell(custinfo_shell);

      XtAddEventHandler(notes_filter_from_txt, KeyPressMask,False,
                        check_date, NULL);
      XtAddEventHandler(notes_filter_to_txt, KeyPressMask,False,
                        check_date, NULL);
      
                /* Initialize the notes sort/filter structures */
      init_sort_names();
      init_db_names();

      /* Set up data structs for each sort toggle button. These structures
       * are used to know what position the button is in and what ascending/
       * descending toggle button is associated with it. */
      equip_sort_data.position = EQUIP_NUM;
      equip_sort_data.asc_desc_btn = &notes_equip_ad_tog;
      type_sort_data.position = NOTE_TYPE;
      type_sort_data.asc_desc_btn = &notes_type_ad_tog;
      date_sort_data.position = DATE_TIME;
      date_sort_data.asc_desc_btn = &notes_date_ad_tog;
      userid_sort_data.position = USER_ID;
      userid_sort_data.asc_desc_btn = &notes_userid_ad_tog;

      populate_note_type_list();

   }

   /* Set the account_no using the global variable, gacct_external_id */
   XmTextSetString (notes_accountid_txt, gacct_external_id);
   XmTextSetString (notes_account_name_txt, gaccount_name);

   set_editable_off (notes_accountid_txt);
   set_editable_off (notes_account_name_txt);

   reset_notes_filter(NULL,NULL,NULL);
   reset_notes_sort(NULL, NULL, NULL); /* this is a callback */

   get_notes ();

   XtPopup (notes_shell, XtGrabNone);
   XMapRaised (XtDisplay(notes_shell),XtWindow(notes_shell));

   show_busy_cursor(custinfo_shell, OFF);
   XmProcessTraversal(notes_filter_type_txt, XmTRAVERSE_CURRENT);
}
Esempio n. 10
0
/*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;
    }
}
Esempio n. 11
0
/*-------------------------------------------------------------------------*/
void qmonPopupManopConfig(Widget w, XtPointer cld, XtPointer cad)
{
   Widget shell;
   lList *alp = NULL;
   
   DENTER(GUI_LAYER, "qmonPopupManopConfig");

   /* set busy cursor */
   XmtDisplayBusyCursor(w);

   /*
   ** create the dialog, if it doesn't exist
   */
   if (!qmon_manop) {
      shell = XmtGetTopLevelShell(w);
      qmon_manop = qmonCreateManopConfig(shell);
      XmtAddDeleteCallback(shell, XmDO_NOTHING, 
                              qmonPopdownManopConfig, NULL);
      XtAddEventHandler(XtParent(qmon_manop), StructureNotifyMask, False, 
                        SetMinShellSize, NULL);
      XtAddEventHandler(XtParent(qmon_manop), StructureNotifyMask, False, 
                        SetMaxShellSize, NULL);
   } 
   
   qmonMirrorMultiAnswer(MANAGER_T | OPERATOR_T | USERSET_T | USER_T, &alp);
   if (alp) {
      qmonMessageBox(w, alp, 0);
      lFreeList(&alp);
      /* set default cursor */
      XmtDisplayDefaultCursor(w);
      DEXIT;
      return;
   }
   qmonTimerAddUpdateProc(USERSET_T, "updateUsersetList", updateUsersetList);
   qmonStartTimer(MANAGER_T | OPERATOR_T | USERSET_T | USER_T);
   qmonManopFillList();

   xmui_manage(qmon_manop);

   /*
   ** switch to userset
   */
   if (cld) {
      XmTabSetTabWidget(manop_folder, userset_layout, True);
   }

   /* set default cursor */
   XmtDisplayDefaultCursor(w);

   DEXIT;
}
Esempio n. 12
0
Window::Window(std::string name) : Container(name)
{
  Arg args[1];

  XtSetArg(args[0], XmNdeleteResponse, XmDO_NOTHING);
  widget = XtAppCreateShell(Application::getName().c_str(), Application::getName().c_str(), applicationShellWidgetClass, Application::getDisplay(), args, 1);

  deleteWindowAtom = XmInternAtom(XtDisplay(widget), (char*)"WM_DELETE_WINDOW", False);
  XmAddWMProtocolCallback(widget, deleteWindowAtom, closeCallback, (void*)this);
  XtAddEventHandler(widget, StructureNotifyMask, False, eventCallback, (void*)this);
  XtAddEventHandler(widget, FocusChangeMask, False, eventCallback, (void*)this);

  contentPanel.reset(new Panel(name, this));
}
Esempio n. 13
0
void InitGraphics ( Widget w )
{
    XGCValues values;

   /* 
    * Remember the given widget for use by other functions.
    * Retrieve the display and colormap for later use.
    */

    canvas  = w; 
    display = XtDisplay ( canvas );
    XtVaGetValues ( canvas, XmNcolormap, &colormap, NULL );
    
   /*
    * Register a callback to redraw the display list when the
    * window is exposed, and event handlers to handle adding
    * new objects to the display list interactively
    */

    XtAddCallback ( canvas, XmNexposeCallback, Redisplay, NULL );
    XtAddEventHandler ( canvas, ButtonPressMask, FALSE,
                        StartRubberBand, NULL );
    XtAddEventHandler ( canvas, ButtonMotionMask, FALSE,
                        TrackRubberBand, NULL );
    XtAddEventHandler ( canvas, ButtonReleaseMask, FALSE,
                        EndRubberBand, NULL );
   /*
    * Get the colors of the canvas. 
    */
    
    XtVaGetValues ( canvas, 
                    XmNforeground, &currentForeground,
                    XmNbackground, &background,
                    NULL );
   /*
    * Fill in the values structure
    */  
    
    values.foreground = currentForeground ^ background;
    values.function   = GXxor;
    
   /*
    * Set the rubber band gc to use XOR mode. 
    */
    
    xorGC =  XtGetGC ( canvas, 
                       GCForeground | GCFunction, 
                       &values );
}    
Esempio n. 14
0
void WidgetWindow::set_attributes() {
/*
    if (visual_ == nil) {
	// This is wrong. We should use the visual contained in the widget.
	// For now, assume we don't mess with visuals.
	visual_ = screen_->find_visual((StyleImpl*)style_);
    }
*/

    WindowRep& wr = *((Window*)this)->rep();
    if (wr.visual_ == nil) {
        wr.visual_ = WindowVisual::find_visual(wr.display_, wr.style_);
    }

    wr.xattrmask_ |= CWEventMask;
    long events = (
	KeyPressMask | KeyReleaseMask |
	ButtonPressMask | ButtonReleaseMask | PointerMotionMask |
	EnterWindowMask | LeaveWindowMask |
	FocusChangeMask |
	OwnerGrabButtonMask
    );
    wr.xattrs_.event_mask = events | ExposureMask | StructureNotifyMask;

    // ### move this
    XtAddEventHandler(
	(Widget)widget_, events, FALSE, &WidgetWindow::xt_events, this
    );
}
Esempio n. 15
0
/*
 * If the application doesn't receive events with timestamp for a long time
 * XtLastTimestampProcessed() will return out-of-date value. This may cause
 * selection handling routines to fail (see BugTraq ID 4085183).
 * This routine is to resolve this problem. It queries the current X server
 * time by appending a zero-length data to a property as prescribed by
 * X11 Reference Manual.
 * Note that this is a round-trip request, so it can be slow. If you know
 * that the Xt timestamp is up-to-date use XtLastTimestampProcessed().
 */
Time
awt_util_getCurrentServerTime() {

    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
    static Atom _XA_JAVA_TIME_PROPERTY_ATOM = 0;
    Time server_time = 0;

    AWT_LOCK();

    if (_XA_JAVA_TIME_PROPERTY_ATOM == 0) {
        XtAddEventHandler(awt_root_shell, PropertyChangeMask, False,
                          propertyChangeEventHandler, NULL);
        _XA_JAVA_TIME_PROPERTY_ATOM = XInternAtom(awt_display, "_SUNW_JAVA_AWT_TIME", False);
    }

    timeStampUpdated = False;
    XChangeProperty(awt_display, XtWindow(awt_root_shell),
                    _XA_JAVA_TIME_PROPERTY_ATOM, XA_ATOM, 32, PropModeAppend,
                    (unsigned char *)"", 0);
    XFlush(awt_display);

    if (awt_currentThreadIsPrivileged(env)) {
        XEvent event;
        XMaskEvent(awt_display, PropertyChangeMask, &event);
        XtDispatchEvent(&event);
    } else {
        awt_MToolkit_modalWait(isTimeStampUpdated, NULL);
    }
    server_time = XtLastTimestampProcessed(awt_display);

    AWT_UNLOCK();

    return server_time;
}
Esempio n. 16
0
Widget init_application(int *argc, char **argv )
{
    m_init();
    XtAppContext app;
    XtSetLanguageProc (NULL, NULL, NULL);
    XawInitializeWidgetSet();
    /*  -- Intialize Toolkit creating the application shell
     */
    Widget appShell = XtOpenApplication (&app, APP_NAME,
	     options, XtNumber(options),  /* resources: can be set from argv */
	     argc, argv,
	     fallback_resources,
	     sessionShellWidgetClass,
	     NULL, 0
	   );
    /* enable Editres support */
    XtAddEventHandler(appShell, (EventMask) 0, True, _XEditResCheckMessages, NULL);
    XtAddCallback( appShell, XtNdieCallback, quit_gui, NULL );

    /* not parsed options are removed by XtOpenApplication
       the only entry left should be the program name
    */
    if (*argc != 1) { m_destruct(); syntax(); exit(1); }
    TopLevel = appShell;
    RAC( appShell, wm_quit );
    RCB( appShell, quit_gui );

    /*  -- Register all Athena and Public widget classes, CBs, ACTs
     */
    XpRegisterAll ( app );
    return appShell;

}
Esempio n. 17
0
static void
Initialize(Widget reqW,
	   Widget newW,
	   ArgList args,
	   Cardinal *narg)
	{
	XmLTreeWidget t;
 
	t = (XmLTreeWidget)newW;
	if (t->core.width <= 0) 
		t->core.width = 100;
	if (t->core.height <= 0) 
		t->core.height = 100;
	t->tree.defaultPixmapsCreated = 0;
	t->tree.linesData = 0;
	t->tree.linesSize = 0;
	t->tree.recalcTreeWidth = 0;
	if (t->grid.rowCount)
		{
		XmLWarning(newW, "Initialize() - can't set XmNrows");
		XmLGridDeleteAllRows(newW, XmCONTENT);
		}
	XtAddCallback(newW, XmNactivateCallback, Activate, NULL);
	XtAddEventHandler(newW, ButtonPressMask,
		True, (XtEventHandler)BtnPress, (XtPointer)0);

	XtVaSetValues(newW,
		XmNcellDefaults, True,
		XmNcolumn, 0,
		XmNcellType, XmICON_CELL,
		NULL);
	}
Esempio n. 18
0
void
ChooseSession(void)
{
    Dimension   width, height;
    Position	x, y;


    /*
     * Add the session names to the list
     */

    AddSessionNames (sessionNameCount, sessionNamesLong);


    /*
     * Center popup containing choice of sessions
     */
    
    XtRealizeWidget (chooseSessionPopup);

    XtVaGetValues (chooseSessionPopup,
	XtNwidth, &width,
	XtNheight, &height,
	NULL);

    x = (Position)(WidthOfScreen (XtScreen (topLevel)) - width) / 2;
    y = (Position)(HeightOfScreen (XtScreen (topLevel)) - height) / 3;

    XtVaSetValues (chooseSessionPopup,
	XtNx, x,
	XtNy, y,
	NULL);

    XtVaSetValues (chooseSessionListWidget,
	XtNlongest, width,
	NULL);

    XtVaSetValues (chooseSessionLabel,
	XtNwidth, width,
	NULL);

    XtVaGetValues (chooseSessionMessageLabel,
	XtNforeground, &save_message_foreground,
	XtNbackground, &save_message_background,
	NULL);

    XtVaSetValues (chooseSessionMessageLabel,
	XtNwidth, width,
	XtNforeground, save_message_background,
	NULL);

    /*
     * Wait for a map notify on the popup, then set input focus.
     */

    XtAddEventHandler (chooseSessionPopup, StructureNotifyMask, False,
	ChooseWindowStructureNotifyXtHandler, NULL);

    XtPopup (chooseSessionPopup, XtGrabNone);
}
Esempio n. 19
0
static void
color_createhist(Widget parent, char *name, unsigned long color,
		 struct ida_hist *me)
{
    char tmp[32];

    sprintf(tmp,"h%s",name);
    me->hist = XtVaCreateManagedWidget(tmp,xmDrawingAreaWidgetClass,parent,
				       XtNwidth,256,
				       XtNheight,HIST_SIZE,
				       NULL);
    sprintf(tmp,"m%s",name);
    me->map = XtVaCreateManagedWidget(tmp,xmDrawingAreaWidgetClass,parent,
				      XtNwidth,HIST_SIZE,
				      XtNheight,HIST_SIZE,
				      NULL);
    XtAddEventHandler(me->hist,
		      ButtonPressMask   |
		      ButtonReleaseMask |
		      ButtonMotionMask,
		      False,color_mouse,me);
    XtAddCallback(me->hist,XmNexposeCallback,color_drawhist,me);
    XtAddCallback(me->map,XmNexposeCallback,color_drawmap,me);
    me->gc = XCreateGC(dpy,XtWindow(app_shell),0,NULL);
    me->color = color;
    me->parm = op_map_nothing;
}
Esempio n. 20
0
/*-------------------------------------------------------------------------*/
static Widget qmonCreateUsersetAsk(
Widget parent 
) {
   Widget uset_ok, uset_cancel;

   DENTER(TOP_LAYER, "qmonCreateUsersetAsk");
   
   userset_ask_layout = XmtBuildQueryDialog( parent, "userset_ask_shell",
                           NULL, 0,
                           "uset_ok", &uset_ok,
                           "uset_cancel", &uset_cancel,
                           "uset_user_list", &uset_user_list,
                           "uset_user_remove", &uset_user_remove,
                           "uset_user", &uset_user,
                           "uset_name", &uset_name,
                           "uset_type", &uset_type,
                           NULL);

   XtAddCallback(uset_ok, XmNactivateCallback,
                  qmonUsersetOk, NULL);
   XtAddCallback(uset_cancel, XmNactivateCallback,
                  qmonUsersetCancel, NULL);
   XtAddCallback(uset_user, XmNinputCallback,
                  qmonUsersetUserAdd, NULL);

#if 0
      XtAddCallback(uset_name, XmNinputCallback,
                  qmonUsersetName, NULL);
#endif   

   XtAddEventHandler(XtParent(userset_ask_layout), StructureNotifyMask, False, 
                        SetMinShellSize, NULL);
   DEXIT;
   return userset_ask_layout;
}
Esempio n. 21
0
void pp_add_package_cb(Widget w, XtPointer *call_data, XmAnyCallbackStruct *client_data)
{
char *today = NULL;

/* create screen */

if (pp_provision_shell == NULL)
{
   create_pp_provision_shell (product_packages_shell);
   create_ppp_confirm_shell (pp_provision_shell);

   XtAddEventHandler(ppp_start_date_txt,KeyPressMask,False,
       check_date,NULL);

}

/* erase the list */

XmListDeleteAllItems (ppp_prov_list);
XmListDeselectAllItems(ppp_prov_list);

gprov_new_package = 0;

today = get_todays_date();
XmTextSetString (ppp_start_date_txt, today);
XtFree (today);

XmTextSetString (ppp_packageid_txt,"");

/* display screen */
XtManageChild (pp_provision_form);
XtPopup (pp_provision_shell, XtGrabNone);

}
Esempio n. 22
0
/*-------------------------------------------------------------------------*/
static Widget qmonCreateCkptAsk(
    Widget parent
) {
    Widget ckpt_ok, ckpt_cancel;

    DENTER(GUI_LAYER, "qmonCreateCkptAsk");

    ckpt_ask_layout = XmtBuildQueryDialog( parent, "ckpt_ask_shell",
                                           NULL, 0,
                                           "ckpt_ok", &ckpt_ok,
                                           "ckpt_cancel", &ckpt_cancel,
                                           "ckpt_name", &ckpt_name_w,
                                           "ckpt_interface", &ckpt_interface_w,
                                           "ckpt_ckpt_command", &ckpt_ckpt_command_w,
                                           "ckpt_migr_command", &ckpt_migr_command_w,
                                           "ckpt_rest_command", &ckpt_rest_command_w,
                                           "ckpt_clean_command", &ckpt_clean_command_w,
                                           "ckpt_ckpt_dir", &ckpt_ckpt_dir_w,
                                           "ckpt_when", &ckpt_when_w,
                                           "ckpt_signal", &ckpt_signal_w,
                                           NULL);

    XtAddCallback(ckpt_ok, XmNactivateCallback,
                  qmonCkptOk, NULL);
    XtAddCallback(ckpt_cancel, XmNactivateCallback,
                  qmonCkptCancel, NULL);
    XtAddEventHandler(XtParent(ckpt_ask_layout), StructureNotifyMask, False,
                      SetMinShellSize, NULL);

    DEXIT;
    return ckpt_ask_layout;
}
Esempio n. 23
0
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);
}
Esempio n. 24
0
/*ARGSUSED*/
static void 
Initialize(Widget req,		/* unused */
	   Widget new_w,
	   ArgList args,	/* unused */
	   Cardinal *num_args)	/* unused */
{
  XmGrabShellWidget grabsh = (XmGrabShellWidget)new_w;
  
  XtAddEventHandler(new_w, StructureNotifyMask, False, MapNotifyHandler, NULL);
  
  grabsh->grab_shell.unpost_time = (Time) -1;
  grabsh->grab_shell.cursor = None;

  grabsh->grab_shell.top_shadow_GC = 
    _XmGetPixmapBasedGC (new_w, 
			 grabsh->grab_shell.top_shadow_color,
			 grabsh->core.background_pixel,
			 grabsh->grab_shell.top_shadow_pixmap);

  grabsh->grab_shell.bottom_shadow_GC = 
    _XmGetPixmapBasedGC (new_w, 
			 grabsh->grab_shell.bottom_shadow_color,
			 grabsh->core.background_pixel,
			 grabsh->grab_shell.bottom_shadow_pixmap);

  /* CR 6723:  The BtnUp event may arrive before MapNotify. */
  grabsh->grab_shell.post_time = XtLastTimestampProcessed(XtDisplay(new_w));

  /* CR 9920:  Popdown may be requested before MapNotify. */
  grabsh->grab_shell.mapped = False;
}
Esempio n. 25
0
/*
 * Starts up the rubber band UI.
 * It grab the pointer and adds an event handler 
 * which detects the ButtonRelease. It also sets the
 * rubber band func.
 */
int
ui_initiate_rubberband(
    Widget		widget,
    Boolean		confine_to_window,
    UiRubberBandFunc	rb_func,
    XtPointer		client_data
)
{

    XtAddEventHandler(widget, ButtonReleaseMask,  False,
                rubberband_release, client_data);
 
    if (XtGrabPointer(widget, False,
        ButtonReleaseMask | ButtonMotionMask | PointerMotionMask,
        GrabModeAsync, GrabModeAsync,  
	confine_to_window ? XtWindow(widget) : None,
            NULL, CurrentTime) == GrabSuccess)
    {
	rband_in_progress = True;
        rubberband_func = rb_func;
        return OK;
    }

    rband_in_progress = False;
    rubberband_func = NULL;
    return ERROR;
}
Esempio n. 26
0
NPError nsPluginInstance::SetWindow(NPWindow* aWindow)
{
  if(aWindow == NULL)
    return FALSE;

  mX = aWindow->x;
  mY = aWindow->y;
  mWidth = aWindow->width;
  mHeight = aWindow->height;
  if (mWindow != (Window) aWindow->window) {
    mWindow = (Window) aWindow->window;
    NPSetWindowCallbackStruct *ws_info = (NPSetWindowCallbackStruct *)aWindow->ws_info;
  mDisplay = ws_info->display;
  mVisual = ws_info->visual;
  mDepth = ws_info->depth;
  mColormap = ws_info->colormap;

  if (!mFontInfo) {
      if (!(mFontInfo = XLoadQueryFont(mDisplay, "9x15")))
    printf("Cannot open 9X15 font\n");
  }
  // add xt event handler
  Widget xtwidget = XtWindowToWidget(mDisplay, mWindow);
    if (xtwidget && mXtwidget != xtwidget) {
      mXtwidget = xtwidget;
    long event_mask = ExposureMask;
    XSelectInput(mDisplay, mWindow, event_mask);
    XtAddEventHandler(xtwidget, event_mask, False, (XtEventHandler)xt_event_handler, this);
  }
  }
  draw();
  return TRUE;
}
Esempio n. 27
0
static int AllocateEventWidget(Display* dpy, XID* pxid)
{
  Arg args[40];
  int argc;
  Widget w;
  
  if (!dpy || !pxid) return 0;
  argc = 0;
  XtSetArg(args[argc], XmNallowShellResize, True); argc++;
  XtSetArg(args[argc], XmNwidth, 100); argc++;
  XtSetArg(args[argc], XmNheight, 100); argc++;
  XtSetArg(args[argc], XmNmappedWhenManaged, False); argc++;
  w  = NULL;
  w  = XtAppCreateShell("WF","XApplication",
						vendorShellWidgetClass,
						dpy,
						args,
						argc);
  if (w == NULL) return 0;
  XtRealizeWidget(w);
  XtAddEventHandler(w, PropertyChangeMask, FALSE,
					request_handler, NULL);
  g_request_handler_atom = 
	XInternAtom(dpy, "WF atom", FALSE);
  *pxid = XtWindow(w);
  XFlush(dpy);
  return 1;
}
Esempio n. 28
0
static void
InitPointerBlank(Widget w)
{
    DtTermPrimitiveWidget tw = (DtTermPrimitiveWidget) w;
    DtTermPrimData tpd = tw->term.tpd;
    XColor fg = { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 };
    XColor bg = { 0, 0, 0, 0, DoRed | DoGreen | DoBlue, 0 };
    Pixmap noPointerBitmap;

    /*
    ** set a pointer motion handler...
    */
    tpd->pointerTimeoutID = 0 ;
    tpd->pointerFrozen = True ;
    fg.pixel = bg.pixel = BlackPixelOfScreen(XtScreen(w));
    noPointerBitmap = XCreateBitmapFromData(XtDisplay(w),XtWindow(tw),
                                whiteBits, whiteW, whiteH);

    tpd->noPointer   = XCreatePixmapCursor(XtDisplay(tw),
                                   noPointerBitmap,  /* source bitmap    */
                                   noPointerBitmap,  /* mask bitmap      */
                                   &fg, &bg,	     /* Do not care	 */
				   0, 0);	     /* hotspot		 */

    XFreePixmap(XtDisplay(w), noPointerBitmap);
    XtAddEventHandler((Widget)tw, PointerMotionMask, FALSE, PointerMoved, 
                                       (XtPointer)NULL);

    tpd->pointerFirst = False ;
}
Esempio n. 29
0
void 
SoXtGLWidgetP::buildGLWidget(void)
{
  this->cleanupGLWidget();

  this->glxwidget =
    XtVaCreateManagedWidget("SoXtGLWidget",
                            soxtGLAreaWidgetClass, this->glxmanager,
                            SoXtNvisualInfo, this->normalvisual,
                            XmNcolormap, this->colormap,
                            SoXtNstencilSize, 1,
                            XmNleftAttachment, XmATTACH_FORM,
                            XmNtopAttachment, XmATTACH_FORM,
                            XmNrightAttachment, XmATTACH_FORM,
                            XmNbottomAttachment, XmATTACH_FORM,
                            NULL);
  PUBLIC(this)->registerWidget(this->glxwidget);  
  XtAddCallback(this->glxwidget, SoXtNexposeCallback,
                SoXtGLWidgetP::exposeCB, this);
  
  PUBLIC(this)->setBorder(PUBLIC(this)->isBorder()); // "refresh" the widget offsets
  
  // Our callback has this signature:
  // (void (*)(_WidgetRec *, SoXtGLWidget *, XAnyEvent *, char *))
  // ..so we need to cast to avoid a compiler warning or error.
  XtAddEventHandler(this->glxwidget,
                    ExposureMask | StructureNotifyMask | ButtonPressMask |
                    ButtonReleaseMask | PointerMotionMask | KeyPressMask | KeyReleaseMask,
                    False,
                    (void (*)(_WidgetRec *, void *, _XEvent *, char *))
                    SoXtGLWidget::eventHandler, PUBLIC(this));
  this->needrebuild = FALSE;
}
Esempio n. 30
0
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);
}