~walkerlee/totem/pre-interview

« back to all changes in this revision

Viewing changes to src/totem-fullscreen.c

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-05-26 00:07:51 UTC
  • mfrom: (1.6.1) (24.1.4 experimental)
  • Revision ID: package-import@ubuntu.com-20130526000751-kv8ap3x1di4qq8j2
Tags: 3.8.2-0ubuntu1
* Sync with Debian. Remaining changes: 
* debian/control.in:
  - Drop build-depends on libepc-ui-dev and libgrilo-0.2-dev (in universe)
  - Drop libxtst-dev build-depends so that the (redundant) fake key presses
    for inhibiting the screensaver are disabled (LP: #1007438)
  - Build-depend on libzeitgeist-dev
  - Suggest rather than recommend gstreamer components in universe
  - Add totem-plugins-extra
  - Add XB-Npp-Description and XB-Npp-Filename header to the 
    totem-mozilla package to improve ubufox/ubuntu plugin db integration 
  - Refer to Firefox in totem-mozilla description instead of Iceweasel
  - Don't have totem-mozilla recommend any particular browser
  - Drop obsolete python library dependencies since iplayer is no longer
    included
* debian/totem-common.install, debian/source_totem.py:
  - Install Ubuntu apport debugging hook
* debian/totem-plugins-extra.install:
  - Universe plugins split out of totem-plugins (currently only gromit)
* debian/totem-plugins.install:    
  - Skip the plugins split to -extra and add the zeitgeist plugin
* debian/rules:
  - Build with --fail-missing, to ensure we install everything. 
    + Ignore libtotem.{,l}a since we delibrately don't install these.
  - Re-enable hardening, make sure both PIE and BINDNOW are used
    by setting hardening=+all. (LP: #1039604)
* debian/patches/91_quicklist_entries.patch:
  - Add static quicklist
* debian/patches/92_gst-plugins-good.patch:
  - Build without unnecessary gstreamer1.0-bad dependency
* debian/patches/93_grilo_optional.patch:
  - Allow building without grilo while grilo MIR is still pending
* debian/patches/correct_desktop_mimetypes.patch:
  - Don't list the mimetypes after the unity lists
* debian/patches/revert_shell_menu.patch: 
  - revert the use of a shell menu until indicator-appmenu can handle
    the mixed shell/traditional menus itself
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include "totem-interface.h"
37
37
#include "totem-time-label.h"
38
38
#include "bacon-video-widget.h"
39
 
#include "gsd-media-keys-window.h"
 
39
#include "gd-fullscreen-filter.h"
40
40
 
41
41
#define FULLSCREEN_POPUP_TIMEOUT 5
42
42
#define FULLSCREEN_MOTION_TIME 200 /* in milliseconds */
51
51
G_MODULE_EXPORT gboolean totem_fullscreen_vol_slider_released_cb (GtkWidget *widget, GdkEventButton *event, TotemFullscreen *fs);
52
52
G_MODULE_EXPORT gboolean totem_fullscreen_seek_slider_pressed_cb (GtkWidget *widget, GdkEventButton *event, TotemFullscreen *fs);
53
53
G_MODULE_EXPORT gboolean totem_fullscreen_seek_slider_released_cb (GtkWidget *widget, GdkEventButton *event, TotemFullscreen *fs);
54
 
G_MODULE_EXPORT gboolean totem_fullscreen_motion_notify (GtkWidget *widget, GdkEventMotion *event, TotemFullscreen *fs);
55
54
G_MODULE_EXPORT gboolean totem_fullscreen_control_enter_notify (GtkWidget *widget, GdkEventCrossing *event, TotemFullscreen *fs);
56
55
G_MODULE_EXPORT gboolean totem_fullscreen_control_leave_notify (GtkWidget *widget, GdkEventCrossing *event, TotemFullscreen *fs);
57
56
 
59
58
struct _TotemFullscreenPrivate {
60
59
        BaconVideoWidget *bvw;
61
60
        GtkWidget        *parent_window;
62
 
        GtkWidget        *osd;
63
61
 
64
62
        /* Fullscreen Popups */
65
63
        GtkWidget        *exit_popup;
71
69
        guint             popup_timeout;
72
70
        gboolean          popup_in_progress;
73
71
        gboolean          pointer_on_control;
74
 
        guint             motion_handler_id;
75
 
        guint             motion_start_time;
76
 
        guint             motion_num_events;
 
72
        GdFullscreenFilter *filter;
 
73
        gint64             motion_start_time;
 
74
        guint              motion_num_events;
77
75
 
78
76
        gboolean          is_fullscreen;
79
77
 
275
273
        return FALSE;
276
274
}
277
275
 
278
 
G_MODULE_EXPORT gboolean
279
 
totem_fullscreen_motion_notify (GtkWidget *widget,
280
 
                                GdkEventMotion *event,
281
 
                                TotemFullscreen *fs)
 
276
static void
 
277
totem_fullscreen_motion_notify (GdFullscreenFilter *filter,
 
278
                                TotemFullscreen    *fs)
282
279
{
283
 
        int motion_delay;
 
280
        gint64 motion_delay;
 
281
        gint64 curr;
284
282
 
 
283
        curr = g_get_monotonic_time ();
285
284
        /* Only after FULLSCREEN_MOTION_NUM_EVENTS motion events,
286
285
           in FULLSCREEN_MOTION_TIME milliseconds will we show
287
286
           the popups */
288
 
        motion_delay = event->time - fs->priv->motion_start_time;
 
287
        motion_delay = (curr - fs->priv->motion_start_time) / 1000;
289
288
 
290
289
        if (fs->priv->motion_start_time == 0 ||
291
290
            motion_delay < 0 ||
292
291
            motion_delay > FULLSCREEN_MOTION_TIME) {
293
 
                fs->priv->motion_start_time = event->time;
 
292
                fs->priv->motion_start_time = curr;
294
293
                fs->priv->motion_num_events = 0;
295
 
                return FALSE;
 
294
                return;
296
295
        }
297
296
 
298
297
        fs->priv->motion_num_events++;
301
300
            fs->priv->motion_num_events > FULLSCREEN_MOTION_NUM_EVENTS) {
302
301
                totem_fullscreen_show_popups (fs, TRUE);
303
302
        }
304
 
 
305
 
        return FALSE;
306
303
}
307
304
 
308
305
void
349
346
                                     const char *icon_name,
350
347
                                     gboolean show_cursor)
351
348
{
352
 
        GtkAllocation allocation;
353
 
        GdkScreen *screen;
354
 
        GdkWindow *window;
355
 
        GdkRectangle rect;
356
 
        int monitor;
357
 
 
358
349
        if (icon_name == NULL) {
359
350
                totem_fullscreen_show_popups (fs, show_cursor);
360
351
                return;
361
352
        }
362
353
 
363
 
        gtk_widget_get_allocation (GTK_WIDGET (fs->priv->bvw), &allocation);
364
 
        gtk_window_resize (GTK_WINDOW (fs->priv->osd),
365
 
                           allocation.height / 8,
366
 
                           allocation.height / 8);
367
 
 
368
 
        window = gtk_widget_get_window (GTK_WIDGET (fs->priv->bvw));
369
 
        screen = gtk_widget_get_screen (GTK_WIDGET (fs->priv->bvw));
370
 
        monitor = gdk_screen_get_monitor_at_window (screen, window);
371
 
        gdk_screen_get_monitor_geometry (screen, monitor, &rect);
372
 
 
373
 
        if (gtk_widget_get_direction (GTK_WIDGET (fs->priv->bvw)) == GTK_TEXT_DIR_RTL)
374
 
                gtk_window_move (GTK_WINDOW (fs->priv->osd),
375
 
                                 rect.width - 8 - allocation.height / 8,
376
 
                                 rect.y + 8);
377
 
        else
378
 
                gtk_window_move (GTK_WINDOW (fs->priv->osd), rect.x + 8, rect.y + 8);
379
 
 
380
 
        gsd_media_keys_window_set_action_custom (GSD_MEDIA_KEYS_WINDOW (fs->priv->osd),
381
 
                                                 icon_name, FALSE);
382
 
        gtk_widget_show (fs->priv->osd);
 
354
        bacon_video_widget_popup_osd (fs->priv->bvw, icon_name);
383
355
}
384
356
 
385
357
G_MODULE_EXPORT gboolean
411
383
 
412
384
        bacon_video_widget_set_fullscreen (fs->priv->bvw, fullscreen);
413
385
        totem_fullscreen_set_cursor (fs, !fullscreen);
 
386
 
 
387
        fs->priv->is_fullscreen = fullscreen;
 
388
 
414
389
        if (fullscreen == FALSE)
415
 
                gtk_widget_hide (fs->priv->osd);
416
 
 
417
 
        fs->priv->is_fullscreen = fullscreen;
418
 
 
419
 
        if (fullscreen == FALSE && fs->priv->motion_handler_id != 0) {
420
 
                g_signal_handler_disconnect (G_OBJECT (fs->priv->bvw),
421
 
                                             fs->priv->motion_handler_id);
422
 
                fs->priv->motion_handler_id = 0;
423
 
        } else if (fullscreen != FALSE && fs->priv->motion_handler_id == 0 && fs->priv->bvw != NULL) {
424
 
                fs->priv->motion_handler_id = g_signal_connect (G_OBJECT (fs->priv->bvw), "motion-notify-event",
425
 
                                                                G_CALLBACK (totem_fullscreen_motion_notify), fs);
426
 
        }
 
390
                gd_fullscreen_filter_stop (fs->priv->filter);
 
391
        else
 
392
                gd_fullscreen_filter_start (fs->priv->filter);
427
393
}
428
394
 
429
395
static void
469
435
 
470
436
        /* Volume */
471
437
        fs->volume = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml, "tcw_volume_button"));
472
 
        
 
438
 
473
439
        /* Seek */
474
440
        fs->seek = GTK_WIDGET (gtk_builder_get_object (fs->priv->xml, "tcw_seek_hscale"));
475
441
 
476
442
        /* Motion notify */
 
443
        fs->priv->filter = gd_fullscreen_filter_new ();
 
444
        g_signal_connect (G_OBJECT (fs->priv->filter), "motion-event",
 
445
                          G_CALLBACK (totem_fullscreen_motion_notify), fs);
477
446
        gtk_widget_add_events (fs->seek, GDK_POINTER_MOTION_MASK);
478
447
        gtk_widget_add_events (fs->exit_button, GDK_POINTER_MOTION_MASK);
479
448
 
489
458
        g_return_if_fail (fs->priv->bvw == NULL);
490
459
 
491
460
        fs->priv->bvw = bvw;
492
 
 
493
 
        if (fs->priv->is_fullscreen != FALSE && fs->priv->motion_handler_id == 0) {
494
 
                fs->priv->motion_handler_id = g_signal_connect (G_OBJECT (fs->priv->bvw), "motion-notify-event",
495
 
                                                                G_CALLBACK (totem_fullscreen_motion_notify), fs);
496
 
        }
497
461
}
498
462
 
499
463
void
533
497
                          G_CALLBACK (totem_fullscreen_exit_popup_draw_cb), self);
534
498
        self->priv->control_popup = GTK_WIDGET (gtk_builder_get_object (self->priv->xml,
535
499
                                "totem_controls_window"));
536
 
        self->priv->osd = gsd_media_keys_window_new ();
537
500
 
538
501
        /* Motion notify */
539
502
        gtk_widget_add_events (self->priv->exit_popup, GDK_POINTER_MOTION_MASK);
561
524
        TotemFullscreen *fs = TOTEM_FULLSCREEN (object);
562
525
 
563
526
        totem_fullscreen_popup_timeout_remove (fs);
564
 
        if (fs->priv->motion_handler_id != 0) {
565
 
                g_signal_handler_disconnect (G_OBJECT (fs->priv->bvw),
566
 
                                             fs->priv->motion_handler_id);
567
 
                fs->priv->motion_handler_id = 0;
568
 
        }
569
 
 
570
 
        if (fs->priv->osd != NULL) {
571
 
                gtk_widget_destroy (fs->priv->osd);
572
 
                fs->priv->osd = NULL;
 
527
        if (fs->priv->filter) {
 
528
                g_object_unref (fs->priv->filter);
 
529
                fs->priv->filter = NULL;
573
530
        }
574
531
 
575
532
        g_signal_handlers_disconnect_by_func (fs->priv->parent_window,