void Ctrl::StopGrabPopup() { if(grabpopup && gdk_pointer_is_grabbed()) { gdk_pointer_ungrab(CurrentTime); grabpopup = NULL; } }
static gboolean webx_pipeline_timeout_update (WebxPipeline *pipeline) { g_return_val_if_fail (WEBX_IS_PIPELINE (pipeline), TRUE); if (pipeline->update_count) { while (gtk_events_pending ()) { gtk_main_iteration (); pipeline->update_count++; } if (pipeline->update_count != pipeline->last_update || gdk_pointer_is_grabbed ()) { /* user has changed something; wait */ pipeline->last_update = pipeline->update_count; return TRUE; } else { pipeline->updating = TRUE; webx_pipeline_update (pipeline); pipeline->updating = FALSE; } } pipeline->timeout_id = 0; return FALSE; }
static void drag_start (CeditNotebook *notebook, guint32 time) { notebook->priv->drag_in_progress = TRUE; /* get a new cursor, if necessary */ /* FIXME multi-head */ if (cursor == NULL) cursor = gdk_cursor_new (GDK_FLEUR); /* grab the pointer */ gtk_grab_add (GTK_WIDGET (notebook)); /* FIXME multi-head */ if (!gdk_pointer_is_grabbed ()) { gdk_pointer_grab (gtk_widget_get_window (GTK_WIDGET (notebook)), FALSE, GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, cursor, time); } }
static void gul_gestures_stop (GulGestures *as) { GulGesturesPrivate *p = as->priv; /* ungrab the pointer if it's grabbed */ if (gdk_pointer_is_grabbed ()) { gdk_pointer_ungrab (gtk_get_current_event_time ()); } gdk_keyboard_ungrab (gtk_get_current_event_time ()); g_return_if_fail (p->widget); gtk_grab_remove (p->widget); /* disconnect all of the signals */ g_signal_handlers_disconnect_matched (p->widget, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, as); g_object_unref (p->widget); p->widget = NULL; p->started = FALSE; g_object_unref (as); }
void Ctrl::CaptureSync() { if(grabwindow && !gdk_pointer_is_grabbed()) { if(gdk_pointer_grab(grabwindow->gdk(), FALSE, GdkEventMask(GDK_BUTTON_RELEASE_MASK|GDK_BUTTON_PRESS_MASK|GDK_POINTER_MOTION_MASK), NULL, NULL, CurrentTime) != GDK_GRAB_SUCCESS) { grabwindow = NULL; } } }
void main_window_set_use_grab( main_window_t win, gboolean use_grab ) { if( use_grab != win->use_grab ) { if( use_grab ) { GdkCursor *cursor = gdk_cursor_new( GDK_HAND2 ); gdk_window_set_cursor( win->video->window, cursor ); gdk_cursor_unref( cursor ); } else { gdk_window_set_cursor( win->video->window, NULL ); if( gdk_pointer_is_grabbed() ) { video_window_ungrab_display(win); } } win->use_grab = use_grab; } }
static void move_current_tab_to_another_notebook (CeditNotebook *src, CeditNotebook *dest, GdkEventMotion *event, gint dest_position) { CeditTab *tab; gint cur_page; /* This is getting tricky, the tab was dragged in a notebook * in another window of the same app, we move the tab * to that new notebook, and let this notebook handle the * drag */ g_return_if_fail (CEDIT_IS_NOTEBOOK (dest)); g_return_if_fail (dest != src); cur_page = gtk_notebook_get_current_page (GTK_NOTEBOOK (src)); tab = CEDIT_TAB (gtk_notebook_get_nth_page (GTK_NOTEBOOK (src), cur_page)); /* stop drag in origin window */ /* ungrab the pointer if it's grabbed */ drag_stop (src); if (gdk_pointer_is_grabbed ()) { gdk_pointer_ungrab (event->time); } gtk_grab_remove (GTK_WIDGET (src)); cedit_notebook_move_tab (src, dest, tab, dest_position); /* start drag handling in dest notebook */ dest->priv->motion_notify_handler_id = g_signal_connect (G_OBJECT (dest), "motion-notify-event", G_CALLBACK (motion_notify_cb), NULL); drag_start (dest, event->time); }
static void alertpanel_show(void) { gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); manage_window_set_transient(GTK_WINDOW(dialog)); gtk_widget_show_all(dialog); value = G_ALERTWAIT; if (gdk_pointer_is_grabbed()) gdk_pointer_ungrab(GDK_CURRENT_TIME); inc_lock(); while ((value & G_ALERT_VALUE_MASK) == G_ALERTWAIT) gtk_main_iteration(); gtk_widget_destroy(dialog); GTK_EVENTS_FLUSH(); alertpanel_is_open = FALSE; hooks_invoke(ALERTPANEL_OPENED_HOOKLIST, &alertpanel_is_open); inc_unlock(); }
void Ctrl::PanicMsgBox(const char *title, const char *text) { LLOG("PanicMsgBox " << title << ": " << text); if(gdk_pointer_is_grabbed()) gdk_pointer_ungrab(CurrentTime); if(system("which gxmessage") == 0) IGNORE_RESULT(system(String().Cat() << "gxmessage -center \"" << title << "\n" << text << "\"")); else if(system("which kdialog") == 0) IGNORE_RESULT(system(String().Cat() << "kdialog --error \"" << title << "\n" << text << "\"")); else if(system("which xmessage") == 0) IGNORE_RESULT(system(String().Cat() << "xmessage -center \"" << title << "\n" << text << "\"")); else { _DBG_Ungrab(); GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, "%s: %s", title, text); gtk_dialog_run(GTK_DIALOG (dialog)); gtk_widget_destroy(dialog); } __BREAK__; }
static void mimeview_selected(GtkCTree *ctree, GtkCTreeNode *node, gint column, MimeView *mimeview) { MimeInfo *partinfo; if (mimeview->opened == node) return; mimeview->opened = node; gtk_ctree_node_moveto(ctree, node, -1, 0.5, 0); partinfo = gtk_ctree_node_get_row_data(ctree, node); if (!partinfo) return; /* ungrab the mouse event */ if (GTK_WIDGET_HAS_GRAB(ctree)) { gtk_grab_remove(GTK_WIDGET(ctree)); if (gdk_pointer_is_grabbed()) gdk_pointer_ungrab(GDK_CURRENT_TIME); } mimeview->textview->default_text = FALSE; update_signature_info(mimeview, partinfo); if (!mimeview_show_part(mimeview, partinfo)) { switch (partinfo->type) { case MIMETYPE_TEXT: case MIMETYPE_MESSAGE: case MIMETYPE_MULTIPART: mimeview_show_message_part(mimeview, partinfo); break; default: mimeview->textview->default_text = TRUE; mimeview_change_view_type(mimeview, MIMEVIEW_TEXT); textview_show_mime_part(mimeview->textview, partinfo); break; } } }
void wxListBox::DoScrollToCell(int n, float alignY, float alignX) { wxCHECK_RET( m_treeview, wxT("invalid listbox") ); wxCHECK_RET( IsValid(n), wxT("invalid index")); //RN: I have no idea why this line is needed... if (gdk_pointer_is_grabbed () && gtk_widget_has_grab(GTK_WIDGET(m_treeview))) return; GtkTreeIter iter; if ( !GTKGetIteratorFor(n, &iter) ) return; GtkTreePath* path = gtk_tree_model_get_path( GTK_TREE_MODEL(m_liststore), &iter); // Scroll to the desired cell (0.0 == topleft alignment) gtk_tree_view_scroll_to_cell(m_treeview, path, NULL, TRUE, alignY, alignX); gtk_tree_path_free(path); }
static gboolean button_release_cb (CeditNotebook *notebook, GdkEventButton *event, gpointer data) { if (notebook->priv->drag_in_progress) { gint cur_page_num; GtkWidget *cur_page; cur_page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook)); cur_page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), cur_page_num); /* CHECK: I don't follow the code here -- Paolo */ if (!is_in_notebook_window (notebook, event->x_root, event->y_root) && (gtk_notebook_get_n_pages (GTK_NOTEBOOK (notebook)) > 1)) { /* Tab was detached */ g_signal_emit (G_OBJECT (notebook), signals[TAB_DETACHED], 0, cur_page); } /* ungrab the pointer if it's grabbed */ if (gdk_pointer_is_grabbed ()) { gdk_pointer_ungrab (event->time); } gtk_grab_remove (GTK_WIDGET (notebook)); } /* This must be called even if a drag isn't happening */ drag_stop (notebook); return FALSE; }
void ephy_push_scroller_stop (EphyPushScroller *scroller, guint32 timestamp) { EphyPushScrollerPrivate *priv = scroller->priv; GtkWidget *widget; LOG ("Stop [%p]", scroller); if (priv->active == FALSE) return; /* disconnect the signals before ungrabbing! */ g_signal_handlers_disconnect_matched (priv->window, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, scroller); g_signal_handlers_disconnect_matched (gtk_bin_get_child (GTK_BIN (priv->window)), G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, scroller); /* ungrab the pointer if it's grabbed */ if (gdk_pointer_is_grabbed ()) { gdk_pointer_ungrab (timestamp); } gdk_keyboard_ungrab (timestamp); widget = GTK_WIDGET (priv->window); gtk_grab_remove (widget); g_object_unref (priv->window); priv->embed = NULL; priv->active = FALSE; g_object_unref (scroller); }
/** * Called before SPKnot destruction. */ static void sp_knot_dispose(GObject *object) { SPKnot *knot = (SPKnot *) object; if ((knot->flags & SP_KNOT_GRABBED) && gdk_pointer_is_grabbed ()) { // This happens e.g. when deleting a node in node tool while dragging it gdk_pointer_ungrab (GDK_CURRENT_TIME); } if (knot->_event_handler_id > 0) { g_signal_handler_disconnect(G_OBJECT (knot->item), knot->_event_handler_id); knot->_event_handler_id = 0; } if (knot->item) { gtk_object_destroy (GTK_OBJECT (knot->item)); knot->item = NULL; } for (gint i = 0; i < SP_KNOT_VISIBLE_STATES; i++) { if (knot->cursor[i]) { gdk_cursor_unref(knot->cursor[i]); knot->cursor[i] = NULL; } } if (knot->tip) { g_free(knot->tip); knot->tip = NULL; } if (parent_class->dispose) { (*parent_class->dispose) (object); } }
void wxListBox::DoSetFirstItem( int n ) { wxCHECK_RET( m_list, wxT("invalid listbox") ); if (gdk_pointer_is_grabbed () && GTK_WIDGET_HAS_GRAB (m_list)) return; // terribly efficient const gchar *vadjustment_key = "gtk-vadjustment"; guint vadjustment_key_id = g_quark_from_static_string (vadjustment_key); GtkAdjustment *adjustment = (GtkAdjustment*) gtk_object_get_data_by_id (GTK_OBJECT (m_list), vadjustment_key_id); wxCHECK_RET( adjustment, wxT("invalid listbox code") ); GList *target = g_list_nth( m_list->children, n ); wxCHECK_RET( target, wxT("invalid listbox index") ); GtkWidget *item = GTK_WIDGET(target->data); wxCHECK_RET( item, wxT("invalid listbox code") ); if (item->allocation.y == -1) { wxlistbox_idle_struct* data = new wxlistbox_idle_struct; data->m_listbox = this; data->m_item = n; data->m_tag = gtk_idle_add_priority( 800, wxlistbox_idle_callback, (gpointer) data ); return; } float y = item->allocation.y; if (y > adjustment->upper - adjustment->page_size) y = adjustment->upper - adjustment->page_size; gtk_adjustment_set_value( adjustment, y ); }
static gboolean gs_grab_move_mouse (GSGrab *grab, GdkWindow *window, GdkScreen *screen, gboolean hide_cursor) { gboolean result; GdkWindow *old_window; GdkScreen *old_screen; gboolean old_hide_cursor; /* if the pointer is not grabbed and we have a mouse_grab_window defined then we lost the grab */ if (! gdk_pointer_is_grabbed ()) { gs_grab_mouse_reset (grab); } if (grab->priv->mouse_grab_window == window) { gs_debug ("Window %X is already grabbed, skipping", (guint32) GDK_WINDOW_XID (grab->priv->mouse_grab_window)); return TRUE; } #if 0 gs_debug ("Intentionally skipping move pointer grabs"); /* FIXME: GTK doesn't like having the pointer grabbed */ return TRUE; #else if (grab->priv->mouse_grab_window) { gs_debug ("Moving pointer grab from %X to %X", (guint32) GDK_WINDOW_XID (grab->priv->mouse_grab_window), (guint32) GDK_WINDOW_XID (window)); } else { gs_debug ("Getting pointer grab on %X", (guint32) GDK_WINDOW_XID (window)); } #endif gs_debug ("*** doing X server grab"); gdk_x11_grab_server (); old_window = grab->priv->mouse_grab_window; old_screen = grab->priv->mouse_grab_screen; old_hide_cursor = grab->priv->mouse_hide_cursor; if (old_window) { gs_grab_release_mouse (grab); } result = gs_grab_get_mouse (grab, window, screen, hide_cursor); if (result != GDK_GRAB_SUCCESS) { sleep (1); result = gs_grab_get_mouse (grab, window, screen, hide_cursor); } if ((result != GDK_GRAB_SUCCESS) && old_window) { gs_debug ("Could not grab mouse for new window. Resuming previous grab."); gs_grab_get_mouse (grab, old_window, old_screen, old_hide_cursor); } gs_debug ("*** releasing X server grab"); gdk_x11_ungrab_server (); gdk_flush (); return (result == GDK_GRAB_SUCCESS); }
static VALUE gdk_s_pointer_is_grabbed(VALUE self) { return CBOOL2RVAL(gdk_pointer_is_grabbed()); }
/* Returns TRUE if the pointer is currently grabbed by this application. * Note that the return value is not completely reliable since the X server * may automatically ungrab the pointer, without informing the application, * if the grab window becomes unviewable. It also does not take passive * pointer grabs into account. */ int clip_GDK_POINTERISGRABBED(ClipMachine * ClipMachineMemory) { _clip_retl(ClipMachineMemory, gdk_pointer_is_grabbed()); return 0; }
static VALUE rg_m_pointer_is_grabbed_p(G_GNUC_UNUSED VALUE self) { return CBOOL2RVAL(gdk_pointer_is_grabbed()); }
bool Ctrl::HasWndCapture() const { GuiLock __; return this == grabwindow && gdk_pointer_is_grabbed(); }
void ephy_push_scroller_start (EphyPushScroller *scroller, EphyEmbed *embed, gdouble x, gdouble y) { EphyPushScrollerPrivate *priv = scroller->priv; GtkWidget *widget, *child; guint32 timestamp; g_return_if_fail (embed != NULL); LOG ("Start [%p]", scroller); if (priv->active) return; if (gdk_pointer_is_grabbed ()) return; priv->active = TRUE; /* FIXME is this good enough? */ timestamp = gtk_get_current_event_time (); g_object_ref (scroller); priv->embed = embed; g_object_ref (priv->window); /* set positions */ priv->start_x = x; priv->start_y = y; g_signal_connect (priv->window, "motion-notify-event", G_CALLBACK (ephy_push_scroller_motion_cb), scroller); g_signal_connect (priv->window, "button-press-event", G_CALLBACK (ephy_push_scroller_mouse_press_cb), scroller); g_signal_connect (priv->window, "button-release-event", G_CALLBACK (ephy_push_scroller_mouse_release_cb), scroller); g_signal_connect (priv->window, "key-press-event", G_CALLBACK (ephy_push_scroller_key_press_cb), scroller); g_signal_connect (priv->window, "unmap-event", G_CALLBACK (ephy_push_scroller_unmap_event_cb), scroller); g_signal_connect (priv->window, "grab-broken-event", G_CALLBACK (ephy_push_scroller_grab_broken_event_cb), scroller); /* FIXME: this signal only seems to be emitted on the container children of GtkWindow, * not on GtkWindow itself... is there a better way to get notified of new grabs? */ child = gtk_bin_get_child (GTK_BIN (priv->window)); g_signal_connect_object (child, "grab-notify", G_CALLBACK (ephy_push_scroller_grab_notify_cb), scroller, 0); /* grab the pointer */ widget = GTK_WIDGET (priv->window); gtk_grab_add (widget); if (gdk_pointer_grab (gtk_widget_get_window (widget), FALSE, GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK, NULL, priv->cursor, timestamp) != GDK_GRAB_SUCCESS) { ephy_push_scroller_stop (scroller, timestamp); return; } if (gdk_keyboard_grab (gtk_widget_get_window (widget), FALSE, timestamp) != GDK_GRAB_SUCCESS) { ephy_push_scroller_stop (scroller, timestamp); return; } }