* [screenshot][PATCH 0/1] Support Gtk+3
@ 2016-04-29 7:06 Jussi Kukkonen
2016-04-29 7:06 ` [screenshot][PATCH 1/1] Quick port to Gtk/Gdk 3 Jussi Kukkonen
0 siblings, 1 reply; 5+ messages in thread
From: Jussi Kukkonen @ 2016-04-29 7:06 UTC (permalink / raw)
To: yocto
This patch is part of the quest to make Sato compatible with GTK+3.
Complete WIP collection of patches can be found in jku/matchbox-wip
branch at git://git.yoctoproject.org/poky-contrib
The following changes since commit 3a9688e8a01b63a78f402b4e7c0b8b005fcdfa29:
build: change link ordering to fix link problems (2013-06-17 16:58:49 +0100)
are available in the git repository at:
git://github.com/jku/sato-screenshot gtk3
https://github.com/jku/sato-screenshot/tree/gtk3
Jussi Kukkonen (1):
Quick port to Gtk/Gdk 3
configure.ac | 2 +-
screenshot-utils.c | 77 +++++++++++++++++++++++++++++-------------------------
2 files changed, 43 insertions(+), 36 deletions(-)
--
2.8.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [screenshot][PATCH 1/1] Quick port to Gtk/Gdk 3
2016-04-29 7:06 [screenshot][PATCH 0/1] Support Gtk+3 Jussi Kukkonen
@ 2016-04-29 7:06 ` Jussi Kukkonen
2016-04-29 15:46 ` Burton, Ross
0 siblings, 1 reply; 5+ messages in thread
From: Jussi Kukkonen @ 2016-04-29 7:06 UTC (permalink / raw)
To: yocto
This still has all the problems that the new API would allow us to
fix: mainly that multiple displays will almost certainly not work
at all.
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
configure.ac | 2 +-
screenshot-utils.c | 77 +++++++++++++++++++++++++++++-------------------------
2 files changed, 43 insertions(+), 36 deletions(-)
diff --git a/configure.ac b/configure.ac
index 8f41392..ba6d6f2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@ AC_PROG_CC
AC_STDC_HEADERS
AC_PROG_LIBTOOL
-PKG_CHECK_MODULES(DEPS, x11 gdk-x11-2.0 gtk+-2.0)
+PKG_CHECK_MODULES(DEPS, x11 gdk-x11-3.0 gtk+-3.0)
MB_APPLET="yes"
diff --git a/screenshot-utils.c b/screenshot-utils.c
index 2d9a168..3df4666 100644
--- a/screenshot-utils.c
+++ b/screenshot-utils.c
@@ -36,12 +36,12 @@ text_property_to_utf8 (const XTextProperty *prop)
list = NULL;
- count = gdk_text_property_to_utf8_list (gdk_x11_xatom_to_atom (prop->encoding),
- prop->format,
- prop->value,
- prop->nitems,
- &list);
-
+ count = gdk_text_property_to_utf8_list_for_display (gdk_display_get_default (),
+ gdk_x11_xatom_to_atom (prop->encoding),
+ prop->format,
+ prop->value,
+ prop->nitems,
+ &list);
if (count == 0)
return NULL;
@@ -69,7 +69,7 @@ get_window_property (Window xwindow,
gdk_error_trap_push ();
type = None;
- result = XGetWindowProperty (gdk_display,
+ result = XGetWindowProperty (gdk_x11_get_default_xdisplay (),
xwindow,
atom,
0, G_MAXLONG,
@@ -103,7 +103,7 @@ get_text_property (Window xwindow,
gdk_error_trap_push ();
text.nitems = 0;
- if (XGetTextProperty (gdk_display,
+ if (XGetTextProperty (gdk_x11_get_default_xdisplay (),
xwindow,
&text,
atom))
@@ -141,7 +141,7 @@ get_utf8_property (Window xwindow,
gdk_error_trap_push ();
type = None;
val = NULL;
- result = XGetWindowProperty (gdk_display,
+ result = XGetWindowProperty (gdk_x11_get_default_xdisplay (),
xwindow,
atom,
0, G_MAXLONG,
@@ -194,7 +194,7 @@ get_atom_property (Window xwindow,
gdk_error_trap_push ();
type = None;
- result = XGetWindowProperty (gdk_display,
+ result = XGetWindowProperty (gdk_x11_get_default_xdisplay (),
xwindow,
atom,
0, G_MAXLONG,
@@ -228,10 +228,11 @@ screenshot_grab_lock (void)
Atom selection_atom;
GdkCursor *cursor;
gboolean result = FALSE;
+ Display *display = gdk_x11_get_default_xdisplay ();
selection_atom = gdk_x11_get_xatom_by_name (SELECTION_NAME);
- XGrabServer (GDK_DISPLAY ());
- if (XGetSelectionOwner (GDK_DISPLAY(), selection_atom) != None)
+ XGrabServer (display);
+ if (XGetSelectionOwner (display, selection_atom) != None)
goto out;
selection_window = gtk_invisible_new ();
@@ -246,15 +247,15 @@ screenshot_grab_lock (void)
goto out;
}
- cursor = gdk_cursor_new (GDK_WATCH);
- gdk_pointer_grab (selection_window->window, FALSE, 0, NULL,
+ cursor = gdk_cursor_new_for_display (gdk_display_get_default(), GDK_WATCH);
+ gdk_pointer_grab (gtk_widget_get_window (selection_window), FALSE, 0, NULL,
cursor, GDK_CURRENT_TIME);
gdk_cursor_unref (cursor);
result = TRUE;
out:
- XUngrabServer (GDK_DISPLAY ());
+ XUngrabServer (display);
gdk_flush ();
return result;
@@ -280,7 +281,7 @@ find_toplevel_window (Window xid)
do
{
- if (XQueryTree (GDK_DISPLAY (), xid, &root,
+ if (XQueryTree (gdk_x11_get_default_xdisplay (), xid, &root,
&parent, &children, &nchildren) == 0)
{
g_warning ("Couldn't find window manager window");
@@ -303,7 +304,8 @@ screenshot_find_active_window (void)
root_window = GDK_ROOT_WINDOW ();
- if (gdk_net_wm_supports (gdk_atom_intern ("_NET_ACTIVE_WINDOW", FALSE)))
+ if (gdk_x11_screen_supports_net_wm_hint (gdk_screen_get_default(),
+ gdk_atom_intern ("_NET_ACTIVE_WINDOW", FALSE)))
{
retval = get_window_property (root_window,
gdk_x11_get_xatom_by_name ("_NET_ACTIVE_WINDOW"));
@@ -320,7 +322,8 @@ screenshot_window_is_desktop (Window xid)
if (xid == root_window)
return TRUE;
- if (gdk_net_wm_supports (gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE)))
+ if (gdk_x11_screen_supports_net_wm_hint (gdk_screen_get_default(),
+ gdk_atom_intern ("_NET_WM_WINDOW_TYPE", FALSE)))
{
gboolean retval;
Atom property;
@@ -347,7 +350,7 @@ screenshot_find_pointer_window (void)
root_window = GDK_ROOT_WINDOW ();
- XQueryPointer (GDK_DISPLAY (), root_window,
+ XQueryPointer (gdk_x11_get_default_xdisplay (), root_window,
&root_return, &child, &unused,
&unused, &unused, &unused, &mask);
@@ -368,8 +371,9 @@ look_for_hint_helper (Window xid,
gulong *prop;
Window root, parent, *children, window;
unsigned int nchildren, i;
+ Display *display = gdk_x11_get_default_xdisplay ();
- if (XGetWindowProperty (GDK_DISPLAY (), xid, property, 0, 1,
+ if (XGetWindowProperty (display, xid, property, 0, 1,
False, AnyPropertyType, &actual_type,
&actual_format, &nitems, &bytes_after,
(gpointer) &prop) == Success
@@ -385,7 +389,7 @@ look_for_hint_helper (Window xid,
if (depth < MAXIMUM_WM_REPARENTING_DEPTH)
{
- if (XQueryTree (GDK_DISPLAY (), xid, &root,
+ if (XQueryTree (display, xid, &root,
&parent, &children, &nchildren) != 0)
{
window = None;
@@ -473,12 +477,13 @@ screenshot_get_pixbuf (Window w)
#endif
- window = gdk_window_foreign_new (w);
+ window = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), w);
if (window == NULL)
return NULL;
- root = gdk_window_foreign_new (GDK_ROOT_WINDOW ());
- gdk_drawable_get_size (window, &real_width, &real_height);
+ root = gdk_x11_window_foreign_new_for_display (gdk_display_get_default (), GDK_ROOT_WINDOW ());
+ real_height = gdk_window_get_height (window);
+ real_width = gdk_window_get_width (window);
gdk_window_get_origin (window, &x_real_orig, &y_real_orig);
x_orig = x_real_orig;
@@ -504,11 +509,11 @@ screenshot_get_pixbuf (Window w)
#ifdef HAVE_X11_EXTENSIONS_SHAPE_H
- tmp = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
- x_orig, y_orig, 0, 0,
- width, height);
+ tmp = gdk_pixbuf_get_from_window (root,
+ x_orig, y_orig,
+ width, height);
- rectangles = XShapeGetRectangles (GDK_DISPLAY (), GDK_WINDOW_XWINDOW (window),
+ rectangles = XShapeGetRectangles (gdk_x11_get_default_xdisplay (), GDK_WINDOW_XWINDOW (window),
ShapeBounding, &rectangle_count, &rectangle_order);
if (rectangle_count > 0)
{
@@ -578,9 +583,9 @@ screenshot_get_pixbuf (Window w)
screenshot = tmp;
}
#else /* HAVE_X11_EXTENSIONS_SHAPE_H */
- screenshot = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
- x_orig, y_orig, 0, 0,
- width, height);
+ screenshot = gdk_pixbuf_get_from_window (root,
+ x_orig, y_orig,
+ width, height);
#endif /* HAVE_X11_EXTENSIONS_SHAPE_H */
return screenshot;
@@ -634,10 +639,12 @@ screenshot_show_error_dialog (GtkWindow *parent,
if (detail)
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"%s", detail);
-
- if (parent && parent->group)
- gtk_window_group_add_window (parent->group, GTK_WINDOW (dialog));
-
+ if (parent) {
+ GtkWindowGroup *group = gtk_window_get_group (parent);
+ if (group)
+ gtk_window_group_add_window (group, GTK_WINDOW (dialog));
+ }
+
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [screenshot][PATCH 1/1] Quick port to Gtk/Gdk 3
2016-04-29 7:06 ` [screenshot][PATCH 1/1] Quick port to Gtk/Gdk 3 Jussi Kukkonen
@ 2016-04-29 15:46 ` Burton, Ross
2016-05-02 7:48 ` Jussi Kukkonen
0 siblings, 1 reply; 5+ messages in thread
From: Burton, Ross @ 2016-04-29 15:46 UTC (permalink / raw)
To: Jussi Kukkonen; +Cc: yocto
[-- Attachment #1: Type: text/plain, Size: 2250 bytes --]
On 29 April 2016 at 08:06, Jussi Kukkonen <jussi.kukkonen@intel.com> wrote:
> This still has all the problems that the new API would allow us to
> fix: mainly that multiple displays will almost certainly not work
> at all.
>
screenshot-utils.c: In function 'screenshot_grab_lock':
screenshot-utils.c:251:3: warning: 'gdk_pointer_grab' is deprecated: Use
'gdk_device_grab' instead [-Wdeprecated-declarations]
gdk_pointer_grab (gtk_widget_get_window (selection_window), FALSE, 0,
NULL,
^
In file included from /usr/include/gtk-3.0/gdk/gdk.h:47:0,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from screenshot-utils.h:4,
from screenshot-utils.c:2:
/usr/include/gtk-3.0/gdk/gdkmain.h:86:15: note: declared here
GdkGrabStatus gdk_pointer_grab (GdkWindow *window,
^
screenshot-utils.c:253:3: warning: 'gdk_cursor_unref' is deprecated: Use
'g_object_unref' instead [-Wdeprecated-declarations]
gdk_cursor_unref (cursor);
^
In file included from /usr/include/gtk-3.0/gdk/gdk.h:34:0,
from /usr/include/gtk-3.0/gtk/gtk.h:30,
from screenshot-utils.h:4,
from screenshot-utils.c:2:
/usr/include/gtk-3.0/gdk/gdkcursor.h:247:13: note: declared here
void gdk_cursor_unref (GdkCursor *cursor);
^
screenshot-utils.c: In function 'get_text_property':
screenshot-utils.c:121:3: warning: ignoring return value of
'gdk_error_trap_pop', declared with attribute warn_unused_result
[-Wunused-result]
gdk_error_trap_pop ();
^
CC screenshot-ui.lo
screenshot-ui.c: In function 'screenshot':
screenshot-ui.c:49:46: warning: 'GtkStock' is deprecated
[-Wdeprecated-declarations]
GTK_STOCK_CANCEL,
GTK_RESPONSE_REJECT,
^
screenshot-ui.c:50:46: warning: 'GtkStock' is deprecated
[-Wdeprecated-declarations]
GTK_STOCK_SAVE,
GTK_RESPONSE_ACCEPT,
^
The stock ones look easy to fix, the device ones less so so unless I'm
wrong we can leave those for now.
Ross
[-- Attachment #2: Type: text/html, Size: 3987 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [screenshot][PATCH 1/1] Quick port to Gtk/Gdk 3
2016-04-29 15:46 ` Burton, Ross
@ 2016-05-02 7:48 ` Jussi Kukkonen
2016-05-18 11:32 ` Burton, Ross
0 siblings, 1 reply; 5+ messages in thread
From: Jussi Kukkonen @ 2016-05-02 7:48 UTC (permalink / raw)
To: Burton, Ross; +Cc: yocto
On 29 April 2016 at 18:46, Burton, Ross <ross.burton@intel.com> wrote:
> The stock ones look easy to fix, the device ones less so so unless I'm wrong
> we can leave those for now.
The grab code was trickier with current API (which is why I left it as
is), but I took another look and it turns out that code has never
actually been used...
So I removed _grab_lock() and _release_lock(), and replaced STOCK
items with text.
I've added these changes to the same branch (should now compile
without warnings):
git://github.com/jku/sato-screenshot gtk3
https://github.com/jku/sato-screenshot/tree/gtk3
Jussi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [screenshot][PATCH 1/1] Quick port to Gtk/Gdk 3
2016-05-02 7:48 ` Jussi Kukkonen
@ 2016-05-18 11:32 ` Burton, Ross
0 siblings, 0 replies; 5+ messages in thread
From: Burton, Ross @ 2016-05-18 11:32 UTC (permalink / raw)
To: Jussi Kukkonen; +Cc: yocto
[-- Attachment #1: Type: text/plain, Size: 573 bytes --]
On 2 May 2016 at 08:48, Jussi Kukkonen <jussi.kukkonen@intel.com> wrote:
> The grab code was trickier with current API (which is why I left it as
> is), but I took another look and it turns out that code has never
> actually been used...
>
> So I removed _grab_lock() and _release_lock(), and replaced STOCK
> items with text.
> I've added these changes to the same branch (should now compile
> without warnings):
> git://github.com/jku/sato-screenshot gtk3
> https://github.com/jku/sato-screenshot/tree/gtk3
>
Merged and tagged, thanks Jussi.
Ross
[-- Attachment #2: Type: text/html, Size: 1216 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-05-18 11:32 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-29 7:06 [screenshot][PATCH 0/1] Support Gtk+3 Jussi Kukkonen
2016-04-29 7:06 ` [screenshot][PATCH 1/1] Quick port to Gtk/Gdk 3 Jussi Kukkonen
2016-04-29 15:46 ` Burton, Ross
2016-05-02 7:48 ` Jussi Kukkonen
2016-05-18 11:32 ` Burton, Ross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.