示例#1
0
gboolean
rotate_video (UserInterface * ui)
{
  gfloat *x = 0, *y = 0, *z = 0;
  gfloat vid_width, vid_height;
  gfloat x_center, y_center;
  gdouble angle;

  angle = clutter_actor_get_rotation (ui->texture, CLUTTER_Z_AXIS, x, y, z);
  angle += 90;
  if (angle == 360)
    angle = 0;
  clutter_actor_set_rotation (ui->texture, CLUTTER_Z_AXIS, angle, 0, 0, 0);

  if (angle == 90 || angle == 270) {
    ui->rotated = TRUE;

    if (!ui->fullscreen) {
      clutter_actor_set_width (ui->stage, ui->media_height);
      clutter_actor_set_height (ui->stage, ui->media_width);
    }
  } else {
    ui->rotated = FALSE;

    if (!ui->fullscreen) {
      clutter_actor_set_width (ui->stage, ui->media_width);
      clutter_actor_set_height (ui->stage, ui->media_height);
    }
  }

  size_change (CLUTTER_STAGE (ui->stage), ui);
}
示例#2
0
static void
size_change_foreach(GtkWidget *w, gpointer data)
{
	AppletInfo *info = g_object_get_data (G_OBJECT (w), "applet_info");
	PanelWidget *panel = data;
	
	size_change(info,panel);
}
示例#3
0
static void
mate_panel_applet_added(GtkWidget *widget, GtkWidget *applet, gpointer data)
{
	AppletInfo    *info;

	info = g_object_get_data (G_OBJECT (applet), "applet_info");

	orientation_change(info,PANEL_WIDGET(widget));
	size_change(info,PANEL_WIDGET(widget));
	back_change(info,PANEL_WIDGET(widget));
}
示例#4
0
AppletInfo *
panel_applet_register (GtkWidget       *applet,
		       PanelWidget     *panel,
		       PanelObjectType  type,
		       const char      *id,
		       GSettings       *settings,
		       gpointer         data,
		       GDestroyNotify   data_destroy)
{
	AppletInfo          *info;
	PanelObjectPackType  pack_type;
	int                  pack_index;
	
	g_return_val_if_fail (applet != NULL && panel != NULL, NULL);

	if (gtk_widget_get_has_window (applet))
		gtk_widget_set_events (applet, (gtk_widget_get_events (applet) |
						APPLET_EVENT_MASK) &
				       ~( GDK_POINTER_MOTION_MASK |
					  GDK_POINTER_MOTION_HINT_MASK));

	info = g_new0 (AppletInfo, 1);
	info->type         = type;
	info->widget       = applet;
	info->settings     = g_object_ref (settings);
	info->menu         = NULL;
	info->data         = data;
	info->data_destroy = data_destroy;
	info->user_menu    = NULL;
	info->id           = g_strdup (id);

	g_object_set_data (G_OBJECT (applet), "applet_info", info);

	registered_applets = g_slist_append (registered_applets, info);

	/* Find where to insert the applet */
        pack_type = g_settings_get_enum (info->settings, PANEL_OBJECT_PACK_TYPE_KEY);
        pack_index = g_settings_get_int (info->settings, PANEL_OBJECT_PACK_INDEX_KEY);

	/* Insert it */
	panel_widget_add (panel, applet, pack_type, pack_index, TRUE);

	if (BUTTON_IS_WIDGET (applet) ||
	    gtk_widget_get_has_window (applet)) {
		g_signal_connect (applet, "button_press_event",
				  G_CALLBACK (applet_button_press),
				  info);

		g_signal_connect (applet, "key_press_event",
				  G_CALLBACK (applet_key_press),
				  info);
	}

	g_signal_connect (applet, "destroy",
			  G_CALLBACK (panel_applet_destroy),
			  info);

	panel_applet_set_dnd_enabled (info, TRUE);

	gtk_widget_show (applet);

	orientation_change (info, panel);
	size_change (info, panel);
	back_change (info, panel);

	if (type != PANEL_OBJECT_APPLET)
		gtk_widget_grab_focus (applet);
	else
		gtk_widget_child_focus (applet, GTK_DIR_TAB_FORWARD);

	return info;
}
示例#5
0
AppletInfo *
mate_panel_applet_register (GtkWidget       *applet,
		       gpointer         data,
		       GDestroyNotify   data_destroy,
		       PanelWidget     *panel,
		       gboolean         locked,
		       gint             pos,
		       gboolean         exactpos,
		       PanelObjectType  type,
		       const char      *id)
{
	AppletInfo *info;
	gchar *path;
	gchar *locked_changed;

	g_return_val_if_fail (applet != NULL && panel != NULL, NULL);

	if (gtk_widget_get_has_window (applet))
		gtk_widget_set_events (applet, (gtk_widget_get_events (applet) |
						APPLET_EVENT_MASK) &
				       ~( GDK_POINTER_MOTION_MASK |
					  GDK_POINTER_MOTION_HINT_MASK));

	info = g_new0 (AppletInfo, 1);
	info->type         = type;
	info->widget       = applet;
	info->menu         = NULL;
	info->data         = data;
	info->data_destroy = data_destroy;
	info->user_menu    = NULL;
	info->move_item    = NULL;
	info->id           = g_strdup (id);

	path = g_strdup_printf (PANEL_OBJECT_PATH "%s/", id);
	info->settings = g_settings_new_with_path (PANEL_OBJECT_SCHEMA, path);
	g_free (path);

	g_object_set_data (G_OBJECT (applet), "applet_info", info);

	if (type != PANEL_OBJECT_APPLET)
		panel_lockdown_notify_add (G_CALLBACK (mate_panel_applet_recreate_menu),
					   info);

	locked_changed = g_strdup_printf ("changed::%s", PANEL_OBJECT_LOCKED_KEY);
	g_signal_connect (info->settings,
					  locked_changed,
					  G_CALLBACK (mate_panel_applet_locked_change_notify),
					  G_OBJECT (applet));
	g_free (locked_changed);

	if (type == PANEL_OBJECT_DRAWER) {
		Drawer *drawer = data;
		PanelWidget *assoc_panel;

		assoc_panel = panel_toplevel_get_panel_widget (drawer->toplevel);

		g_object_set_data (G_OBJECT (applet),
				   MATE_PANEL_APPLET_ASSOC_PANEL_KEY, assoc_panel);
		assoc_panel->master_widget = applet;
		g_object_add_weak_pointer (
			G_OBJECT (applet), (gpointer *) &assoc_panel->master_widget);
	}

	g_object_set_data (G_OBJECT (applet),
			   MATE_PANEL_APPLET_FORBIDDEN_PANELS, NULL);

	registered_applets = g_slist_append (registered_applets, info);

	if (panel_widget_add (panel, applet, locked, pos, exactpos) == -1 &&
	    panel_widget_add (panel, applet, locked, 0, TRUE) == -1) {
		GSList *l;

		for (l = panels; l; l = l->next) {
			panel = PANEL_WIDGET (l->data);

			if (panel_widget_add (panel, applet, locked, 0, TRUE) != -1)
				break;
		}

		if (!l) {
			g_warning (_("Cannot find an empty spot"));
			panel_profile_delete_object (info);
			return NULL;
		}
	}

	if (BUTTON_IS_WIDGET (applet) ||
	    gtk_widget_get_has_window (applet)) {
		g_signal_connect (applet, "button_press_event",
				  G_CALLBACK (applet_button_press),
				  info);

		g_signal_connect (applet, "popup_menu",
				  G_CALLBACK (applet_popup_menu),
				  info);
	}

	g_signal_connect (applet, "destroy",
			  G_CALLBACK (mate_panel_applet_destroy),
			  info);

	mate_panel_applet_set_dnd_enabled (info, !locked);

	gtk_widget_show_all (applet);

	orientation_change (info, panel);
	size_change (info, panel);
	back_change (info, panel);

	if (type != PANEL_OBJECT_APPLET)
		gtk_widget_grab_focus (applet);
	else
		gtk_widget_child_focus (applet, GTK_DIR_TAB_FORWARD);

	return info;
}
示例#6
0
static void
load_controls (UserInterface * ui)
{
  // Check icon files exist
  gchar *vid_panel_png;
  gchar *icon_files[6];
  gchar *duration_str;
  gint c;
  ClutterColor control_color1 = { 0x12, 0x12, 0x12, 0xff };
  ClutterColor control_color2 = { 0xcc, 0xcc, 0xcc, 0xff };
  ClutterLayoutManager *controls_layout;
  ClutterLayoutManager *main_box_layout;
  ClutterLayoutManager *info_box_layout;
  ClutterLayoutManager *bottom_box_layout;
  ClutterLayoutManager *volume_box_layout;
  ClutterLayoutManager *seek_box_layout;
  ClutterLayoutManager *vol_int_box_layout;
  ClutterActor *seek_box;
  ClutterActor *bottom_box;
  ClutterActor *vol_int_box;
  GError *error = NULL;

  vid_panel_png = g_strdup_printf ("%s%s", SNAPPY_DATA_DIR, "/vid-panel.png");
  ui->play_png = g_strdup_printf ("%s%s", SNAPPY_DATA_DIR,
      "/media-actions-start.png");
  ui->pause_png = g_strdup_printf ("%s%s", SNAPPY_DATA_DIR,
      "/media-actions-pause.png");
  ui->volume_low_png = g_strdup_printf ("%s%s", SNAPPY_DATA_DIR,
      "/audio-volume-low.png");
  ui->volume_high_png = g_strdup_printf ("%s%s", SNAPPY_DATA_DIR,
      "/audio-volume-high.png");
  ui->segment_png = g_strdup_printf ("%s%s", SNAPPY_DATA_DIR,
      "/media-actions-segment-point.png");

  icon_files[0] = vid_panel_png;
  icon_files[1] = ui->play_png;
  icon_files[2] = ui->pause_png;
  icon_files[3] = ui->volume_low_png;
  icon_files[4] = ui->volume_high_png;
  icon_files[5] = ui->segment_png;

  for (c = 0; c < 6; c++) {
    if (!g_file_test (icon_files[c], G_FILE_TEST_EXISTS)) {
      g_print ("Icon file doesn't exist, are you sure you have "
          " installed snappy correctly?\nThis file needed is: %s\n",
          icon_files[c]);
    }
  }

  // Controls layout management
  controls_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FIXED,
      CLUTTER_BIN_ALIGNMENT_FIXED);
  ui->control_box = clutter_box_new (controls_layout);

  // Controls background
  ui->control_bg = clutter_texture_new_from_file (vid_panel_png, &error);
  if (!ui->control_bg && error)
    g_debug ("Clutter error: %s\n", error->message);
  if (error) {
    g_error_free (error);
    error = NULL;
  }

  g_free (vid_panel_png);
  clutter_container_add_actor (CLUTTER_CONTAINER (ui->control_box),
      ui->control_bg);

  // Controls play toggle
  main_box_layout = clutter_box_layout_new ();
  clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (main_box_layout), FALSE);
  ui->main_box = clutter_box_new (main_box_layout);

  ui->control_play_toggle =
      clutter_texture_new_from_file (ui->pause_png, &error);
  if (!ui->control_play_toggle && error)
    g_debug ("Clutter error: %s\n", error->message);
  if (error) {
    g_error_free (error);
    error = NULL;
  }

  clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (main_box_layout),
      ui->control_play_toggle,
      FALSE,                            /* expand */
      FALSE,                            /* x-fill */
      FALSE,                            /* y-fill */
      CLUTTER_BOX_ALIGNMENT_START,      /* x-align */
      CLUTTER_BOX_ALIGNMENT_CENTER);    /* y-align */
  clutter_container_add_actor (CLUTTER_CONTAINER (ui->control_box),
      ui->main_box);
  g_assert (ui->control_bg && ui->control_play_toggle);

  // Controls title
  info_box_layout = clutter_box_layout_new ();
  clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (info_box_layout), TRUE);

  ui->info_box = clutter_box_new (info_box_layout);

  ui->control_title = clutter_text_new_full ("Sans 32px",
      cut_long_filename (ui->filename, ui->title_length), &control_color1);
  clutter_text_set_max_length (CLUTTER_TEXT (ui->control_title),
      ui->title_length);
  clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (info_box_layout),
      ui->control_title,
      TRUE,                             /* expand */
      FALSE,                            /* x-fill */
      FALSE,                            /* y-fill */
      CLUTTER_BOX_ALIGNMENT_CENTER,     /* x-align */
      CLUTTER_BOX_ALIGNMENT_START);     /* y-align */

  // Controls seek
  seek_box_layout = clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FIXED,
      CLUTTER_BIN_ALIGNMENT_FIXED);
  seek_box = clutter_box_new (seek_box_layout);

  // In point
  ui->in_point = clutter_texture_new_from_file (ui->segment_png, &error);
  if (!ui->in_point && error)
    g_debug ("Clutter error: %s\n", error->message);
  if (error) {
    g_error_free (error);
    error = NULL;
  }
  clutter_container_add_actor (CLUTTER_CONTAINER (seek_box), ui->in_point);

  // background box rectangle shows as the border
  ui->control_seek1 = clutter_rectangle_new_with_color (&control_color1);
  clutter_container_add_actor (CLUTTER_CONTAINER (seek_box), ui->control_seek1);

  // smaller background rectangle inside seek1 to create a border
  ui->control_seek2 = clutter_rectangle_new_with_color (&control_color2);
  clutter_container_add_actor (CLUTTER_CONTAINER (seek_box), ui->control_seek2);

  // progress rectangle
  ui->control_seekbar = clutter_rectangle_new_with_color (&control_color1);
  clutter_container_add_actor (CLUTTER_CONTAINER (seek_box),
      ui->control_seekbar);

  clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (info_box_layout), seek_box,
      TRUE,                             /* expand */
      FALSE,                            /* x-fill */
      FALSE,                            /* y-fill */
      CLUTTER_BOX_ALIGNMENT_CENTER,     /* x-align */
      CLUTTER_BOX_ALIGNMENT_CENTER);    /* y-align */

  // Out point
  ui->out_point = clutter_texture_new_from_file (ui->segment_png, &error);
  if (!ui->out_point && error)
    g_debug ("Clutter error: %s\n", error->message);
  if (error) {
    g_error_free (error);
    error = NULL;
  }
  clutter_container_add_actor (CLUTTER_CONTAINER (seek_box), ui->out_point);

  // Controls bottom box
  bottom_box_layout = clutter_box_layout_new ();
  clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (bottom_box_layout),
      FALSE);
  bottom_box = clutter_box_new (bottom_box_layout);

  // Controls volume box
  volume_box_layout = clutter_box_layout_new ();
  clutter_box_layout_set_vertical (CLUTTER_BOX_LAYOUT (volume_box_layout),
      FALSE);
  clutter_box_layout_set_spacing (CLUTTER_BOX_LAYOUT (volume_box_layout), 0);
  ui->volume_box = clutter_box_new (volume_box_layout);

  clutter_box_pack (CLUTTER_BOX (bottom_box), ui->volume_box,
      "x-align", CLUTTER_BOX_ALIGNMENT_START, "expand", TRUE, NULL);

  // Controls volume low
  ui->volume_low = clutter_texture_new_from_file (ui->volume_low_png, &error);
  if (!ui->volume_low && error)
    g_debug ("Clutter error: %s\n", error->message);
  if (error) {
    g_error_free (error);
    error = NULL;
  }
  clutter_box_pack (CLUTTER_BOX (ui->volume_box), ui->volume_low, "x-align",
      CLUTTER_BOX_ALIGNMENT_START, NULL);

  // Controls volume intensity
  vol_int_box_layout =
      clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FIXED,
      CLUTTER_BIN_ALIGNMENT_FIXED);
  vol_int_box = clutter_box_new (vol_int_box_layout);

  ui->vol_int_bg = clutter_rectangle_new_with_color (&control_color1);
  clutter_container_add_actor (CLUTTER_CONTAINER (vol_int_box), ui->vol_int_bg);

  ui->vol_int = clutter_rectangle_new_with_color (&control_color1);
  clutter_container_add_actor (CLUTTER_CONTAINER (vol_int_box), ui->vol_int);

  clutter_box_pack (CLUTTER_BOX (ui->volume_box), vol_int_box,
      "x-fill", FALSE,
      "y-fill", FALSE, "y-align", CLUTTER_BOX_ALIGNMENT_CENTER, NULL);

  // Controls volume high
  ui->volume_high = clutter_texture_new_from_file (ui->volume_high_png, &error);
  if (!ui->volume_high && error)
    g_debug ("Clutter error: %s\n", error->message);
  if (error) {
    g_error_free (error);
    error = NULL;
  }
  clutter_box_pack (CLUTTER_BOX (ui->volume_box), ui->volume_high, "x-align",
      CLUTTER_BOX_ALIGNMENT_END, NULL);

  // Controls position text
  duration_str = g_strdup_printf ("   0:00:00/%s", ui->duration_str);
  ui->control_pos = clutter_text_new_full ("Sans 22px", duration_str,
      &control_color1);
  clutter_box_pack (CLUTTER_BOX (bottom_box), ui->control_pos,
      "x-align", CLUTTER_BOX_ALIGNMENT_END, "expand", TRUE, NULL);

  clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (info_box_layout), bottom_box,
      TRUE,                             /* expand */
      FALSE,                            /* x-fill */
      FALSE,                            /* y-fill */
      CLUTTER_BOX_ALIGNMENT_CENTER,     /* x-align */
      CLUTTER_BOX_ALIGNMENT_END);       /* y-align */

  clutter_box_layout_pack (CLUTTER_BOX_LAYOUT (main_box_layout), ui->info_box,
      FALSE,                            /* expand */
      TRUE,                             /* x-fill */
      FALSE,                            /* y-fill */
      CLUTTER_BOX_ALIGNMENT_END,        /* x-align */
      CLUTTER_BOX_ALIGNMENT_CENTER);    /* y-align */

  clutter_actor_lower_bottom (ui->control_bg);

  size_change (CLUTTER_STAGE (ui->stage), ui);
}
示例#7
0
/**
 * \brief The size has been changed.
 * \param event The event that occured.
 */
void bf::snapshot_frame::on_size_change( spin_event<double>& WXUNUSED(event) )
{
  size_change();
} // snapshot_frame::on_size_change()
示例#8
0
void start_curses( void )
{
  int keypad_on = 0;
  if ( isatty( fileno( stdout ) ) && LYReopenInput( ) < 0 )
  {
    fwrite( "Cannot open tty input\n", 1, 22, stderr );
    exit_immediately( 1 );
  }
  if ( LYscreen == 0 )
  {
    BOOLEAN savesize = recent_sizechange;
    size_change( 0 );
    recent_sizechange = savesize;
    if ( WWW_TraceFlag )
    {
      fprintf( TraceFP( ), "Screen size: %s()\n", "initscr" );
    }
    LYscreen = initscr( );
    if ( LYscreen == 0 )
    {
      fprintf( TraceFP( ), "%s\n", gettext( "Terminal initialisation failed - unknown terminal type?" ) );
      exit_immediately( 1 );
    }
    lynx_called_initscr = 1;
    LYlines = LYscreenHeight( );
    LYcols = LYscreenWidth( );
    size_change( 0 );
    recent_sizechange = 0;
    if ( WWW_TraceFlag )
    {
      fprintf( TraceFP( ), "Screen size is now %d x %d\n", LYlines, LYcols );
    }
    if ( LYuseCursesPads )
    {
      LYwin = newpad( LYlines, 1014 );
      LYshiftWin = 0;
      LYwideLines = 0;
    }
    else
      LYwin = stdscr;
    keypad( LYwin, 1 );
    keypad_on = 1;
    if ( lynx_initialize_keymaps( ) == -1 )
    {
      endwin( );
      exit_immediately( 1 );
    }
    if ( has_colors( ) & 255 )
    {
      lynx_has_color = 1;
      start_color( );
      if ( COLORS > 16 )
        COLORS = 16;
      if ( COLORS <= 7 )
        COLORS = 2;
      if ( COLORS > 8 && COLORS != 16 )
        COLORS = 8;
      if ( LYuse_default_colors )
      {
        if ( assume_default_colors( default_fg, default_bg ) )
        {
          default_fg = 7;
          default_bg = 0;
        }
        if ( WWW_TraceFlag )
        {
          fprintf( TraceFP( ), "initializing default colors %d/%d\n", default_fg, default_bg );
        }
        if ( default_fg >= 0 || default_bg >= 0 )
        {
          unsigned int n = 0;
          for ( ; n <= 7; n++ )
          {
            if ( default_fg >= 0 && lynx_color_cfg[ n ].fg < 0 )
              lynx_color_cfg[ n ].fg = default_fg;
            if ( default_bg >= 0 && lynx_color_cfg[ n ].bg < 0 )
              lynx_color_cfg[ n ].bg = default_bg;
            if ( WWW_TraceFlag )
            {
              fprintf( TraceFP( ), "color_cfg[%u] = %d/%d\n", n, lynx_color_cfg[ n ].fg, lynx_color_cfg[ n ].bg );
            }
            // n++;
          }
          lynx_setup_colors( );
        }
      }
    }
    if ( lynx_lss_file && lynx_lss_file[0] && ( LYCanReadFile( lynx_lss_file ) & 255 ) )
      style_readFromFile( lynx_lss_file );
    parse_userstyles( );
    lynx_init_colors( );
  }
  cbreak( );
  signal( 2, &cleanup_sig );
  noecho( );
  if ( keypad_on == 0 )
    keypad( LYwin, 1 );
  lynx_enable_mouse( 1 );
  fflush( stdin );
  fflush( stdout );
  fflush( stderr );
  LYCursesON = 1;
  if ( WWW_TraceFlag )
  {
    fprintf( TraceFP( ), "start_curses: done.\n" );
  }
  return;
}