Example #1
0
/*
 ==================================
 ProfileWindow::make_busy_cursor
 ==================================
 */
void ProfileWindow::make_busy_cursor(bool busy)
{
   {
      Glib::Mutex::Lock lock(mutex);
      
      GdkDisplay* display;
      GdkCursor* cursor;
      GdkWindow* window;
      
      display = gdk_display_get_default();
      
      if(busy)
         cursor = gdk_cursor_new(GDK_WATCH);
      else
         cursor = gdk_cursor_new(GDK_LEFT_PTR);
      
      window = (GdkWindow*) profilewindow->get_window()->gobj();
      gdk_window_set_cursor(window, cursor);
      window = (GdkWindow*) prof->get_window()->gobj();
      if(!busy && (fencetoggleprof->get_active() || rulertoggle->get_active()))
      {
         gdk_cursor_unref(cursor);
         cursor = gdk_cursor_new(GDK_CROSSHAIR);
      }
      
      gdk_window_set_cursor(window, cursor);
      gdk_cursor_unref(cursor);
      
      gdk_display_sync(display);
   }
}
Example #2
0
void
draw_preview_image (gboolean recompute)
{
  gint      startx, starty, pw, ph;
  GdkColor  color;

  color.red   = 0x0;
  color.green = 0x0;
  color.blue  = 0x0;
  gdk_gc_set_rgb_bg_color (gc, &color);

  color.red   = 0xFFFF;
  color.green = 0xFFFF;
  color.blue  = 0xFFFF;
  gdk_gc_set_rgb_fg_color (gc, &color);

  gdk_gc_set_function (gc, GDK_COPY);

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

  if (recompute)
    {
      GdkDisplay *display = gtk_widget_get_display (previewarea);
      GdkCursor  *cursor;

      cursor = gdk_cursor_new_for_display (display, GDK_WATCH);

      gdk_window_set_cursor (previewarea->window, cursor);
      gdk_cursor_unref (cursor);

      compute_preview (startx, starty, pw, ph);
      cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
      gdk_window_set_cursor (previewarea->window, cursor);
      gdk_cursor_unref (cursor);
      gdk_flush ();

      /* if we recompute, clear backbuf, so we don't
       * restore the wrong bitmap */
      if (backbuf.image != NULL)
        {
          g_object_unref (backbuf.image);
          backbuf.image = NULL;
        }
    }

  gdk_draw_rgb_image (previewarea->window, gc,
                      0, 0, PREVIEW_WIDTH, PREVIEW_HEIGHT,
                      GDK_RGB_DITHER_MAX, preview_rgb_data,
                      3 * PREVIEW_WIDTH);

  /* draw symbols if enabled in UI */
  if (mapvals.interactive_preview)
    {
      draw_handles ();
    }
}
Example #3
0
static void
immerse_controls_destroy(ImmerseControls *controls)
{
    gtk_widget_destroy(controls->dialog);
    gwy_si_unit_value_format_free(controls->vf);
    g_object_unref(controls->mydata);
    gdk_cursor_unref(controls->near_cursor);
    gdk_cursor_unref(controls->move_cursor);
    GWY_OBJECT_UNREF(controls->detail);
}
Example #4
0
void
draw_preview_image (gint docompute)
{
  gint startx, starty, pw, ph;
  GdkColor  color;

  color.red   = 0x0;
  color.green = 0x0;
  color.blue  = 0x0;
  gdk_gc_set_rgb_bg_color (gc, &color);

  color.red   = 0xFFFF;
  color.green = 0xFFFF;
  color.blue  = 0xFFFF;
  gdk_gc_set_rgb_fg_color (gc, &color);

  gdk_gc_set_function (gc, GDK_COPY);
  linetab[0].x1 = -1;

  pw = PREVIEW_WIDTH * mapvals.zoom;
  ph = PREVIEW_HEIGHT * mapvals.zoom;
  startx = (PREVIEW_WIDTH - pw) / 2;
  starty = (PREVIEW_HEIGHT - ph) / 2;

  if (docompute == TRUE)
    {
      GdkDisplay *display = gtk_widget_get_display (previewarea);
      GdkCursor  *cursor;

      cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
      gdk_window_set_cursor (previewarea->window, cursor);
      gdk_cursor_unref (cursor);

      compute_preview (0, 0, width - 1, height - 1, pw, ph);

      cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
      gdk_window_set_cursor(previewarea->window, cursor);
      gdk_cursor_unref (cursor);

      clear_light_marker ();
    }

  if (pw != PREVIEW_WIDTH || ph != PREVIEW_HEIGHT)
    gdk_window_clear (previewarea->window);

  gdk_draw_rgb_image (previewarea->window, gc,
                      startx, starty, pw, ph,
                      GDK_RGB_DITHER_MAX,
                      preview_rgb_data, 3 * pw);

  draw_lights (startx, starty, pw, ph);
}
static void
mucharmap_charmap_finalize (GObject *object)
{
  MucharmapCharmap *charmap = MUCHARMAP_CHARMAP (object);
  MucharmapCharmapPrivate *priv = charmap->priv;

  gdk_cursor_unref (priv->hand_cursor);
  gdk_cursor_unref (priv->regular_cursor);

  if (priv->font_desc)
	pango_font_description_free (priv->font_desc);

  G_OBJECT_CLASS (mucharmap_charmap_parent_class)->finalize (object);
}
Example #6
0
static void
gs_graph_finalize (GObject *object)
{
	GsGraph *graph = GS_GRAPH (object);

	g_free (graph->priv->grid_color);
	g_free (graph->priv->axes_color);
	g_free (graph->priv->background_color);

	gdk_cursor_unref (graph->priv->default_cursor);
	gdk_cursor_unref (graph->priv->drag_cursor);

	G_OBJECT_CLASS (gs_graph_parent_class)->finalize (object);
}
Example #7
0
static void
git_source_view_dispose (GObject *object)
{
  GitSourceView *self = (GitSourceView *) object;
  GitSourceViewPrivate *priv = self->priv;

  if (priv->paint_source)
    {
      g_object_unref (priv->paint_source);
      priv->paint_source = NULL;
    }

  git_source_view_unref_hadjustment (self);
  git_source_view_unref_vadjustment (self);

  git_source_view_unref_loading_source (self);

  if (priv->state_error)
    {
      g_error_free (priv->state_error);
      priv->state_error = NULL;
    }

  if (priv->hand_cursor)
    {
      gdk_cursor_unref (priv->hand_cursor);
      priv->hand_cursor = NULL;
    }

  G_OBJECT_CLASS (git_source_view_parent_class)->dispose (object);
}
Example #8
0
/* Looks at all tags covering the position (x, y) in the text view,
 * and if one of them is a link, change the cursor to the "hands" cursor
 * typically used by web browsers.
*/
static void
set_cursor_if_appropriate (GtkTextView *text_view, gint x, gint y)
{
  GSList *tags = NULL, *tagp = NULL;
  GtkTextIter iter;
  gboolean hovering = FALSE;

  gtk_text_view_get_iter_at_location (text_view, &iter, x, y);

  tags = gtk_text_iter_get_tags (&iter);
  for (tagp = tags; tagp != NULL; tagp = tagp->next)
   {
     gchar *tag_name;
     GtkTextTag *tag = tagp->data;
     g_object_get (G_OBJECT (tag), "name", &tag_name, NULL);
     if ( g_ascii_strcasecmp(tag_name, "link") == 0)
     {
       hovering = TRUE;
       break;
     }
   }

  GdkCursor *cursor;
  if (hovering)
       cursor = gdk_cursor_new (GDK_LEFT_PTR);
  else
       cursor = gdk_cursor_new (GDK_XTERM);

  gdk_window_set_cursor (gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT),
			 cursor);
  gdk_cursor_unref (cursor);

   if (tags)
     g_slist_free (tags);
}
Example #9
0
/**
 * Grab the keyboard and mouse for the display. The mouse cursor is hidden and
 * moved to the centre of the window.
 *
 * @param win The window receiving the grab
 * @return TRUE if the grab was successful, FALSE on failure.
 */
gboolean video_window_grab_display( main_window_t win )
{
    GdkWindow *gdkwin = win->video->window;
    GdkColor color = { 0,0,0,0 };
    char bytes[32]; /* 16 * 16 / 8 */
    memset(bytes, 0, 32);
    GdkPixmap *pixmap = gdk_bitmap_create_from_data(NULL, bytes, 16, 16);
    GdkCursor *cursor = gdk_cursor_new_from_pixmap(pixmap, pixmap, &color, &color, 16, 16);
    gdk_pixmap_unref(pixmap);

    gboolean success =
        gdk_pointer_grab( gdkwin, FALSE, 
                GDK_POINTER_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK, 
                gdkwin, cursor, GDK_CURRENT_TIME ) == GDK_GRAB_SUCCESS;
    gdk_cursor_unref(cursor);
    if( success ) {
        success = gdk_keyboard_grab( gdkwin, FALSE, GDK_CURRENT_TIME ) == GDK_GRAB_SUCCESS;
        if( !success ) {
            gdk_pointer_ungrab(GDK_CURRENT_TIME);
        }
    }
    win->is_grabbed = success;
    main_window_set_running(win, dreamcast_is_running());
    return success;
}
Example #10
0
void gTextArea::updateCursor(GdkCursor *cursor)
{
  GdkWindow *win;

#ifdef GTK3
	win = gtk_text_view_get_window(GTK_TEXT_VIEW(textview), GTK_TEXT_WINDOW_TEXT);
#else
	win = ((PrivateGtkTextWindow *)GTK_TEXT_VIEW(textview)->text_window)->bin_window;
#endif
  
  gControl::updateCursor(cursor);
  
  if (!win)
  	return;
  
  if (cursor)
    gdk_window_set_cursor(win, cursor);
  else
  {
    cursor = gdk_cursor_new_for_display(gtk_widget_get_display(textview), GDK_XTERM);
    gdk_window_set_cursor(win, cursor);
#ifdef GTK3
    g_object_unref(cursor);
#else
    gdk_cursor_unref(cursor);
#endif
  }
}
Example #11
0
static void
gdict_speller_finalize (GObject *gobject)
{
  GdictSpeller *speller = GDICT_SPELLER (gobject);
  GdictSpellerPrivate *priv = speller->priv;

  if (priv->context)
    set_gdict_context (speller, NULL);

  if (priv->busy_cursor)
#if GTK_CHECK_VERSION (3, 0, 0)
    g_object_unref (priv->busy_cursor);
#else
    gdk_cursor_unref (priv->busy_cursor);
#endif

  g_free (priv->strategy);
  g_free (priv->database);
  g_free (priv->word);

  if (priv->store)
    g_object_unref (priv->store);

  G_OBJECT_CLASS (gdict_speller_parent_class)->finalize (gobject);
}
Example #12
0
void
panel_push_window_busy (GtkWidget *window)
{
    int busy = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window),
                                "Panel:WindowBusy"));

    busy ++;

    if (busy == 1) {
        GdkWindow *win;

        gtk_widget_set_sensitive (window, FALSE);

        win = gtk_widget_get_window (window);
        if (win != NULL) {
            GdkCursor *cursor = gdk_cursor_new_for_display (gdk_display_get_default (),
                                GDK_WATCH);

            gdk_window_set_cursor (win, cursor);
#if GTK_CHECK_VERSION (3, 0, 0)
            g_object_unref (cursor);
#else
            gdk_cursor_unref (cursor);
#endif
            gdk_flush ();
        }
    }

    g_object_set_data (G_OBJECT (window), "Panel:WindowBusy",
                       GINT_TO_POINTER (busy));
}
static void
gdict_source_chooser_dispose (GObject *gobject)
{
  GdictSourceChooser *chooser = GDICT_SOURCE_CHOOSER (gobject);
  GdictSourceChooserPrivate *priv = chooser->priv;

  if (priv->store)
    {
      g_object_unref (priv->store);
      priv->store = NULL;
    }

  if (priv->loader)
    {
      g_object_unref (priv->loader);
      priv->loader = NULL;
    }

  if (priv->busy_cursor)
    {
      gdk_cursor_unref (priv->busy_cursor);
      priv->busy_cursor = NULL;
    }

  G_OBJECT_CLASS (gdict_source_chooser_parent_class)->dispose (gobject);
}
Example #14
0
void layer_new_mouse(void)
{
	// Local variables
	GdkCursor			*selection_cursor;			// Holds the new temporary selection cursor


	// If no project is loaded then don't run this function
	if (NULL == get_current_slide())
	{
		// Make a beep, then return
		gdk_beep();
		return;
	}

	// Change the focus of the window to be this widget
	set_delete_focus(FOCUS_LAYER);

	// Change the cursor to something suitable
	selection_cursor = gdk_cursor_new(GDK_CROSSHAIR);
	gdk_window_set_cursor(get_main_drawing_area()->window, selection_cursor);
	gdk_cursor_unref(selection_cursor);

	// Set a toggle so the release button callback will know to do the rest
	set_new_layer_selected(TYPE_MOUSE_CURSOR);

	// Update the status bar
	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(get_status_bar()), _(" Please click the insertion point"));
	gdk_flush();
}
Example #15
0
Cursor& Cursor::operator=(const Cursor& other)
{
    gdk_cursor_ref(other.m_impl);
    gdk_cursor_unref(m_impl);
    m_impl = other.m_impl;
    return *this;
}
static void
wp_add_images (AppearanceData *data,
               GSList *images)
{
  GdkWindow *window;
  GtkWidget *w;
  GdkCursor *cursor;
  MateWPItem *item;

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

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

  while (images != NULL)
  {
    gchar *uri = images->data;

    item = wp_add_image (data, uri);
    images = g_slist_remove (images, uri);
    g_free (uri);
  }

  gdk_window_set_cursor (window, NULL);

  if (item != NULL)
  {
    select_item (data, item, TRUE);
  }
}
Example #17
0
void
panel_force_quit (GdkScreen *screen,
		  guint      time)
{
	GdkGrabStatus  status;
	GdkCursor     *cross;
	GtkWidget     *popup;
	GdkWindow     *root;

	popup = display_popup_window (screen);

	root = gdk_screen_get_root_window (screen);

	gdk_window_add_filter (root, (GdkFilterFunc) popup_filter, popup);

	cross = gdk_cursor_new (GDK_CROSS);
	status = gdk_pointer_grab (root, FALSE, GDK_BUTTON_PRESS_MASK,
				   NULL, cross, time);
	gdk_cursor_unref (cross);
	if (status != GDK_GRAB_SUCCESS) {
		g_warning ("Pointer grab failed\n");
		remove_popup (popup);
		return;
	}

	status = gdk_keyboard_grab (root, FALSE, time);
	if (status != GDK_GRAB_SUCCESS) {
		g_warning ("Keyboard grab failed\n");
		remove_popup (popup);
		return;
	}

	gdk_flush ();
}
Example #18
0
static void
gtk_ellipsis_state_changed (GtkWidget    *widget,
			    GtkStateType  previous_state)
{
  GtkEllipsis *ellipsis = GTK_ELLIPSIS (widget);
  GtkEllipsisPrivate *priv = ellipsis->priv;

  if (!GTK_WIDGET_IS_SENSITIVE (widget))
    priv->button_down = FALSE;

  if (GTK_WIDGET_REALIZED (widget))
    {
      GdkCursor *cursor;

      if (GTK_WIDGET_IS_SENSITIVE (widget))
        cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
                                             GTK_ELLIPSIS_CURSOR);
      else
        cursor = NULL;

      gdk_window_set_cursor (priv->event_window, cursor);
      if (cursor)
        gdk_cursor_unref (cursor);
    }
}
Example #19
0
void
panel_push_window_busy (GtkWidget *window)
{
	int busy = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (window),
						       "Panel:WindowBusy"));

	busy ++;

	if (busy == 1) {
		GdkWindow *win;

		gtk_widget_set_sensitive (window, FALSE);

		win = gtk_widget_get_window (window);
		if (win != NULL) {
			GdkCursor *cursor = gdk_cursor_new (GDK_WATCH);
			gdk_window_set_cursor (win, cursor);
			gdk_cursor_unref (cursor);
			gdk_flush ();
		}
	}

	g_object_set_data (G_OBJECT (window), "Panel:WindowBusy",
			   GINT_TO_POINTER (busy));
}
Example #20
0
void dt_control_change_cursor(dt_cursor_t curs)
{
  GtkWidget *widget = dt_ui_main_window(darktable.gui->ui);
  GdkCursor* cursor = gdk_cursor_new(curs);
  gdk_window_set_cursor(gtk_widget_get_window(widget), cursor);
  gdk_cursor_unref(cursor);
}
/* Starts the selection state in the icon text item */
static void
iti_start_selecting (MateIconTextItem *iti, int idx, guint32 event_time)
{
    MateIconTextItemPrivate *priv;
    GtkEditable *e;
    GdkCursor *ibeam;

    priv = iti->_priv;
    e = GTK_EDITABLE (priv->entry);

    gtk_editable_select_region (e, idx, idx);
    gtk_editable_set_position (e, idx);
    ibeam = gdk_cursor_new (GDK_XTERM);
    mate_canvas_item_grab (MATE_CANVAS_ITEM (iti),
                           GDK_BUTTON_RELEASE_MASK |
                           GDK_POINTER_MOTION_MASK,
                           ibeam, event_time);
    gdk_cursor_unref (ibeam);

    gtk_editable_select_region (e, idx, idx);
    priv->selecting = TRUE;
    priv->selection_start = idx;

    mate_canvas_item_request_update (MATE_CANVAS_ITEM (iti));

    g_signal_emit (iti, iti_signals[SELECTION_STARTED], 0);
}
Example #22
0
/**
 * e_cursor_set:
 * @widget: Any widget in a window, to which busy cursor has to be set
 * cursor: The type of cursor to be set defined in e-cursor.h
 *
 * Sets the cursor specified, to the top level window of the given widget.
 * It is not window aware, so if you popup a window, it will not have
 * busy cursor set. That has to be handled seperately with a new call to this
 * function.
 *
 * Return value:
 **/
void e_cursor_set (GtkWidget *widget, ECursorType cursor)
{
	GtkWidget *toplevel;
	GdkCursor *window_cursor;

	toplevel = gtk_widget_get_toplevel (widget);
	if (GTK_WIDGET_TOPLEVEL (toplevel) && toplevel->window) {

		switch (cursor) {
			case E_CURSOR_NORMAL :
				window_cursor = gdk_cursor_new (GDK_LEFT_PTR);
				break;
			case E_CURSOR_BUSY :
				window_cursor = gdk_cursor_new (GDK_WATCH);
				break;

			default :
				window_cursor = gdk_cursor_new (GDK_LEFT_PTR);
		}

		gdk_window_set_cursor (toplevel->window, window_cursor);
		gdk_cursor_unref (window_cursor);
	}

}
Example #23
0
static void
gtk_icon_entry_map (GtkWidget *widget)
{
  GtkIconEntryPrivate *priv;
  GdkCursor *cursor;

  if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_MAPPED (widget))
    {
      int i;

      GTK_WIDGET_CLASS (parent_class)->map (widget);

      priv = GTK_ICON_ENTRY_GET_PRIVATE (widget);

      for (i = 0; i < MAX_ICONS; i++)
	{
	  if (priv->icons[i].pixbuf != NULL)
	    gdk_window_show (priv->icons[i].window);

	  if (priv->icons[i].custom_cursor == TRUE && !priv->icons[i].insensitive)
	    {
	      cursor = gdk_cursor_new_for_display (gtk_widget_get_display (widget),
						   priv->icons[i].cursor_type);

	      gdk_window_set_cursor (priv->icons[i].window, cursor);
	      gdk_cursor_unref (cursor);
	    }
	}

      GTK_WIDGET_CLASS (parent_class)->map (widget);
    }
}
Example #24
0
/* Called by gdk_x11_display_finalize to flush any cached cursors
 * for a dead display.
 */
void
_gdk_x11_cursor_display_finalize (GdkDisplay *display)
{
  GSList* item;
  GSList** itemp; /* Pointer to the thing to fix when we delete an item */
  item = cursor_cache;
  itemp = &cursor_cache;
  while (item)
    {
      GdkX11Cursor* cursor = (GdkX11Cursor*)(item->data);
      if (gdk_cursor_get_display (GDK_CURSOR (cursor)) == display)
        {
          GSList* olditem;
          gdk_cursor_unref ((GdkCursor*) cursor);
          /* Remove this item from the list */
          *(itemp) = item->next;
          olditem = item;
          item = g_slist_next (item);
          g_slist_free_1 (olditem);
        } 
      else 
        {
          itemp = &(item->next);
          item = g_slist_next (item);
        }
    }
}
Example #25
0
/**
 * gtk_icon_entry_set_icon_sensitive
 * @entry: A #GtkIconEntry.
 * @position: Icon position.
 * @sensitive: Specifies whether the icon should appear sensitive or insensitive.
 *
 * Sets the sensitivity for the specified icon.
 */
void
gtk_icon_entry_set_icon_sensitive (const GtkIconEntry *icon_entry,
				   GtkIconEntryPosition icon_pos,
				   gboolean sensitive)
{
  EntryIconInfo *icon_info;
  GtkIconEntryPrivate *priv;

  g_return_if_fail (icon_entry != NULL);
  g_return_if_fail (GTK_IS_ICON_ENTRY (icon_entry));
  g_return_if_fail (IS_VALID_ICON_ENTRY_POSITION (icon_pos));

  priv = GTK_ICON_ENTRY_GET_PRIVATE (icon_entry);

  icon_info = &priv->icons[icon_pos];

  icon_info->insensitive = !sensitive;

  if (icon_info->custom_cursor == TRUE && GTK_WIDGET_REALIZED (GTK_WIDGET (icon_entry)))
    {
      GdkCursor *cursor = gdk_cursor_new_for_display (gtk_widget_get_display (GTK_WIDGET (icon_entry)),
						      sensitive ? icon_info->cursor_type : GDK_ARROW);
      gdk_window_set_cursor (icon_info->window, cursor);
      gdk_cursor_unref (cursor);
    }
}
Example #26
0
static void
uni_image_view_unrealize (GtkWidget * widget)
{
    UniImageView *view = UNI_IMAGE_VIEW (widget);
    gdk_cursor_unref (view->void_cursor);
    GTK_WIDGET_CLASS (uni_image_view_parent_class)->unrealize (widget);
}
Example #27
0
/* Redraw the screen from the backing pixmap */
static gboolean expose_event (GtkWidget      *widget,
                              GdkEventExpose *event)
{
	static GdkImage *image = NULL;
	GdkCursor *cursor;
	GdkPixbuf *pixbuf;

	if (framebuffer_allocated == FALSE) {

		rfbClientSetClientData (cl, gtk_init, widget);

		image = gdk_drawable_get_image (widget->window, 0, 0,
		                                widget->allocation.width,
		                                widget->allocation.height);

		cl->frameBuffer= image->mem;

		cl->width  = widget->allocation.width;
		cl->height = widget->allocation.height;

		cl->format.bitsPerPixel = image->bits_per_pixel;
		cl->format.redShift     = image->visual->red_shift;
		cl->format.greenShift   = image->visual->green_shift;
		cl->format.blueShift    = image->visual->blue_shift;

		cl->format.redMax   = (1 << image->visual->red_prec) - 1;
		cl->format.greenMax = (1 << image->visual->green_prec) - 1;
		cl->format.blueMax  = (1 << image->visual->blue_prec) - 1;

#ifdef LIBVNCSERVER_CONFIG_LIBVA
		/* Allow libvncclient to use a more efficient way
		 * of putting the framebuffer on the screen when
		 * using the H.264 format.
		 */
		cl->outputWindow = GDK_WINDOW_XID(widget->window);
#endif

		SetFormatAndEncodings (cl);

		framebuffer_allocated = TRUE;

		/* Also disable local cursor */
                pixbuf = gdk_pixbuf_new_from_xpm_data(dot_cursor_xpm);
	        cursor = gdk_cursor_new_from_pixbuf(gdk_display_get_default(), pixbuf, dot_cursor_x_hot, dot_cursor_y_hot);
		g_object_unref(pixbuf);	
		gdk_window_set_cursor (gtk_widget_get_window(GTK_WIDGET(window)), cursor);
		gdk_cursor_unref(cursor);
	}

#ifndef LIBVNCSERVER_CONFIG_LIBVA
	gdk_draw_image (GDK_DRAWABLE (widget->window),
	                widget->style->fg_gc[gtk_widget_get_state(widget)],
	                image,
	                event->area.x, event->area.y,
	                event->area.x, event->area.y,
	                event->area.width, event->area.height);
#endif

	return FALSE;
}
Example #28
0
static gboolean on_mouse_move(GtkWidget      *entry,
                                                             GdkEventMotion *evt,
                                                             gpointer        user_data)
{
    if( evt->state == GDK_CONTROL_MASK )
    {
        if( ! is_hand_cursor_used( entry ) )
        {
            GdkCursor* hand = gdk_cursor_new_for_display( gtk_widget_get_display(entry), GDK_HAND2 );
            gdk_window_set_cursor( entry->window, hand );
            gdk_cursor_unref( hand );
            g_object_set_qdata( entry, use_hand_cursor, (gpointer)TRUE );
            g_debug( "SET" );
        }
        return TRUE;
    }
    else
    {
        if( is_hand_cursor_used( entry ) )
        {
            gdk_window_set_cursor( entry->window, NULL );
            g_object_set_qdata( entry, use_hand_cursor, (gpointer)FALSE );
            g_debug( "UNSET" );
        }
    }
    return FALSE;
}
Example #29
0
/*
==================================
 FileSaver::on_filesaverdialogresponse

 If Save button has been pressed creates a SaveWorker which
 saves selected flightline.
==================================
*/
void FileSaver::on_filesaverdialogresponse(int response_id)
{
   if(response_id == Gtk::RESPONSE_CLOSE)
   {
      //filesaverdialog->set_filename("");
      filesaverdialog->hide_all();
   }
   else if(response_id == 1)
   {
      if (lidardata==NULL)
    	  return;

      if (saveworker != NULL)
    	  return;

      double scale_factor[3];
      if (!btnUseDefault->get_active())
      {
    	  const char* temp;
    	  temp = scaleFactorEntryX->get_text().c_str();
    	  scale_factor[0] = atof(temp);
    	  temp = scaleFactorEntryY->get_text().c_str();
    	  scale_factor[1] = atof(temp);
    	  temp = scaleFactorEntryZ->get_text().c_str();
    	  scale_factor[2] = atof(temp);
      }
      else
      {
    	  scale_factor[0] = scale_factor[1] = scale_factor[2] = 0;
      }

      // tdo and prof should have the same pointbucket mutex
      Glib::Mutex* pbkt_mutex = tdo->getPointBucketMutex();

      saveworker = new SaveWorker(this, filesaverdialog->get_filename(), lidardata->getFileName(flightlinesaveselect->get_value_as_int()), flightlinesaveselect->get_value_as_int(), parsestringentry->get_text(), latlongselect->get_active(), btnUseDefault->get_active(), scale_factor, pbkt_mutex);
      saveworker->start();
      saveworker->sig_done.connect(sigc::mem_fun(*this, &FileSaver::files_saved));
      saveworker->sig_progress.connect(sigc::mem_fun(*this, &FileSaver::on_progress));
      saveworker->sig_waveform.connect(sigc::mem_fun(*this, &FileSaver::waveform_started));
      saveworker->sig_waveform_progress.connect(sigc::mem_fun(*this, &FileSaver::on_waveform_progress));

      // Show saving dialog
      savedialog->show_all();
      saveprogressbar->set_fraction(0);

	  // Change cursor to busy
	  GdkDisplay* display;
	  GdkCursor* cursor;
	  GdkWindow* window;

	  cursor = gdk_cursor_new(GDK_WATCH);
	  display = gdk_display_get_default();
	  window = (GdkWindow*) filesaverdialog->get_window()->gobj();

	  gdk_window_set_cursor(window, cursor);
	  gdk_display_sync(display);
	  gdk_cursor_unref(cursor);
   }
}
Example #30
0
void ZLGtkProgressDialog::run(ZLRunnable &runnable) {
	while (gtk_events_pending()) {
		gtk_main_iteration();
	}

	GtkWindow *mainWindow = GTK_WINDOW(gtk_window_new(GTK_WINDOW_POPUP));
	gtk_window_set_accept_focus(mainWindow, FALSE);
	myLabel = gtk_label_new(messageText().c_str());
	gtk_misc_set_padding(GTK_MISC(myLabel), 10, 10);    //  something nice?
	gtk_container_add(GTK_CONTAINER(mainWindow), myLabel);
	gtk_widget_show_all(GTK_WIDGET(mainWindow));

	GdkCursor *cursor = gdk_cursor_new(GDK_WATCH);

	if (myParent != 0) {
		gdk_window_set_cursor(GTK_WIDGET(myParent)->window, cursor);
	}

	gdk_window_set_cursor(GTK_WIDGET(mainWindow)->window, cursor);
	gdk_cursor_unref(cursor);

	int x, y, w, h;
	if (myParent != 0) {
		gtk_window_get_position(myParent, &x, &y);
		gtk_window_get_size(myParent, &w, &h);
		x += w / 2;
		y += h / 2;
	} else {
		GdkWindow *root = gdk_screen_get_root_window(gdk_screen_get_default());
		gdk_window_get_geometry(root, &x, &y, &w, &h, 0);
		x += w / 2;
		y += h / 2;
	}
	gtk_window_get_size(mainWindow, &w, &h);
	x -= w / 2;
	y -= h / 2;
	gtk_window_move(mainWindow, x, y);

	while (gtk_events_pending()) {
		gtk_main_iteration();
	}

	if (myParent != 0) {
		gtk_widget_queue_draw(GTK_WIDGET(myParent));
	}

	while (gtk_events_pending()) {
		gtk_main_iteration();
	}

	runnable.run();

	myLabel = 0;

	if (myParent != 0) {
		gdk_window_set_cursor(GTK_WIDGET(myParent)->window, 0);
	}
	gtk_widget_destroy(GTK_WIDGET(mainWindow));
}