Lines Matching refs:beval
79 static void undrawBalloon(BalloonEval *beval);
102 BalloonEval *beval; in gui_mch_create_beval_area() local
110 beval = ALLOC_CLEAR_ONE(BalloonEval); in gui_mch_create_beval_area()
111 if (beval != NULL) in gui_mch_create_beval_area()
114 beval->target = GTK_WIDGET(target); in gui_mch_create_beval_area()
116 beval->target = (Widget)target; in gui_mch_create_beval_area()
117 beval->appContext = XtWidgetToApplicationContext((Widget)target); in gui_mch_create_beval_area()
119 beval->showState = ShS_NEUTRAL; in gui_mch_create_beval_area()
120 vim_free(beval->msg); in gui_mch_create_beval_area()
121 beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); in gui_mch_create_beval_area()
122 beval->msgCB = mesgCB; in gui_mch_create_beval_area()
123 beval->clientData = clientData; in gui_mch_create_beval_area()
130 addEventHandler(beval->target, beval); in gui_mch_create_beval_area()
131 createBalloonEvalWindow(beval); in gui_mch_create_beval_area()
143 beval->screen_width = DisplayWidth(gui.dpy, screen_num); in gui_mch_create_beval_area()
144 beval->screen_height = DisplayHeight(gui.dpy, screen_num); in gui_mch_create_beval_area()
148 return beval; in gui_mch_create_beval_area()
156 gui_mch_destroy_beval_area(BalloonEval *beval) in gui_mch_destroy_beval_area() argument
158 cancelBalloon(beval); in gui_mch_destroy_beval_area()
159 removeEventHandler(beval); in gui_mch_destroy_beval_area()
162 gtk_widget_destroy(beval->balloonShell); in gui_mch_destroy_beval_area()
164 XtDestroyWidget(beval->balloonShell); in gui_mch_destroy_beval_area()
167 if (beval->vts) in gui_mch_destroy_beval_area()
168 vim_free(beval->vts); in gui_mch_destroy_beval_area()
170 vim_free(beval); in gui_mch_destroy_beval_area()
175 gui_mch_enable_beval_area(BalloonEval *beval) in gui_mch_enable_beval_area() argument
177 if (beval != NULL) in gui_mch_enable_beval_area()
178 addEventHandler(beval->target, beval); in gui_mch_enable_beval_area()
182 gui_mch_disable_beval_area(BalloonEval *beval) in gui_mch_disable_beval_area() argument
184 if (beval != NULL) in gui_mch_disable_beval_area()
185 removeEventHandler(beval); in gui_mch_disable_beval_area()
210 gui_mch_post_balloon(BalloonEval *beval, char_u *mesg) in gui_mch_post_balloon() argument
212 vim_free(beval->msg); in gui_mch_post_balloon()
213 beval->msg = mesg == NULL ? NULL : vim_strsave(mesg); in gui_mch_post_balloon()
214 if (beval->msg != NULL) in gui_mch_post_balloon()
215 drawBalloon(beval); in gui_mch_post_balloon()
217 undrawBalloon(beval); in gui_mch_post_balloon()
228 gui_mch_unpost_balloon(BalloonEval *beval) in gui_mch_unpost_balloon() argument
230 VIM_CLEAR(beval->msg); in gui_mch_unpost_balloon()
231 undrawBalloon(beval); in gui_mch_unpost_balloon()
237 addEventHandler(GtkWidget *target, BalloonEval *beval) in addEventHandler() argument
247 beval); in addEventHandler()
261 beval); in addEventHandler()
266 removeEventHandler(BalloonEval *beval) in removeEventHandler() argument
268 g_signal_handlers_disconnect_by_func(G_OBJECT(beval->target), in removeEventHandler()
270 beval); in removeEventHandler()
273 && gtk_widget_is_ancestor(beval->target, gui.mainwin)) in removeEventHandler()
277 beval); in removeEventHandler()
284 BalloonEval *beval = (BalloonEval *)data; in target_event_cb() local
289 pointer_event(beval, (int)event->crossing.x, in target_event_cb()
319 pointer_event(beval, x, y, (unsigned int)state); in target_event_cb()
323 pointer_event(beval, (int)event->motion.x, in target_event_cb()
334 cancelBalloon(beval); in target_event_cb()
338 cancelBalloon(beval); in target_event_cb()
341 key_event(beval, event->key.keyval, TRUE); in target_event_cb()
344 key_event(beval, event->key.keyval, FALSE); in target_event_cb()
356 BalloonEval *beval = (BalloonEval *)data; in mainwin_event_cb() local
361 key_event(beval, event->key.keyval, TRUE); in mainwin_event_cb()
364 key_event(beval, event->key.keyval, FALSE); in mainwin_event_cb()
370 cancelBalloon(beval); in mainwin_event_cb()
380 pointer_event(BalloonEval *beval, int x, int y, unsigned state) in pointer_event() argument
384 distance = ABS(x - beval->x) + ABS(y - beval->y); in pointer_event()
392 beval->state = state; in pointer_event()
393 cancelBalloon(beval); in pointer_event()
399 beval->x = x; in pointer_event()
400 beval->y = y; in pointer_event()
408 if (beval->msgCB != NULL) in pointer_event()
410 beval->showState = ShS_PENDING; in pointer_event()
411 (*beval->msgCB)(beval, state); in pointer_event()
416 beval->timerID = g_timeout_add((guint)p_bdlay, in pointer_event()
417 &timeout_cb, beval); in pointer_event()
424 key_event(BalloonEval *beval, unsigned keyval, int is_keypress) in key_event() argument
426 if (beval->showState == ShS_SHOWING && beval->msgCB != NULL) in key_event()
432 beval->showState = ShS_UPDATE_PENDING; in key_event()
433 (*beval->msgCB)(beval, (is_keypress) in key_event()
438 beval->showState = ShS_UPDATE_PENDING; in key_event()
439 (*beval->msgCB)(beval, (is_keypress) in key_event()
446 cancelBalloon(beval); in key_event()
451 cancelBalloon(beval); in key_event()
457 BalloonEval *beval = (BalloonEval *)data; in timeout_cb() local
459 beval->timerID = 0; in timeout_cb()
465 requestBalloon(beval); in timeout_cb()
518 addEventHandler(Widget target, BalloonEval *beval) in addEventHandler() argument
525 pointerEventEH, (XtPointer)beval); in addEventHandler()
529 removeEventHandler(BalloonEval *beval) in removeEventHandler() argument
531 XtRemoveEventHandler(beval->target, in removeEventHandler()
536 pointerEventEH, (XtPointer)beval); in removeEventHandler()
550 BalloonEval *beval = (BalloonEval *)client_data; in pointerEventEH() local
551 pointerEvent(beval, event); in pointerEventEH()
561 pointerEvent(BalloonEval *beval, XEvent *event) in pointerEvent() argument
570 delta = event->xmotion.x - beval->x; in pointerEvent()
574 delta = event->xmotion.y - beval->y; in pointerEvent()
584 beval->state = event->xmotion.state; in pointerEvent()
585 if (beval->state & (Button1Mask|Button2Mask|Button3Mask)) in pointerEvent()
588 cancelBalloon(beval); in pointerEvent()
590 else if (beval->state & (Mod1Mask|Mod2Mask|Mod3Mask)) in pointerEvent()
596 beval->x = event->xmotion.x; in pointerEvent()
597 beval->y = event->xmotion.y; in pointerEvent()
598 beval->x_root = event->xmotion.x_root; in pointerEvent()
599 beval->y_root = event->xmotion.y_root; in pointerEvent()
600 cancelBalloon(beval); in pointerEvent()
601 if (beval->msgCB != NULL) in pointerEvent()
603 beval->showState = ShS_PENDING; in pointerEvent()
604 (*beval->msgCB)(beval, beval->state); in pointerEvent()
609 beval->x = event->xmotion.x; in pointerEvent()
610 beval->y = event->xmotion.y; in pointerEvent()
611 beval->x_root = event->xmotion.x_root; in pointerEvent()
612 beval->y_root = event->xmotion.y_root; in pointerEvent()
613 cancelBalloon(beval); in pointerEvent()
614 beval->timerID = XtAppAddTimeOut( beval->appContext, in pointerEvent()
615 (long_u)p_bdlay, timerRoutine, beval); in pointerEvent()
625 if (beval->showState == ShS_SHOWING && beval->msgCB != NULL) in pointerEvent()
635 beval->showState = ShS_UPDATE_PENDING; in pointerEvent()
636 (*beval->msgCB)(beval, ShiftMask); in pointerEvent()
640 beval->showState = ShS_UPDATE_PENDING; in pointerEvent()
641 (*beval->msgCB)(beval, ControlMask); in pointerEvent()
644 cancelBalloon(beval); in pointerEvent()
647 cancelBalloon(beval); in pointerEvent()
651 if (beval->showState == ShS_SHOWING && beval->msgCB != NULL) in pointerEvent()
659 beval->showState = ShS_UPDATE_PENDING; in pointerEvent()
660 (*beval->msgCB)(beval, 0); in pointerEvent()
664 beval->showState = ShS_UPDATE_PENDING; in pointerEvent()
665 (*beval->msgCB)(beval, 0); in pointerEvent()
668 cancelBalloon(beval); in pointerEvent()
671 cancelBalloon(beval); in pointerEvent()
679 cancelBalloon(beval); in pointerEvent()
683 cancelBalloon(beval); in pointerEvent()
694 BalloonEval *beval = (BalloonEval *)dx; in timerRoutine() local
696 beval->timerID = (XtIntervalId)NULL; in timerRoutine()
703 requestBalloon(beval); in timerRoutine()
709 requestBalloon(BalloonEval *beval) in requestBalloon() argument
711 if (beval->showState != ShS_PENDING) in requestBalloon()
714 if (beval->msgCB != NULL) in requestBalloon()
716 beval->showState = ShS_PENDING; in requestBalloon()
717 (*beval->msgCB)(beval, beval->state); in requestBalloon()
719 else if (beval->msg != NULL) in requestBalloon()
720 drawBalloon(beval); in requestBalloon()
911 drawBalloon(BalloonEval *beval) in drawBalloon() argument
913 if (beval->msg != NULL) in drawBalloon()
929 screen = gtk_widget_get_screen(beval->target); in drawBalloon()
930 gtk_window_set_screen(GTK_WINDOW(beval->balloonShell), screen); in drawBalloon()
932 gui_gtk_get_screen_geom_of_win(beval->target, 0, 0, in drawBalloon()
935 gtk_widget_ensure_style(beval->balloonShell); in drawBalloon()
936 gtk_widget_ensure_style(beval->balloonLabel); in drawBalloon()
939 set_printable_label_text(GTK_LABEL(beval->balloonLabel), beval->msg); in drawBalloon()
945 layout = gtk_label_get_layout(GTK_LABEL(beval->balloonLabel)); in drawBalloon()
959 gtk_widget_get_preferred_size(beval->balloonShell, &requisition, NULL); in drawBalloon()
961 gtk_widget_size_request(beval->balloonShell, &requisition); in drawBalloon()
965 gdk_window_get_origin(gtk_widget_get_window(beval->target), &x, &y); in drawBalloon()
966 x += beval->x; in drawBalloon()
967 y += beval->y; in drawBalloon()
983 gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y); in drawBalloon()
985 gtk_widget_set_uposition(beval->balloonShell, x, y); in drawBalloon()
987 gtk_widget_show(beval->balloonShell); in drawBalloon()
989 beval->showState = ShS_SHOWING; in drawBalloon()
998 undrawBalloon(BalloonEval *beval) in undrawBalloon() argument
1000 if (beval->balloonShell != NULL) in undrawBalloon()
1001 gtk_widget_hide(beval->balloonShell); in undrawBalloon()
1002 beval->showState = ShS_NEUTRAL; in undrawBalloon()
1006 cancelBalloon(BalloonEval *beval) in cancelBalloon() argument
1008 if (beval->showState == ShS_SHOWING in cancelBalloon()
1009 || beval->showState == ShS_UPDATE_PENDING) in cancelBalloon()
1010 undrawBalloon(beval); in cancelBalloon()
1012 if (beval->timerID != 0) in cancelBalloon()
1014 g_source_remove(beval->timerID); in cancelBalloon()
1015 beval->timerID = 0; in cancelBalloon()
1017 beval->showState = ShS_NEUTRAL; in cancelBalloon()
1021 createBalloonEvalWindow(BalloonEval *beval) in createBalloonEvalWindow() argument
1023 beval->balloonShell = gtk_window_new(GTK_WINDOW_POPUP); in createBalloonEvalWindow()
1025 gtk_widget_set_app_paintable(beval->balloonShell, TRUE); in createBalloonEvalWindow()
1026 gtk_window_set_resizable(GTK_WINDOW(beval->balloonShell), FALSE); in createBalloonEvalWindow()
1027 gtk_widget_set_name(beval->balloonShell, "gtk-tooltips"); in createBalloonEvalWindow()
1028 gtk_container_set_border_width(GTK_CONTAINER(beval->balloonShell), 4); in createBalloonEvalWindow()
1031 g_signal_connect(G_OBJECT(beval->balloonShell), "draw", in createBalloonEvalWindow()
1034 gtk_signal_connect((GtkObject*)(beval->balloonShell), "expose_event", in createBalloonEvalWindow()
1037 beval->balloonLabel = gtk_label_new(NULL); in createBalloonEvalWindow()
1039 gtk_label_set_line_wrap(GTK_LABEL(beval->balloonLabel), FALSE); in createBalloonEvalWindow()
1040 gtk_label_set_justify(GTK_LABEL(beval->balloonLabel), GTK_JUSTIFY_LEFT); in createBalloonEvalWindow()
1042 gtk_label_set_xalign(GTK_LABEL(beval->balloonLabel), 0.5); in createBalloonEvalWindow()
1043 gtk_label_set_yalign(GTK_LABEL(beval->balloonLabel), 0.5); in createBalloonEvalWindow()
1048 g_object_set_property(G_OBJECT(beval->balloonLabel), "xalign", &align_val); in createBalloonEvalWindow()
1049 g_object_set_property(G_OBJECT(beval->balloonLabel), "yalign", &align_val); in createBalloonEvalWindow()
1052 gtk_misc_set_alignment(GTK_MISC(beval->balloonLabel), 0.5f, 0.5f); in createBalloonEvalWindow()
1054 gtk_widget_set_name(beval->balloonLabel, "vim-balloon-label"); in createBalloonEvalWindow()
1055 gtk_widget_show(beval->balloonLabel); in createBalloonEvalWindow()
1057 gtk_container_add(GTK_CONTAINER(beval->balloonShell), beval->balloonLabel); in createBalloonEvalWindow()
1066 drawBalloon(BalloonEval *beval) in drawBalloon() argument
1073 if (beval->msg != NULL) in drawBalloon()
1084 if (beval->msgCB != NULL) in drawBalloon()
1085 s = XmStringCreateLtoR((char *)beval->msg, XmFONTLIST_DEFAULT_TAG); in drawBalloon()
1087 s = XmStringCreateLocalized((char *)beval->msg); in drawBalloon()
1102 XtVaSetValues(beval->balloonLabel, XmNlabelString, s, NULL); in drawBalloon()
1109 XtVaGetValues(beval->balloonLabel, XtNfontSet, &fset, NULL); in drawBalloon()
1113 (char *)beval->msg, in drawBalloon()
1114 (int)STRLEN(beval->msg)); in drawBalloon()
1117 XtVaSetValues(beval->balloonLabel, XtNlabel, beval->msg, NULL); in drawBalloon()
1121 tx = beval->x_root + EVAL_OFFSET_X; in drawBalloon()
1122 ty = beval->y_root + EVAL_OFFSET_Y; in drawBalloon()
1123 if ((tx + w) > beval->screen_width) in drawBalloon()
1124 tx = beval->screen_width - w; in drawBalloon()
1125 if ((ty + h) > beval->screen_height) in drawBalloon()
1126 ty = beval->screen_height - h; in drawBalloon()
1128 XtVaSetValues(beval->balloonShell, in drawBalloon()
1134 XtVaSetValues(beval->balloonShell, in drawBalloon()
1154 XtSetValues(beval->balloonLabel, &args[0], XtNumber(args)); in drawBalloon()
1157 XtPopup(beval->balloonShell, XtGrabNone); in drawBalloon()
1159 beval->showState = ShS_SHOWING; in drawBalloon()
1161 current_beval = beval; in drawBalloon()
1169 undrawBalloon(BalloonEval *beval) in undrawBalloon() argument
1171 if (beval->balloonShell != (Widget)0) in undrawBalloon()
1172 XtPopdown(beval->balloonShell); in undrawBalloon()
1173 beval->showState = ShS_NEUTRAL; in undrawBalloon()
1179 cancelBalloon(BalloonEval *beval) in cancelBalloon() argument
1181 if (beval->showState == ShS_SHOWING in cancelBalloon()
1182 || beval->showState == ShS_UPDATE_PENDING) in cancelBalloon()
1183 undrawBalloon(beval); in cancelBalloon()
1185 if (beval->timerID != (XtIntervalId)NULL) in cancelBalloon()
1187 XtRemoveTimeOut(beval->timerID); in cancelBalloon()
1188 beval->timerID = (XtIntervalId)NULL; in cancelBalloon()
1190 beval->showState = ShS_NEUTRAL; in cancelBalloon()
1195 createBalloonEvalWindow(BalloonEval *beval) in createBalloonEvalWindow() argument
1203 beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval", in createBalloonEvalWindow()
1208 beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval", in createBalloonEvalWindow()
1222 beval->balloonLabel = XtCreateManagedWidget("balloonLabel", in createBalloonEvalWindow()
1223 xmLabelWidgetClass, beval->balloonShell, args, n); in createBalloonEvalWindow()
1230 beval->balloonLabel = XtCreateManagedWidget("balloonLabel", in createBalloonEvalWindow()
1231 labelWidgetClass, beval->balloonShell, args, n); in createBalloonEvalWindow()