示例#1
0
static gchar *
gui_get_display_name (Gimp *gimp,
                      gint  display_ID,
                      gint *monitor_number)
{
  GimpDisplay *display = NULL;
  GdkScreen   *screen;
  gint         monitor;

  if (display_ID > 0)
    display = gimp_display_get_by_ID (gimp, display_ID);

  if (display)
    {
      screen  = gtk_widget_get_screen (display->shell);
      monitor = gdk_screen_get_monitor_at_window (screen,
                                                  display->shell->window);
    }
  else
    {
      gint x, y;

      gdk_display_get_pointer (gdk_display_get_default (),
                               &screen, &x, &y, NULL);
      monitor = gdk_screen_get_monitor_at_point (screen, x, y);
    }

  *monitor_number = monitor;

  if (screen)
    return gdk_screen_make_display_name (screen);

  return NULL;
}
示例#2
0
GimpDisplay *
gimp_display_new (GimpImage       *image,
                  GimpUnit         unit,
                  gdouble          scale,
                  GimpMenuFactory *menu_factory,
                  GimpUIManager   *popup_manager)
{
  GimpDisplay *display;
  gint         ID;

  g_return_val_if_fail (GIMP_IS_IMAGE (image), NULL);

  /*  If there isn't an interface, never create a display  */
  if (image->gimp->no_interface)
    return NULL;

  do
    {
      ID = image->gimp->next_display_ID++;

      if (image->gimp->next_display_ID == G_MAXINT)
        image->gimp->next_display_ID = 1;
    }
  while (gimp_display_get_by_ID (image->gimp, ID));

  display = g_object_new (GIMP_TYPE_DISPLAY,
                          "id", ID,
                          NULL);

  /*  refs the image  */
  gimp_display_connect (display, image);

  /*  create the shell for the image  */
  display->shell = gimp_display_shell_new (display, unit, scale,
                                           menu_factory, popup_manager);
  gtk_widget_show (display->shell);

  g_signal_connect (GIMP_DISPLAY_SHELL (display->shell)->statusbar, "cancel",
                    G_CALLBACK (gimp_display_progress_canceled),
                    display);

  /* add the display to the list */
  gimp_container_add (image->gimp->displays, GIMP_OBJECT (display));

  return display;
}
示例#3
0
文件: gui-vtable.c 项目: 1ynx/gimp
static GimpObject *
gui_display_get_by_ID (Gimp *gimp,
                       gint  ID)
{
  return (GimpObject *) gimp_display_get_by_ID (gimp, ID);
}