Beispiel #1
0
void XNavGtk::set_clock_cursor()
{
  if (!clock_cursor)
    clock_cursor = gdk_cursor_new_for_display(
        gtk_widget_get_display(form_widget), GDK_WATCH);

  gdk_window_set_cursor(form_widget->window, clock_cursor);
  gdk_display_flush(gtk_widget_get_display(form_widget));
}
Beispiel #2
0
void WUtedGtk::clock_cursor()
{
  if ( !cursor)
    cursor = gdk_cursor_new_for_display( gtk_widget_get_display( toplevel),
					       GDK_WATCH);

  gdk_window_set_cursor( toplevel->window, cursor);
  gdk_display_flush( gtk_widget_get_display( toplevel));
}
Beispiel #3
0
static gboolean
gtk_window_motion_notify_callback( GtkWidget *widget, GdkEventMotion *gdk_event, wxMiniFrame *win )
{
    if (gdk_event->window != gtk_widget_get_window(widget))
        return false;
    if (g_blockEventsOnDrag) return TRUE;
    if (g_blockEventsOnScroll) return TRUE;

    int x = int(gdk_event->x);
    int y = int(gdk_event->y);

    if (gdk_event->is_hint)
    {
#ifdef __WXGTK3__
       gdk_window_get_device_position(gdk_event->window, gdk_event->device, &x, &y, NULL);
#else
       gdk_window_get_pointer(gdk_event->window, &x, &y, NULL);
#endif
    }

    if (!win->m_isDragging)
    {
        if (win->GetWindowStyle() & wxRESIZE_BORDER)
        {
            GdkCursor* cursor = NULL;
            GdkWindow* window = gtk_widget_get_window(widget);
            if ((x > win->m_width-14) && (y > win->m_height-14))
            {
                GdkDisplay* display = gdk_window_get_display(window);
                cursor = gdk_cursor_new_for_display(display, GDK_BOTTOM_RIGHT_CORNER);
            }
            gdk_window_set_cursor(window, cursor);
            if (cursor)
            {
#ifdef __WXGTK3__
                g_object_unref(cursor);
#else
                gdk_cursor_unref(cursor);
#endif
            }
        }
        return TRUE;
    }

    win->m_oldX = x - win->m_diffX;
    win->m_oldY = y - win->m_diffY;

    int org_x = 0;
    int org_y = 0;
    gdk_window_get_origin(gtk_widget_get_window(widget), &org_x, &org_y);
    x += org_x - win->m_diffX;
    y += org_y - win->m_diffY;
    gtk_window_move( GTK_WINDOW(win->m_widget), x, y );

    return TRUE;
}
Beispiel #4
0
/*
 *  Set the preview area'a cursor on realize
 */
static void
nova_center_preview_realize (GtkWidget  *widget,
                             NovaCenter *center)
{
  GdkDisplay *display = gtk_widget_get_display (widget);
  GdkCursor  *cursor  = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);

  gimp_preview_set_default_cursor (center->preview, cursor);
  gdk_cursor_unref (cursor);
}
static void
gimp_scrolled_preview_area_realize (GtkWidget           *widget,
                                    GimpScrolledPreview *preview)
{
  GdkDisplay *display = gtk_widget_get_display (widget);

  g_return_if_fail (preview->cursor_move == NULL);

  preview->cursor_move = gdk_cursor_new_for_display (display, GDK_HAND1);
}
Beispiel #6
0
static void
vik_print_preview_realize (GtkWidget *widget)
{
  GdkCursor *cursor;

  cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
                                       GDK_FLEUR);
  gdk_window_set_cursor (gtk_widget_get_window(widget), cursor);
  gdk_cursor_unref (cursor);
}
bool C4Window::ReInit(C4AbstractApp* pApp)
{
	// Check whether multisampling settings was changed. If not then we
	// don't need to ReInit anything.
#ifdef GDK_WINDOWING_X11
	int value;
	Display * const dpy = gdk_x11_display_get_xdisplay(gdk_display_get_default());
	glXGetFBConfigAttrib(dpy, Info, GLX_SAMPLES, &value);
	if(value == Config.Graphics.MultiSampling) return true;

	// Check whether we have a visual with the requested number of samples
	GLXFBConfig new_info;
	if(!FindFBConfig(Config.Graphics.MultiSampling, &new_info)) return false;

	GdkScreen * scr = gtk_widget_get_screen(GTK_WIDGET(render_widget));
	XVisualInfo *vis_info = glXGetVisualFromFBConfig(dpy, new_info);
	assert(vis_info);
	GdkVisual * vis = gdk_x11_screen_lookup_visual(scr, vis_info->visualid);
	XFree(vis_info);

	// Un- and re-realizing the render_widget does not work, the window
	// remains hidden afterwards. So we re-create it from scratch.
	gtk_widget_destroy(GTK_WIDGET(render_widget));
	render_widget = gtk_drawing_area_new();
#if !GTK_CHECK_VERSION(3,10,0)
	gtk_widget_set_double_buffered (GTK_WIDGET(render_widget), false);
#endif
	g_object_set(G_OBJECT(render_widget), "can-focus", TRUE, NULL);
	
	gtk_widget_set_visual(GTK_WIDGET(render_widget),vis);

	Info = new_info;

	// Wait until window is mapped to get the window's XID
	gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(render_widget));
	gtk_widget_show_now(GTK_WIDGET(render_widget));

	if (GTK_IS_LAYOUT(render_widget))
	{
		GdkWindow* bin_wnd = gtk_layout_get_bin_window(GTK_LAYOUT(render_widget));
		renderwnd = GDK_WINDOW_XID(bin_wnd);
	}
	else
	{
		GdkWindow* render_wnd = gtk_widget_get_window(GTK_WIDGET(render_widget));
		renderwnd = GDK_WINDOW_XID(render_wnd);
	}

	gdk_flush();
	gdk_window_set_cursor(gtk_widget_get_window(GTK_WIDGET(render_widget)),
	                      gdk_cursor_new_for_display(gdk_display_get_default(), GDK_BLANK_CURSOR));
	return true;
#endif
}
Beispiel #8
0
void cursors_init (void)
{
	int i;
	GdkDisplay *display;

	display = gdk_display_get_default ();

	for (i = 0; oregano_cursors[i].type != -1; i++) {
		oregano_cursors[i].cursor = gdk_cursor_new_for_display (display, oregano_cursors[i].type);
	}
}
void
preview_compute (void)
{
  GdkDisplay *display = gtk_widget_get_display (previewarea);
  GdkCursor  *cursor;
  gint        startx, starty, pw, ph;

  compute_preview_rectangle (&startx, &starty, &pw, &ph);

  cursor = gdk_cursor_new_for_display (display, GDK_WATCH);

  gdk_window_set_cursor (gtk_widget_get_window (previewarea), cursor);
  gdk_cursor_unref (cursor);

  compute_preview (startx, starty, pw, ph);
  cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
  gdk_window_set_cursor (gtk_widget_get_window (previewarea), cursor);
  gdk_cursor_unref (cursor);
  gdk_flush ();
}
Beispiel #10
0
/* Asks the user to click on a window, then waits for them click
 * the mouse. When the mouse is released, returns the toplevel
 * window under the pointer, or NULL, if there is none.
 */
static GtkWidget *
query_for_toplevel (GdkScreen  *screen,
		    const char *prompt)
{
  GdkDisplay *display = gdk_screen_get_display (screen);
  GtkWidget *popup, *label, *frame;
  GdkCursor *cursor;
  GtkWidget *toplevel = NULL;

  popup = gtk_window_new (GTK_WINDOW_POPUP);
  gtk_window_set_screen (GTK_WINDOW (popup), screen);
  gtk_window_set_modal (GTK_WINDOW (popup), TRUE);
  gtk_window_set_position (GTK_WINDOW (popup), GTK_WIN_POS_CENTER);

  frame = gtk_frame_new (NULL);
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
  gtk_container_add (GTK_CONTAINER (popup), frame);

  label = gtk_label_new (prompt);
  gtk_misc_set_padding (GTK_MISC (label), 10, 10);
  gtk_container_add (GTK_CONTAINER (frame), label);

  gtk_widget_show_all (popup);
  cursor = gdk_cursor_new_for_display (display, GDK_CROSSHAIR);

  if (gdk_pointer_grab (popup->window, FALSE,
			GDK_BUTTON_RELEASE_MASK,
			NULL,
			cursor,
			GDK_CURRENT_TIME) == GDK_GRAB_SUCCESS)
    {
      gboolean clicked = FALSE;

      g_signal_connect (popup, "button-release-event",
			G_CALLBACK (button_release_event_cb), &clicked);

      /* Process events until clicked is set by button_release_event_cb.
       * We pass in may_block=TRUE since we want to wait if there
       * are no events currently.
       */
      while (!clicked)
	g_main_context_iteration (NULL, TRUE);

      toplevel = find_toplevel_at_pointer (gdk_screen_get_display (screen));
      if (toplevel == popup)
	toplevel = NULL;
    }

  gdk_cursor_unref (cursor);
  gtk_widget_destroy (popup);
  gdk_flush ();			/* Really release the grab */

  return toplevel;
}
static void
device_combo_box_realize (GtkWidget *widget)
{
   UnicapgtkDeviceSelection *combo = UNICAPGTK_DEVICE_SELECTION (widget);

   g_return_if_fail (combo->busy_cursor == NULL);

   combo->busy_cursor =
      gdk_cursor_new_for_display (gtk_widget_get_display (widget), GDK_WATCH);

   GTK_WIDGET_CLASS (parent_class)->realize (widget);
}
Beispiel #12
0
void SPSVGView::mouseover()
{
    GdkDisplay *display = gdk_display_get_default();
    GdkCursor  *cursor  = gdk_cursor_new_for_display(display, GDK_HAND2);
    GdkWindow *window = gtk_widget_get_window (GTK_WIDGET(SP_CANVAS_ITEM(_drawing)->canvas));
    gdk_window_set_cursor(window, cursor);
#if GTK_CHECK_VERSION(3,0,0)
    g_object_unref(cursor);
#else
    gdk_cursor_unref(cursor);
#endif
}
Beispiel #13
0
static gboolean
gimp_context_help_idle_start (gpointer widget)
{
  if (! gtk_grab_get_current ())
    {
      GtkWidget     *invisible;
      GdkCursor     *cursor;
      GdkGrabStatus  status;

      invisible = gtk_invisible_new_for_screen (gtk_widget_get_screen (widget));
      gtk_widget_show (invisible);

      cursor = gdk_cursor_new_for_display (gtk_widget_get_display (invisible),
                                           GDK_QUESTION_ARROW);

      status = gdk_pointer_grab (gtk_widget_get_window (invisible), TRUE,
                                 GDK_BUTTON_PRESS_MASK   |
                                 GDK_BUTTON_RELEASE_MASK |
                                 GDK_ENTER_NOTIFY_MASK   |
                                 GDK_LEAVE_NOTIFY_MASK,
                                 NULL, cursor,
                                 GDK_CURRENT_TIME);

      g_object_unref (cursor);

      if (status != GDK_GRAB_SUCCESS)
        {
          gtk_widget_destroy (invisible);
          return FALSE;
        }

      if (gdk_keyboard_grab (gtk_widget_get_window (invisible), TRUE,
                             GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
        {
          gdk_display_pointer_ungrab (gtk_widget_get_display (invisible),
                                      GDK_CURRENT_TIME);
          gtk_widget_destroy (invisible);
          return FALSE;
        }

      gtk_grab_add (invisible);

      g_signal_connect (invisible, "button-press-event",
                        G_CALLBACK (gimp_context_help_button_press),
                        NULL);
      g_signal_connect (invisible, "key-press-event",
                        G_CALLBACK (gimp_context_help_key_press),
                        NULL);
    }

  return FALSE;
}
static void
set_drag_cursor (GtkWidget *widget)
{
  GdkCursor *cursor;
  GdkScreen *screen;

  screen = gtk_widget_get_screen (widget);

  cursor = gdk_cursor_new_for_display (gdk_screen_get_display (screen),
				       GDK_HAND2);
  gdk_window_set_cursor (gtk_widget_get_window (widget), cursor);
  gdk_cursor_unref (cursor);
}
Beispiel #15
0
/*#
    @method new_for_display GdkCursor
    @brief Creates a new cursor from the set of builtin cursors.
    @param display the GdkDisplay for which the cursor will be created
    @param cursor_type cursor to create (GdkCursorType)
 */
FALCON_FUNC Cursor::new_for_display( VMARG )
{
    Item* i_display = vm->param( 0 );
    Item* i_tp = vm->param( 1 );
#ifndef NO_PARAMETER_CHECK
    if ( !i_display || !i_display->isObject() || !IS_DERIVED( i_display, GdkDisplay )
        || !i_tp || !i_tp->isInteger() )
        throw_inv_params( "GdkDisplay,GdkCursorType" );
#endif
    vm->retval( new Gdk::Cursor( vm->findWKI( "GdkCursor" )->asClass(),
                gdk_cursor_new_for_display( GET_DISPLAY( *i_display ),
                                            (GdkCursorType) i_tp->asInteger() ) ) );
}
Beispiel #16
0
void
cb_page_widget_link(ZathuraPage* page, void* data)
{
  g_return_if_fail(page != NULL);

  bool enter = (bool) data;

  GdkWindow* window = gtk_widget_get_parent_window(GTK_WIDGET(page));
  GdkDisplay* display = gtk_widget_get_display(GTK_WIDGET(page));
  GdkCursor* cursor = gdk_cursor_new_for_display(display, enter == true ? GDK_HAND1 : GDK_LEFT_PTR);
  gdk_window_set_cursor(window, cursor);
  g_object_unref(cursor);
}
Beispiel #17
0
/**
 * gva_main_cursor_busy:
 *
 * Sets the mouse cursor to busy.  Generally useful before starting a
 * long-running foreground task.
 **/
void
gva_main_cursor_busy (void)
{
        GdkCursor *cursor;
        GdkDisplay *display;
        GtkWidget *widget;

        widget = GVA_WIDGET_MAIN_WINDOW;
        display = gtk_widget_get_display (widget);
        cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
        gdk_window_set_cursor (widget->window, cursor);
        gdk_cursor_unref (cursor);
}
Beispiel #18
0
static void
eds_plugin_busy (PlannerPlugin *plugin,
		 gboolean       busy)
{
	GdkCursor      *cursor;
	GtkProgressBar *progress = GTK_PROGRESS_BAR (glade_xml_get_widget
			(plugin->priv->glade, "progressbar"));

	if (busy) {
		gint check_time = 1; /* second */

		if (plugin->priv->busy) {
			return;
		}
		plugin->priv->pulse = g_timeout_add_seconds (check_time, eds_check_query, plugin);
		cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_WATCH);
		gtk_widget_set_sensitive
			(glade_xml_get_widget (plugin->priv->glade, "search_box"), FALSE);
		gtk_widget_set_sensitive
			(glade_xml_get_widget (plugin->priv->glade, "progress"), TRUE);
		plugin->priv->busy = TRUE;

	} else {
		g_source_remove (plugin->priv->pulse);
		gtk_progress_bar_set_fraction (progress, 0);

		gtk_widget_set_sensitive
			(glade_xml_get_widget (plugin->priv->glade, "progress"), FALSE);
		gtk_widget_set_sensitive
			(glade_xml_get_widget (plugin->priv->glade, "search_box"), TRUE);
		cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_LEFT_PTR);
		plugin->priv->busy = FALSE;
	}

	gdk_window_set_cursor (gtk_widget_get_parent_window
			       (glade_xml_get_widget (plugin->priv->glade, "ok_button")),
			       cursor);
}
static void
go_combo_box_realize (GtkWidget *widget)
{
	GOComboBox *combo = (GOComboBox *)widget;
	GdkCursor *cursor;

	cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
					     GDK_TOP_LEFT_ARROW);
	gtk_widget_realize (combo->priv->popup);
	gdk_window_set_cursor (gtk_widget_get_window (combo->priv->popup), cursor);
	g_object_unref (cursor);

	((GtkWidgetClass *)go_combo_box_parent_class)->realize (widget);
}
/* Sets dialog busy state according to busy
 *
 * When busy:
 *	Sets the cursor to busy
 *  Disables the interface to prevent that the user interferes
 * Reverts all this when non-busy
 *
 * Note that this function takes into account the
 * authentication state of the dialog. So setting the
 * dialog to busy and then back to normal should leave
 * the dialog unchanged.
 */
static void
passdlg_set_busy (PasswordDialog *pdialog, gboolean busy)
{
	GtkBuilder *dialog;
	GtkWidget  *toplevel;
	GdkCursor  *cursor = NULL;
	GdkDisplay *display;

	dialog = pdialog->ui;

	/* Set cursor */
	toplevel = WID ("change-password");
	display = gtk_widget_get_display (toplevel);
	if (busy) {
		cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
	}

	gdk_window_set_cursor (gtk_widget_get_window (toplevel), cursor);
	gdk_display_flush (display);

	if (busy) {
#if GTK_CHECK_VERSION (3, 0, 0)
		g_object_unref (cursor);
#else
		gdk_cursor_unref (cursor);
#endif
	}

	/* Disable/Enable UI */
	if (pdialog->authenticated) {
		/* Authenticated state */

		/* Enable/disable new password section */
		g_object_set (pdialog->new_password, "sensitive", !busy, NULL);
		g_object_set (pdialog->retyped_password, "sensitive", !busy, NULL);
		g_object_set (WID ("new-password-label"), "sensitive", !busy, NULL);
		g_object_set (WID ("retyped-password-label"), "sensitive", !busy, NULL);

		/* Enable/disable change password button */
		g_object_set (WID ("change-password-button"), "sensitive", !busy, NULL);

	} else {
		/* Not-authenticated state */

		/* Enable/disable auth section state */
		g_object_set (pdialog->current_password, "sensitive", !busy, NULL);
		g_object_set (WID ("authenticate-button"), "sensitive", !busy, NULL);
		g_object_set (WID ("current-password-label"), "sensitive", !busy, NULL);
	}
}
Beispiel #21
0
GdkCursorType
preview_set_cursor(Preview_t *preview, GdkCursorType cursor_type)
{
   GdkCursorType  prev_cursor = preview->cursor;
   GdkDisplay    *display     = gtk_widget_get_display (preview->window);
   GdkCursor     *cursor      = gdk_cursor_new_for_display (display,
                                                            cursor_type);

   gdk_window_set_cursor(gtk_widget_get_window (preview->window), cursor);
   gdk_cursor_unref(cursor);

   preview->cursor = cursor_type;

   return prev_cursor;
}
Beispiel #22
0
static gboolean hide_cursor(gpointer data)
{
	MainWindow *wnd;
	GdkCursor *cursor;

	wnd = data;
	cursor = gdk_cursor_new_for_display(	gdk_display_get_default(),
						GDK_BLANK_CURSOR );

	gdk_window_set_cursor
		(gtk_widget_get_window(GTK_WIDGET(wnd->vid_area)), cursor);

	wnd->timeout_tag = 0;

	return FALSE;
}
static void
gdl_dock_item_grip_realize (GtkWidget *widget)
{
    GdlDockItemGrip *grip = GDL_DOCK_ITEM_GRIP (widget);

    GTK_WIDGET_CLASS (parent_class)->realize (widget);

    if (!grip->title_window) {
        GdkWindowAttr  attributes;
        GdkRectangle   area;
        GdkCursor     *cursor;

        ensure_title_and_icon_pixbuf (grip);
        gdl_dock_item_grip_get_title_area (grip, &area);

        attributes.x                 = area.x;
        attributes.y                 = area.y;
        attributes.width             = area.width;
        attributes.height            = area.height;
        attributes.window_type       = GDK_WINDOW_TEMP;
        attributes.wclass            = GDK_INPUT_ONLY;
        attributes.override_redirect = TRUE;
        attributes.event_mask        = (GDK_BUTTON_PRESS_MASK   |
                                        GDK_BUTTON_RELEASE_MASK |
                                        GDK_BUTTON_MOTION_MASK  |
                                        gtk_widget_get_events (widget));

        grip->title_window = gdk_window_new (gtk_widget_get_parent_window (widget),
                                             &attributes,
                                             (GDK_WA_X |
                                              GDK_WA_Y |
                                              GDK_WA_NOREDIR));

        gdk_window_set_user_data (grip->title_window, widget);
 
        if (GDL_DOCK_ITEM_CANT_CLOSE (grip->item))
	    cursor = NULL;
	else if (GDL_DOCK_ITEM_CANT_ICONIFY (grip->item))
	    cursor = NULL;
	else 
	    cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
                                             GDK_HAND2);
        gdk_window_set_cursor (grip->title_window, cursor);
	if (cursor)
            gdk_cursor_unref (cursor);
    }
}
HCURSOR SWELL_LoadCursor(const char *_idx)
{
#ifdef SWELL_TARGET_GDK

  GdkCursorType def = GDK_LEFT_PTR;
  if (_idx == IDC_NO) def = GDK_PIRATE;
  else if (_idx == IDC_SIZENWSE) def = GDK_BOTTOM_LEFT_CORNER;
  else if (_idx == IDC_SIZENESW) def = GDK_BOTTOM_RIGHT_CORNER;
  else if (_idx == IDC_SIZEALL) def = GDK_FLEUR;
  else if (_idx == IDC_SIZEWE) def =  GDK_RIGHT_SIDE;
  else if (_idx == IDC_SIZENS) def = GDK_TOP_SIDE;
  else if (_idx == IDC_ARROW) def = GDK_LEFT_PTR;
  else if (_idx == IDC_HAND) def = GDK_HAND1;
  else if (_idx == IDC_UPARROW) def = GDK_CENTER_PTR;
  else if (_idx == IDC_IBEAM) def = GDK_XTERM;
  else 
  {
    SWELL_CursorResourceIndex *p = SWELL_curmodule_cursorresource_head;
    while (p)
    {
      if (p->resid == _idx)
      {
        if (p->cachedCursor) return p->cachedCursor;
        // todo: load from p->resname, into p->cachedCursor, p->hotspot
        char buf[1024];
        GetModuleFileName(NULL,buf,sizeof(buf));
        WDL_remove_filepart(buf);
        snprintf_append(buf,sizeof(buf),"/Resources/%s.cur",p->resname);
        GdkPixbuf *pb = gdk_pixbuf_new_from_file(buf,NULL);
        if (pb) 
        {
          getHotSpotForFile(buf,&p->hotspot);
          GdkCursor *curs = gdk_cursor_new_from_pixbuf(gdk_display_get_default(),pb,p->hotspot.x,p->hotspot.y);
          return (p->cachedCursor = (HCURSOR) curs);
        }
      }
      p=p->_next;
    }
  }

  HCURSOR hc= (HCURSOR)gdk_cursor_new_for_display(gdk_display_get_default(),def);

  return hc;
#endif
  return NULL;
}
static void
wp_drag_received (GtkWidget *widget,
                  GdkDragContext *context,
                  gint x, gint y,
                  GtkSelectionData *selection_data,
                  guint info, guint time,
                  AppearanceData *data)
{
  if (info == TARGET_URI_LIST || info == TARGET_BGIMAGE)
  {
    GSList *realuris = NULL;
    gchar **uris;

    uris = g_uri_list_extract_uris ((gchar *) gtk_selection_data_get_data (selection_data));
    if (uris != NULL)
    {
      GtkWidget *w;
      GdkWindow *window;
      GdkCursor *cursor;
      gchar **uri;

      w = appearance_capplet_get_widget (data, "appearance_window");
      window = gtk_widget_get_window (w);

      cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
             GDK_WATCH);
      gdk_window_set_cursor (window, cursor);
      gdk_cursor_unref (cursor);

      for (uri = uris; *uri; ++uri)
      {
        GFile *f;

        f = g_file_new_for_uri (*uri);
        realuris = g_slist_append (realuris, g_file_get_path (f));
        g_object_unref (f);
      }

      wp_add_images (data, realuris);
      gdk_window_set_cursor (window, NULL);

      g_strfreev (uris);
    }
  }
}
Beispiel #26
0
static void
video_area_realize_cb (GtkWidget *widget,
		       gpointer   user_data)
{
	GthMediaViewerPage *self = user_data;

	self->priv->video_window_xid = GDK_WINDOW_XID (gtk_widget_get_window (widget));
	self->priv->cursor = gdk_cursor_new (GDK_LEFT_PTR);
	self->priv->cursor_void = gdk_cursor_new_for_display (gtk_widget_get_display (self->priv->area), GDK_BLANK_CURSOR);
	if (self->priv->cursor_visible)
		gdk_window_set_cursor (gtk_widget_get_window (self->priv->area), self->priv->cursor);
	else
		gdk_window_set_cursor (gtk_widget_get_window (self->priv->area), self->priv->cursor_void);

	self->priv->caption_layout = gtk_widget_create_pango_layout (widget, "");
	pango_layout_set_alignment (self->priv->caption_layout, PANGO_ALIGN_CENTER);
	_gth_media_viewer_page_update_caption (self);
}
Beispiel #27
0
static void
lookup_start_cb (GdictContext *context,
		 gpointer      user_data)
{
  GdictSpeller *speller = GDICT_SPELLER (user_data);
  GdictSpellerPrivate *priv = speller->priv;

  if (!priv->busy_cursor)
    {
      GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (speller));
      priv->busy_cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
    }

  if (gtk_widget_get_window (GTK_WIDGET (speller)))
    gdk_window_set_cursor (gtk_widget_get_window (GTK_WIDGET (speller)), priv->busy_cursor);

  priv->is_searching = TRUE;
}
static void
accept_password_dialog (GtkButton        *button,
                        UmPasswordDialog *um)
{
        const gchar *password;

        password = gtk_entry_get_text (GTK_ENTRY (um->password_entry));

        switch (um->password_mode) {
                act_user_set_password_mode (um->user, ACT_USER_PASSWORD_MODE_REGULAR);
                case ACT_USER_PASSWORD_MODE_REGULAR:
                        if (act_user_get_uid (um->user) == getuid ()) {
                                GdkDisplay *display;
                                GdkCursor *cursor;

                                /* When setting a password for the current user,
                                 * use passwd directly, to preserve the audit trail
                                 * and to e.g. update the keyring password.
                                 */
                                passwd_change_password (um->passwd_handler, password,
                                                        (PasswdCallback) password_changed_cb, um);
                                gtk_widget_set_sensitive (um->dialog, FALSE);
                                display = gtk_widget_get_display (um->dialog);
                                cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
                                gdk_window_set_cursor (gtk_widget_get_window (um->dialog), cursor);
                                gdk_display_flush (display);
                                g_object_unref (cursor);
                                return;
                        }

                        act_user_set_password (um->user, password, "");
                        break;

                case ACT_USER_PASSWORD_MODE_SET_AT_LOGIN:
                        act_user_set_password_mode (um->user,  um->password_mode);
                        act_user_set_automatic_login (um->user, FALSE);
                        break;

                default:
                        g_assert_not_reached ();
        }

        finish_password_change (um);
}
Beispiel #29
0
static gboolean
git_source_view_motion_notify_event (GtkWidget *widget,
                                     GdkEventMotion *event)
{
  GitSourceView *sview = (GitSourceView *) widget;
  GitSourceViewPrivate *priv = sview->priv;
  gboolean show_cursor = FALSE;

  /* Show the hand cursor when the pointer is over a commit hash */
  if (priv->paint_source)
    {
      int n_lines = git_annotated_source_get_n_lines (priv->paint_source);

      if (event->y < priv->y_offset + priv->line_height * n_lines
          && event->x < priv->max_hash_length)
        show_cursor = TRUE;
    }

  if (show_cursor)
    {
      if (!priv->hand_cursor_set)
        {
          /* Create the hand cursor if we haven't already got
             one. This will be unref'd in the dispose handler */
          if (priv->hand_cursor == NULL)
            priv->hand_cursor
              = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
                                            GDK_HAND2);
          gdk_window_set_cursor (widget->window, priv->hand_cursor);

          priv->hand_cursor_set = TRUE;
        }
    }
  else
    {
      if (priv->hand_cursor_set)
        {
          gdk_window_set_cursor (widget->window, NULL);
          priv->hand_cursor_set = FALSE;
        }
    }

  return FALSE;
}
Beispiel #30
0
cairo_surface_t *
gitg_platform_support_create_cursor_surface (GdkDisplay    *display,
                                             GdkCursorType  cursor_type,
                                             gdouble       *hot_x,
                                             gdouble       *hot_y,
                                             gdouble       *width,
                                             gdouble       *height)
{
	GdkCursor *cursor;
	cairo_surface_t *surface;
	gdouble w = 0, h = 0;

	cursor = gdk_cursor_new_for_display (display, cursor_type);
	surface = gdk_cursor_get_surface (cursor, hot_x, hot_y);

	if (surface == NULL)
	{
		return NULL;
	}

	switch (cairo_surface_get_type (surface))
	{
	case CAIRO_SURFACE_TYPE_XLIB:
		w = cairo_xlib_surface_get_width (surface);
		h = cairo_xlib_surface_get_height (surface);
		break;
	case CAIRO_SURFACE_TYPE_IMAGE:
		w = cairo_image_surface_get_width (surface);
		h = cairo_image_surface_get_height (surface);
		break;
	}

	if (width)
	{
		*width = w;
	}

	if (height)
	{
		*height = h;
	}

	return surface;
}