Merge lp:~abreu-alexandre/unity-chromium-extension/12.10.fix-1138473 into lp:unity-chromium-extension/12.10

Proposed by Alexandre Abreu
Status: Merged
Approved by: Alexandre Abreu
Approved revision: 207
Merged at revision: 207
Proposed branch: lp:~abreu-alexandre/unity-chromium-extension/12.10.fix-1138473
Merge into: lp:unity-chromium-extension/12.10
Diff against target: 183 lines (+132/-2)
5 files modified
configure.ac (+1/-1)
npapi-plugin/src/Makefile.am (+2/-0)
npapi-plugin/src/unity-npapi-tools.c (+97/-0)
npapi-plugin/src/unity-npapi-tools.h (+30/-0)
npapi-plugin/src/unity-webapps-binding.c (+2/-1)
To merge this branch: bzr merge lp:~abreu-alexandre/unity-chromium-extension/12.10.fix-1138473
Reviewer Review Type Date Requested Status
Alexandre Abreu (community) Approve
Review via email: mp+152293@code.launchpad.net

Commit message

Fix #1138473: update the chromium side following the removal of the xid function from libunity-webapps

Description of the change

Fix #1138473: update the chromium side following the removal of the xid function from libunity-webapps

To post a comment you must log in.
207. By Alexandre Abreu

Fix #1138473: update the chromium side following the removal of the xid function from libunity-webapps - forgot files

Revision history for this message
Alexandre Abreu (abreu-alexandre) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'configure.ac'
--- configure.ac 2012-11-14 20:09:35 +0000
+++ configure.ac 2013-03-07 22:12:24 +0000
@@ -14,7 +14,7 @@
14AC_DISABLE_STATIC14AC_DISABLE_STATIC
15LT_INIT15LT_INIT
1616
17PKG_CHECK_MODULES(UNITY_NPAPI_PLUGIN, [libunity_webapps-0.2 glib-2.0 libnotify libunity-webapps-repository])17PKG_CHECK_MODULES(UNITY_NPAPI_PLUGIN, [libunity_webapps-0.2 glib-2.0 libnotify libunity-webapps-repository libwnck-1.0])
1818
1919
20dnl ***************************************************************************20dnl ***************************************************************************
2121
=== modified file 'npapi-plugin/src/Makefile.am'
--- npapi-plugin/src/Makefile.am 2012-09-07 17:42:51 +0000
+++ npapi-plugin/src/Makefile.am 2013-03-07 22:12:24 +0000
@@ -50,6 +50,8 @@
50 unity-npapi-binding-utils.c \50 unity-npapi-binding-utils.c \
51 unity-npapi-binding-utils.h \51 unity-npapi-binding-utils.h \
52 unity-npapi-common.h \52 unity-npapi-common.h \
53 unity-npapi-tools.c \
54 unity-npapi-tools.h \
53 unity-npapi-debug.h55 unity-npapi-debug.h
5456
55libunity_npapi_plugin_la_LDFLAGS = $(UNITY_NPAPI_PLUGIN_COVERAGE_LDFLAGS)57libunity_npapi_plugin_la_LDFLAGS = $(UNITY_NPAPI_PLUGIN_COVERAGE_LDFLAGS)
5658
=== added file 'npapi-plugin/src/unity-npapi-tools.c'
--- npapi-plugin/src/unity-npapi-tools.c 1970-01-01 00:00:00 +0000
+++ npapi-plugin/src/unity-npapi-tools.c 2013-03-07 22:12:24 +0000
@@ -0,0 +1,97 @@
1/*
2 * unity-npapi-tools.c
3 * Copyright (C) Canonical LTD 2013
4 *
5 * Author: Alexandre Abreu <alexandre.abreu@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20#include <glib.h>
21#include <string.h>
22
23#define WNCK_I_KNOW_THIS_IS_UNSTABLE
24#include <libwnck/libwnck.h>
25#include <gtk/gtk.h>
26#include <gdk/gdkx.h>
27
28#include <unity-webapps-context.h>
29
30#include "unity-npapi-tools.h"
31
32
33void
34unity_npapi_tools_set_xid_for_browser_window_id(UnityWebappsContext *context,
35 int window_id)
36{
37 const gchar * const
38 CHROMIUM_LINUX_SESSION_ID_PROPERTY = "CHROMIUM_LINUX_SESSION_ID_PROPERTY";
39
40 WnckScreen *screen;
41 GList *windows, *walk;
42
43 // idempotent
44 gtk_init(NULL, NULL);
45
46 screen = wnck_screen_get_default();
47
48 // TODO find a way to get it from the WnckScreen?
49 GdkDisplay* display = gdk_display_get_default();
50
51 wnck_screen_force_update (screen);
52
53 windows = wnck_screen_get_windows_stacked (screen);
54
55 for (walk = windows; walk != NULL; walk = walk->next)
56 {
57 WnckWindow *window = WNCK_WINDOW (walk->data);
58
59 GdkWindow *active_window =
60 gdk_x11_window_foreign_new_for_display (display,
61 wnck_window_get_xid(window));
62 if (NULL == active_window)
63 {
64 g_message ("Could not retrieve GdkWindow for xid %ld",
65 wnck_window_get_xid(window));
66 continue;
67 }
68
69 GdkAtom atom;
70 gint format = 0;
71 gint out_length = 0;
72 gint * session_id = NULL;
73 gboolean have_prop =
74 gdk_property_get (active_window,
75 gdk_atom_intern(CHROMIUM_LINUX_SESSION_ID_PROPERTY,
76 FALSE),
77 gdk_atom_intern("CARDINAL", FALSE),
78 0L,
79 4,
80 FALSE,
81 &atom,
82 &format,
83 &out_length,
84 (guchar **)&session_id);
85 if (TRUE == have_prop &&
86 NULL != session_id &&
87 window_id == session_id[0])
88 {
89 unity_webapps_context_set_view_window (context,
90 (guint64) wnck_window_get_xid (window));
91
92 g_free (session_id);
93 break;
94 }
95 }
96}
97
098
=== added file 'npapi-plugin/src/unity-npapi-tools.h'
--- npapi-plugin/src/unity-npapi-tools.h 1970-01-01 00:00:00 +0000
+++ npapi-plugin/src/unity-npapi-tools.h 2013-03-07 22:12:24 +0000
@@ -0,0 +1,30 @@
1/*
2 * unity-npapi-tools.h
3 * Copyright (C) Canonical LTD 2013
4 *
5 * Author: Alexandre Abreu <alexandre.abreu@canonical.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#if ! defined (UNITY_NPAPI_TOOLS_H)
22#define UNITY_NPAPI_TOOLS_H
23
24typedef struct _UnityWebappsContext UnityWebappsContext;
25
26void
27unity_npapi_tools_set_xid_for_browser_window_id(UnityWebappsContext *context,
28 int window_id);
29
30#endif // UNITY_NPAPI_TOOLS_H
031
=== modified file 'npapi-plugin/src/unity-webapps-binding.c'
--- npapi-plugin/src/unity-webapps-binding.c 2012-09-12 16:22:59 +0000
+++ npapi-plugin/src/unity-webapps-binding.c 2013-03-07 22:12:24 +0000
@@ -39,6 +39,7 @@
39#include "unity-npapi-binding-utils.h"39#include "unity-npapi-binding-utils.h"
40#include "unity-webapps-scriptable-object.h"40#include "unity-webapps-scriptable-object.h"
41#include "unity-npapi-plugin.h"41#include "unity-npapi-plugin.h"
42#include "unity-npapi-tools.h"
4243
43NPVariant44NPVariant
44unity_webapps_binding_service_new (NPP instance45unity_webapps_binding_service_new (NPP instance
@@ -2849,7 +2850,7 @@
2849 2850
2850 REACHED_UNITY_WEBAPPS_FUNC_CALL();2851 REACHED_UNITY_WEBAPPS_FUNC_CALL();
28512852
2852 unity_webapps_service_set_xid_for_browser_window_id (service, context, window_id);2853 unity_npapi_tools_set_xid_for_browser_window_id (context, window_id);
28532854
2854 return result;2855 return result;
2855}2856}

Subscribers

People subscribed via source and target branches

to all changes: