void VNCCanvas::onMouseAction(wxMouseEvent &event)
{
  if(event.Entering())
    {
      SetFocus();

      if(do_keyboard_grab)
	grab_keyboard();

      if(wxTheClipboard->Open()) 
	{
	  if(wxTheClipboard->IsSupported(wxDF_TEXT))
	    {
	      wxTextDataObject data;
	      wxTheClipboard->GetData(data);
	      wxString text = data.GetText();
	      wxLogDebug(wxT("VNCCanvas %p: setting cuttext: '%s'"), this, text.c_str());
	      conn->setCuttext(text);
	    }
	  wxTheClipboard->Close();
	}
    }

  if(event.Leaving())
    {
      if(do_keyboard_grab)
	ungrab_keyboard();
    }

  conn->sendPointerEvent(event);
}
Exemple #2
0
void moveresize_end(gboolean cancel)
{
    ungrab_keyboard();
    ungrab_pointer();

    popup_hide(popup);

    if (!moving) {
#ifdef SYNC
        /* turn off the alarm */
        if (moveresize_alarm != None) {
            XSyncDestroyAlarm(obt_display, moveresize_alarm);
            moveresize_alarm = None;
        }

        if (sync_timer) g_source_remove(sync_timer);
        sync_timer = 0;
#endif
    }

    /* don't use client_move() here, use the same width/height as
       we've been using during the move, otherwise we get different results
       when moving maximized windows between monitors of different sizes !
    */
    client_configure(moveresize_client,
                     (cancel ? start_cx : cur_x),
                     (cancel ? start_cy : cur_y),
                     (cancel ? start_cw : cur_w),
                     (cancel ? start_ch : cur_h),
                     TRUE, TRUE, FALSE);

    /* restore the client's maximized state. do this after putting the window
       back in its original spot to minimize visible flicker */
    if (cancel && (was_max_horz || was_max_vert)) {
        const gboolean h = moveresize_client->max_horz;
        const gboolean v = moveresize_client->max_vert;

        client_maximize(moveresize_client, TRUE,
                        was_max_horz && was_max_vert ? 0 :
                        (was_max_horz ? 1 : 2));

        /* replace the premax values with the ones we had saved if
           the client doesn't have any already set */
        if (was_max_horz && !h) {
            moveresize_client->pre_max_area.x = pre_max_area.x;
            moveresize_client->pre_max_area.width = pre_max_area.width;
        }
        if (was_max_vert && !v) {
            moveresize_client->pre_max_area.y = pre_max_area.y;
            moveresize_client->pre_max_area.height = pre_max_area.height;
        }
    }

    /* dont edge warp after its ended */
    cancel_edge_warp();

    moveresize_in_progress = FALSE;
    moveresize_client = NULL;
}
Exemple #3
0
void grab_shutdown(gboolean reconfig)
{
    if (reconfig) return;

    while (ungrab_keyboard());
    while (ungrab_pointer());
    while (grab_server(FALSE));
}
Exemple #4
0
static void actions_interactive_end_act(void)
{
	syslog(LOG_INFO,"end act");
    if (interactive_act) {
        ungrab_keyboard();
		syslog(LOG_INFO,"end act if");
        actions_act_unref(interactive_act);
        interactive_act = NULL;
    }
}
/**
* win: The window that changed state
* event: The event that triggered it
* data: ignored
*
* Depending on the state it will grab the keyboard or ungrab it.
*
* Returns FALSE
**/
static gboolean
window_state_changed (GtkWidget *win, GdkEventWindowState *event, gpointer data)
{
	GdkWindowState state = gdk_window_get_state (gtk_widget_get_window (win));

	if (state & GDK_WINDOW_STATE_WITHDRAWN ||
	    state & GDK_WINDOW_STATE_ICONIFIED ||
	    state & GDK_WINDOW_STATE_FULLSCREEN ||
	    state & GDK_WINDOW_STATE_MAXIMIZED)
		ungrab_keyboard (win, (GdkEvent*)event, data);
	else
		grab_keyboard (win, (GdkEvent*)event, data);

	return FALSE;
}
Exemple #6
0
static void actions_interactive_end_act(void)
{
    if (interactive_act) {
        ObActionsAct *ia = interactive_act;

        /* set this to NULL first so the i_post() function can't cause this to
           get called again (if it decides it wants to cancel any ongoing
           interactive action). */
        interactive_act = NULL;

        ungrab_keyboard();

        if (ia->i_post)
            ia->i_post(ia->options);

        actions_act_unref(ia);
    }
}
Exemple #7
0
static void menu_frame_hide(ObMenuFrame *self)
{
    ObMenu *const menu = self->menu;
    GList *it = g_list_find(menu_frame_visible, self);
    gulong ignore_start;

    if (!it)
        return;

    if (menu->hide_func)
        menu->hide_func(self, menu->data);

    if (self->child)
        menu_frame_hide(self->child);

    if (self->parent) {
        remove_submenu_hide_timeout(self);

        self->parent->child = NULL;
        self->parent->child_entry = NULL;
    }
    self->parent = NULL;
    self->parent_entry = NULL;

    menu_frame_visible = g_list_delete_link(menu_frame_visible, it);

    if (menu_frame_visible == NULL) {
        /* last menu shown */
        ungrab_pointer();
        ungrab_keyboard();
    }

    ignore_start = event_start_ignore_all_enters();
    XUnmapWindow(obt_display, self->window);
    event_end_ignore_all_enters(ignore_start);

    menu_frame_free(self);

    if (menu->cleanup_func)
        menu->cleanup_func(menu, menu->data);
}