~walkerlee/totem/pre-interview

« back to all changes in this revision

Viewing changes to src/gd-fullscreen-filter.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:
 
1
/*
 
2
 * Copyright (c) 2011 Red Hat, Inc.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by 
 
6
 * the Free Software Foundation; either version 2 of the License, or (at your
 
7
 * option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful, but
 
10
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 
11
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
 
12
 * License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public License 
 
15
 * along with this program; if not, write to the Free Software Foundation,
 
16
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
17
 *
 
18
 * Author: Cosimo Cecchi <cosimoc@redhat.com>
 
19
 *
 
20
 */
 
21
 
 
22
#include "gd-fullscreen-filter.h"
 
23
 
 
24
#include <gdk/gdk.h>
 
25
#include <gdk/gdkx.h>
 
26
 
 
27
#include <X11/extensions/XInput2.h>
 
28
 
 
29
G_DEFINE_TYPE (GdFullscreenFilter, gd_fullscreen_filter, G_TYPE_OBJECT)
 
30
 
 
31
enum {
 
32
  MOTION_EVENT = 1,
 
33
  NUM_SIGNALS
 
34
};
 
35
 
 
36
static guint signals[NUM_SIGNALS] = { 0, };
 
37
 
 
38
struct _GdFullscreenFilterPrivate {
 
39
  gboolean is_filtering;
 
40
};
 
41
 
 
42
static void
 
43
gd_fullscreen_filter_dispose (GObject *object)
 
44
{
 
45
  GdFullscreenFilter *self = GD_FULLSCREEN_FILTER (object);
 
46
 
 
47
  gd_fullscreen_filter_stop (self);
 
48
 
 
49
  G_OBJECT_CLASS (gd_fullscreen_filter_parent_class)->dispose (object);
 
50
}
 
51
 
 
52
static void
 
53
gd_fullscreen_filter_init (GdFullscreenFilter *self)
 
54
{
 
55
  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GD_TYPE_FULLSCREEN_FILTER,
 
56
                                            GdFullscreenFilterPrivate);
 
57
}
 
58
 
 
59
static void
 
60
gd_fullscreen_filter_class_init (GdFullscreenFilterClass *klass)
 
61
{
 
62
  GObjectClass *oclass = G_OBJECT_CLASS (klass);
 
63
 
 
64
  oclass->dispose = gd_fullscreen_filter_dispose;
 
65
 
 
66
  signals[MOTION_EVENT] =
 
67
    g_signal_new ("motion-event",
 
68
                  GD_TYPE_FULLSCREEN_FILTER,
 
69
                  G_SIGNAL_RUN_LAST,
 
70
                  0, NULL, NULL, NULL,
 
71
                  G_TYPE_NONE, 0);
 
72
 
 
73
  g_type_class_add_private (klass, sizeof (GdFullscreenFilterPrivate));
 
74
}
 
75
 
 
76
static GdkFilterReturn
 
77
event_filter_func (GdkXEvent *gdk_xevent,
 
78
                   GdkEvent *event,
 
79
                   gpointer user_data)
 
80
{
 
81
  GdFullscreenFilter *self = user_data;
 
82
  XEvent *xevent = (XEvent *) gdk_xevent;
 
83
 
 
84
  if (xevent->xany.type == ButtonPress ||
 
85
      xevent->xany.type == ButtonRelease ||
 
86
      xevent->xany.type == MotionNotify)
 
87
    {
 
88
      g_signal_emit (self, signals[MOTION_EVENT], 0);
 
89
    }
 
90
  else if (xevent->xany.type == GenericEvent)
 
91
    {
 
92
        /* we just assume this is an XI2 event */
 
93
        XIEvent *ev = (XIEvent *) xevent->xcookie.data;
 
94
 
 
95
        if (ev->evtype == XI_Motion ||
 
96
            ev->evtype == XI_ButtonRelease ||
 
97
            ev->evtype == XI_ButtonPress)
 
98
          {
 
99
            g_signal_emit (self, signals[MOTION_EVENT], 0);
 
100
          }
 
101
    }
 
102
 
 
103
  return GDK_FILTER_CONTINUE;
 
104
}
 
105
 
 
106
void
 
107
gd_fullscreen_filter_start (GdFullscreenFilter *self)
 
108
{
 
109
  if (self->priv->is_filtering)
 
110
    return;
 
111
 
 
112
  self->priv->is_filtering = TRUE;
 
113
  gdk_window_add_filter (NULL,
 
114
                         event_filter_func, self);
 
115
}
 
116
 
 
117
void
 
118
gd_fullscreen_filter_stop (GdFullscreenFilter *self)
 
119
{
 
120
  if (!self->priv->is_filtering)
 
121
    return;
 
122
 
 
123
  self->priv->is_filtering = FALSE;
 
124
  gdk_window_remove_filter (NULL,
 
125
                            event_filter_func, self);
 
126
}
 
127
 
 
128
GdFullscreenFilter *
 
129
gd_fullscreen_filter_new (void)
 
130
{
 
131
  return g_object_new (GD_TYPE_FULLSCREEN_FILTER, NULL);
 
132
}