1997-11-24 22:37:52 +00:00
|
|
|
|
/* GDK - The GIMP Drawing Kit
|
2007-07-19 23:50:39 +00:00
|
|
|
|
* Copyright (C) 1995-2007 Peter Mattis, Spencer Kimball,
|
|
|
|
|
* Josh MacDonald, Ryan Lortie
|
1997-11-24 22:37:52 +00:00
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1997-11-24 22:37:52 +00:00
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Lesser General Public License for more details.
|
1997-11-24 22:37:52 +00:00
|
|
|
|
*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2012-02-27 13:01:10 +00:00
|
|
|
|
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
1997-11-24 22:37:52 +00:00
|
|
|
|
*/
|
1998-03-17 07:54:57 +00:00
|
|
|
|
|
1999-02-24 07:37:18 +00:00
|
|
|
|
/*
|
2000-07-26 11:33:08 +00:00
|
|
|
|
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:37:18 +00:00
|
|
|
|
* file for a list of people on the GTK+ Team. See the ChangeLog
|
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
|
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
|
*/
|
|
|
|
|
|
2008-06-22 14:28:52 +00:00
|
|
|
|
#include "config.h"
|
2004-03-06 03:38:59 +00:00
|
|
|
|
|
2018-03-20 10:46:11 +00:00
|
|
|
|
#include "gdksurface-x11.h"
|
2004-08-09 20:14:43 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
#include "gdksurfaceprivate.h"
|
2020-03-07 21:59:24 +00:00
|
|
|
|
#include "gdkpopupprivate.h"
|
|
|
|
|
#include "gdktoplevelprivate.h"
|
|
|
|
|
#include "gdkdragsurfaceprivate.h"
|
2017-11-01 02:44:15 +00:00
|
|
|
|
#include "gdkvisual-x11.h"
|
2000-03-28 01:24:44 +00:00
|
|
|
|
#include "gdkinternals.h"
|
2010-05-25 22:38:44 +00:00
|
|
|
|
#include "gdkdeviceprivate.h"
|
2020-08-26 20:06:11 +00:00
|
|
|
|
#include "gdkdevice-xi2-private.h"
|
2019-04-22 01:14:46 +00:00
|
|
|
|
#include "gdkframeclockidleprivate.h"
|
2010-12-16 03:09:35 +00:00
|
|
|
|
#include "gdkasync.h"
|
2010-05-25 22:38:44 +00:00
|
|
|
|
#include "gdkeventsource.h"
|
2010-12-16 03:09:35 +00:00
|
|
|
|
#include "gdkdisplay-x11.h"
|
2014-10-09 08:45:44 +00:00
|
|
|
|
#include "gdkglcontext-x11.h"
|
2010-12-16 03:09:35 +00:00
|
|
|
|
#include "gdkprivate-x11.h"
|
2017-11-04 19:23:33 +00:00
|
|
|
|
#include "gdktextureprivate.h"
|
2014-11-07 14:33:53 +00:00
|
|
|
|
#include "gdk-private.h"
|
1998-12-24 19:39:00 +00:00
|
|
|
|
|
2020-07-30 21:06:59 +00:00
|
|
|
|
#include <graphene.h>
|
[ Merges from gtk-1-2 ]
Wed Sep 8 07:13:29 1999 Tim Janik <timj@gtk.org>
* configure.in: fixed "GNU Make" check to pass with new make version
3.77.95.
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.@GTK_MICRO_VERSION@, so the
AM_PATH_GTK() macros don't get confused by the -pre1.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (REBUILD): Change check for perl5
to check explicitely for v >= 5.002. (5.001
does not work with our scripts.)
Wed Aug 25 15:45:46 1999 Tim Janik <timj@gtk.org>
* configure.in: evaluate $PERL for the perl version check. added
--disable-rebuilds to give the user an option to completely disable
any source autogeneration rules.
Mon Aug 23 23:16:14 1999 Tim Janik <timj@gtk.org>
* configure.in: evaluate $ac_make when checking for GNU Make.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* docs/Makefile.am: added generation.txt.
* Makefile.am: require automake 1.4, build README from README.in and
INSTALL from INSTALL.in in dist-hook.
* README.in:
* INSTALL.in: new files to autogenerate README and INSTALL from.
* configure.in: figure whether we have GNU Make
* docs/generation.txt: minor additions/corrections.
Wed Aug 11 13:38:26 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update
July 30, 1999 Elliot Lee <sopwith@redhat.com>
* configure.in: Fix autoconf warnings about cross compilation by
trying to provide sane defaults for AC_TRY_RUN.
Fri Jul 16 22:20:21 PDT 1999 Manish Singh <yosh@gimp.org>
* ltconfig
* ltmain.sh: upgrade to libtool 1.3.3
Thu Jul 8 11:30:18 1999 Owen Taylor <otaylor@redhat.com>
* INSTALL: Indicate that the --with-glib= configure
time flag is unsupported.
Mon Jul 5 20:36:03 1999 Owen Taylor <otaylor@redhat.com>
* docs/generation.txt: Added a file that gives
documenation about the autogeneration process for
various autogenerated files.
Tue Jun 29 15:59:25 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Look for libgmodule in the
right location.
Thu Jun 17 13:57:31 1999 Owen Taylor <otaylor@redhat.com>
* docs/gtk_tut.sgml: Removed references to
code examples in my directory on gtk.org as
they should all be in the tutorial now.
* docs/gtk_tut.sgml: Added sources for dial-test
and scribble-xinput programs that were previously
missing.
Fri Jun 4 00:08:59 1999 Owen Taylor <otaylor@redhat.com>
* TODO: Added entry about menu keyboard navigation, removed
some finished items.
Mon May 31 00:11:24 1999 Owen Taylor <otaylor@redhat.com>
* acinclude.m4: Standardize on func_dgettext
not func_gettext, so that the checks for dgettext
actually are paid attention to.
Wed May 5 10:47:54 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Add $INTLLIBS into $LIBS
directly, rather than repeating the checks for
gettext.
* INSTALL: Added information about gettext and
NLS support.
* acinclude.m4 (LIBM): Check for dgettext, not
just gettext. This should hopefully fix things wrt
systems with old versions of GNU gettext installed.
Tue Jun 29 15:59:25 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Look for libgmodule in the
right location.
Thu Apr 1 16:58:10 PST 1999 Manish Singh <yosh@gimp.org>
* autogen.sh: add --enable-maintainer-mode
* configure.in: set ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
Wed Mar 24 23:03:49 CST 1999 Shawn T. Amundson <amundson@gtk.org>
* docs/gtk-config.1.in:
docs/Makefile.am:
configure.in: gtk-config is now generated.
* docs/gtk-config.1: Removed, now generated.
Thu Sep 23 17:59:59 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): grr, even if Gdk doesn't
handle CreateNotify itself, still put out a debuging message for
--gdk-debug=events. made the ReparentNotify debugging message more
verbose.
wrap xcoords translation for ConfigureEvents into an error trap,
a destroy event may already be pending, and in that case, the
actuall coordinate values are not at all critical.
Sat Sep 18 22:24:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcc.c: Stop leaking the color_hash all over
the place. Simplify and improve the logic.
Fri Sep 17 09:57:15 1999 Tim Janik <timj@gtk.org>
* gdk/gdk.h, gdk/gdkcolor.c: make return types (gint or gboolean)
for prototypes and function implementations consistent (reported
by Tomas Ogren).
Tue Sep 14 18:23:01 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): tell if expose events have
send_event set in debugging output.
(gdk_compress_exposures): default initialize the event so we don't
operate on bogus values (namely send_event).
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
Sun Sep 5 08:10:53 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.c (gdk_font_hash_insert): Add
name => font and name => fontset hashes. The
name => fontset hash is a _big_ win since we
weren't previously caching fontsets at all and loading
fontsets is expensive. The name => font hash
is less of a win, but it does save us from doing
repeated XQueryFont calls on the same font.
* gdk/gdkprivate.h (struct _GdkFontPrivate): Add a names
list so we can remove font/fontset from hash.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Remove useless
and slightly confusing test. [ XInternAtom (,,TRUE)
will never return None ].
Sat Sep 4 08:39:26 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints)
gdk/gdkwindow.c (gdk_window_set_hints):
Don't omit setting the properties if flags == 0 -
there may be an existing set of properties there
already. (Very old bug. Would it be better to
delete the property instead?)
* gdk/gdkselection.c (gdk_selection_property_get): Fix
spelling error in comment.
Wed Sep 1 14:05:30 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Use gdk_error_trap_push()
to avoid stomping over gdk_error_warnings.
* gdk/gdkimage.c (gdk_image_new): compute image->bpp
as (bits_per_pixel + 7) / 8. This gives the same
result as before for multiples of 8, but actually
a "reasonable" value for 1bit or 4bit displays.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* gdk/Makefile.am: minor cleanups, strip spaces on build rules for
GNU Make.
Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): give a debugging note when
discarding configure events.
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gdk/gdkpixmap.c (gdk_pixmap_unref): g_return_if_fail() the
refcount is greater than zero.
* gdk/gdkwindow.c (gdk_window_unref): Likewise.
* gdk/gdkfont.c (gdk_font_unref): Likewise.
* gdk/gdkgc.c (gdk_gc_unref): Likewise.
* gdk/gdkdnd.c (gdk_drag_context_unref): Likewise.
Wed Aug 11 01:04:57 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Fix assumption
that format 32 => sizeof(item) == 4. It really is
sizeof(long).
Tue Jun 29 23:02:42 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_x_error / gdk_x_io_error): Don't
core dump at all on X IO errors, only core dump
if --enable-debug for X errors.
Thu Jun 24 17:06:23 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): removed old ""Got event for
unknown window:" message. disabled ConfigureNotify discarding code,
because it led to events being processed out of order.
Thu Jun 24 12:22:02 1999 Tim Janik <timj@gtk.org>
* gdk/gdkglobals.c: preinitialize gdk_error_code to 0.
* gdk/gdkevents.c (gdk_event_send_client_message_to_all_recurse): since
we export this function, supress error warnings and don't reset the
error code in the first half of this function.
* gdk/gdk.c (gdk_x_error): set gdk_error_code to the actuall X error
code (instead of just -1) so gdk_error_trap_pop() reveals something
actually informative about the error that happened.
* gdk/*.c:
don't rely on gdk_error_code being -1 if an error occoured, but just
gdk_error_code != 0.
Thu Jun 24 11:50:07 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_apply_filters): advance the filter list
pointer *before* invoking the filter function, so we at least don't
crash if a filter is removed that is currently executed. window filters
*really* need to be made truely reentrant at some point.
Mon Jun 14 11:10:15 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): print the atom name in the
PropertyNotify debug messages.
Wed May 5 22:51:06 1999 Owen Taylor <otaylor@redhat.com>
Patch from Sung-Hyun Nam <namsh@lgic.co.kr>
* gdk/gdkim.c: Fix cut-and-paste errors for
x/y and PreeditAttributes/StatusAttributes.
Wed May 5 22:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints): Change
G_MAXINT to 2^16 to alleviate overflow problems in
various window managers.
Wed Apr 21 00:42:08 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.c (gdk_text_measure): Fix the return value
for fontsets.
Wed May 5 12:42:01 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints):
Initialize size_hints.x and size_hints.y because kwm
brokenly pays attention to them.
(Bug #1181 - Lars Heete <hel@admin.de>)
Wed May 5 11:38:56 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_choose_visual): Free the
return value of gdk_list_visuals().
(Bug #1193 - Morten Welinder <terra@diku.dk>)
Tue May 4 11:12:56 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkim.c (gdk_im_real_open): cast the return value of
XSetIMValues to (void *) when comparing to NULL, to workaround
the problem of some compilers barfing since older X headers don't
have the prototype for it.
Mon Apr 19 10:11:12 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcolor.c (gdk_colormap_new): Fix memory leak
for pseudocolor where colormap->colors was double
allocated.
* gdk/gdkcolor.c (gdk_colormap_alloc1): Store the
color value in the hash table with the pixel filled
in so when we do later hash table lookups, the color
value is correct.
Sun May 2 15:29:45 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkdraw.c (gdk_draw_lines): check private->destroyed before
making the call
Tue Apr 27 11:17:35 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (xdnd_set_{targets,actions}): Fix leak
pointed out by Morten Welinder <terra@diku.dk>.
Wed Apr 21 14:20:22 1999 George Lebl <jirka@5z.com>
* gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the
default filter from the list
Wed Apr 21 14:20:22 1999 George Lebl <jirka@5z.com>
* gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the
default filter from the list
Fri Apr 16 20:41:43 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c: #include "gdkkeysyms.h" for gdk_XConvertCase #defines
* gtk/gtkfontsel.c (gtk_font_selection_create_xlfd): use
g_strdup_printf instead of calcing the length separately
Tue Apr 13 02:49:33 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: removed some silly #ifdef HAVE_CONFIG
that we don't do in many other places. (Fixing duplicate
#include of config.h)
* gdk/gdkevents.c: include gdkinput.h _after_ config.h.
Otherwise, #ifndef XINPUT_NONE check in the latter
doesn't work. (Bug #546)
Sun Apr 11 14:38:03 1999 Tim Janik <timj@gtk.org>
* gdk/gdkpixmap.c (_gdk_pixmap_create_from_xpm): check for color
"None" case insensitive.
Tue Apr 6 16:38:51 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkselection.c:
Add error traps so if the other end of the connection
dies, we survive.
Tue Apr 6 12:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (gdk_drag_motion): Separate out the
dest_xid field into two fields - one for the window
to send in messages, one to indicate the last looked
up window for caching purposes. This is needed, so
that Leave messages get the correct window.
Mon Apr 5 13:21:30 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_check, gdk_event_prepare):
Fix warning created by people mucking around
with the gsource API.
* gdk/gdkevents.c (gdk_io_invoke, gdk_input_add_full):
Change mapping between GIOCondition and GdkInputCondition
to match the way the Linux kernel does it. This should
fix problems where closed pipes were no longer signalling
GDK_INPUT_READ on systems with a native poll().
Mon Apr 5 17:11:57 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.c (_gdk_pixmap_create_from_xpm): Check
explicitly for the string "None" - it is in the XPM
spec and some servers treat unknown colors in odd ways
(like asking the user!)
Thu Apr 1 16:58:10 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkevents.c: made "->" into a "." of previous change so
it compiles
Thu Apr 1 18:41:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_compress_exposures): Set the
window field of the event structure before calling
user filters.
1999-03-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdk/gdk.c (gdk_init_check): Use False as the last argument to
XInternAtom() here. This is a particularly Old And Nasty(tm) bug.
Mon Mar 29 17:31:52 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkim.c (gdk_mbstowcs): Free the value of the
intermediate text property - prevents major memory
leak when gdk_use_mb.
gtk-d3august-990311-0: Bj|rn Augustsson <d3august@dtek.chalmers.se>
Mon Mar 29 17:02:58 1999 Owen Taylor <otaylor@redhat.com>
Patches from Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
gtk-a-higuti-990322-[0-3]
* gdk/gdkfont.c (gdk_text_extents_wc): Make work when
sizeof(wchar_t) != sizeof (GdkWChar)
* configure.in: Fix confusion between GTK_LOCALE_[C]FLAGS
that was causing -DX_LOCALE not to work.
* gtk/gtkrc.c (gtk_rc_init):
X_LOCALE will never have LC_MESSAGES defined
* gdk/gdk.c (gdk_init_check):
Remove --xim-preedit and --xim-status from argv properly.
* gdk/gdkim.c (gdk_ic_real_new): Add a gdk_flush() so
that the client window is present on the X server
before we pass it to the input method.
Tue Mar 9 10:46:49 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (motif_find_drag_window): Fix bug where
if --display is specified on the command line, than
the drag window will not be created on that display.
Tue Mar 9 10:38:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Fixed bug where
lookups with only_if_exists == TRUE were inserting
bogus values into the atom cache.
Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org>
* gdk/gdkselection.c (gdk_selection_property_get): first XFree(t),
then reset it to NULL.
* gdk/gdkcolor.c:
(gdk_colors_free):
(gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the
key for g_hash_table_remove() in both functions, this prevents us
from accessing possibly uninitialized portions of a GdkColor structure
where we are only interested in its pixel value.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
1999-09-21 Tor Lillqvist <tml@iki.fi>
1999-09-28 20:19:13 +00:00
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
2010-10-15 02:05:51 +00:00
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
|
|
#include <cairo-xlib.h>
|
|
|
|
|
|
|
|
|
|
#include "MwmUtil.h"
|
1998-12-24 19:39:00 +00:00
|
|
|
|
|
2010-10-15 02:05:51 +00:00
|
|
|
|
#include <X11/Xlib.h>
|
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
|
#include <X11/Xatom.h>
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
1998-05-03 22:41:32 +00:00
|
|
|
|
#include <X11/extensions/shape.h>
|
|
|
|
|
|
2010-10-15 02:05:51 +00:00
|
|
|
|
#ifdef HAVE_XKB
|
|
|
|
|
#include <X11/XKBlib.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2007-06-01 12:16:12 +00:00
|
|
|
|
#ifdef HAVE_XCOMPOSITE
|
|
|
|
|
#include <X11/extensions/Xcomposite.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_XFIXES
|
|
|
|
|
#include <X11/extensions/Xfixes.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2010-12-15 22:32:29 +00:00
|
|
|
|
const int _gdk_x11_event_mask_table[21] =
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
|
|
|
|
ExposureMask,
|
|
|
|
|
PointerMotionMask,
|
|
|
|
|
PointerMotionHintMask,
|
|
|
|
|
ButtonMotionMask,
|
|
|
|
|
Button1MotionMask,
|
|
|
|
|
Button2MotionMask,
|
|
|
|
|
Button3MotionMask,
|
2000-02-18 20:02:24 +00:00
|
|
|
|
ButtonPressMask,
|
|
|
|
|
ButtonReleaseMask,
|
1997-11-24 22:37:52 +00:00
|
|
|
|
KeyPressMask,
|
|
|
|
|
KeyReleaseMask,
|
|
|
|
|
EnterWindowMask,
|
|
|
|
|
LeaveWindowMask,
|
|
|
|
|
FocusChangeMask,
|
|
|
|
|
StructureNotifyMask,
|
|
|
|
|
PropertyChangeMask,
|
1998-01-06 01:17:10 +00:00
|
|
|
|
VisibilityChangeMask,
|
2010-12-15 22:32:29 +00:00
|
|
|
|
0, /* PROXIMITY_IN */
|
|
|
|
|
0, /* PROXIMTY_OUT */
|
2000-02-18 20:02:24 +00:00
|
|
|
|
SubstructureNotifyMask,
|
|
|
|
|
ButtonPressMask /* SCROLL; on X mouse wheel events is treated as mouse button 4/5 */
|
1997-11-24 22:37:52 +00:00
|
|
|
|
};
|
2010-12-15 22:32:29 +00:00
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
|
const int _gdk_x11_event_mask_table_size = G_N_ELEMENTS (_gdk_x11_event_mask_table);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
1999-01-27 18:21:20 +00:00
|
|
|
|
/* Forward declarations */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
static void gdk_x11_surface_apply_fullscreen_mode (GdkSurface *surface);
|
|
|
|
|
static gboolean gdk_surface_icon_name_set (GdkSurface *surface);
|
2002-11-08 22:29:33 +00:00
|
|
|
|
static void set_wm_name (GdkDisplay *display,
|
|
|
|
|
Window xwindow,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *name);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
static void move_to_current_desktop (GdkSurface *surface);
|
2020-03-20 14:24:06 +00:00
|
|
|
|
static void gdk_x11_toplevel_state_callback (GdkSurface *surface);
|
2020-03-31 12:38:08 +00:00
|
|
|
|
static gboolean gdk_x11_toplevel_event_callback (GdkSurface *surface,
|
|
|
|
|
GdkEvent *gdk_event);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
|
2004-08-23 17:10:34 +00:00
|
|
|
|
/* Return whether time1 is considered later than time2 as far as xserver
|
|
|
|
|
* time is concerned. Accounts for wraparound.
|
|
|
|
|
*/
|
|
|
|
|
#define XSERVER_TIME_IS_LATER(time1, time2) \
|
|
|
|
|
( (( time1 > time2 ) && ( time1 - time2 < ((guint32)-1)/2 )) || \
|
|
|
|
|
(( time1 < time2 ) && ( time2 - time1 > ((guint32)-1)/2 )) \
|
|
|
|
|
)
|
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
G_DEFINE_TYPE (GdkX11Surface, gdk_x11_surface, GDK_TYPE_SURFACE)
|
2010-12-21 02:34:31 +00:00
|
|
|
|
|
2020-03-07 21:59:24 +00:00
|
|
|
|
GType gdk_x11_toplevel_get_type (void) G_GNUC_CONST;
|
|
|
|
|
GType gdk_x11_popup_get_type (void) G_GNUC_CONST;
|
|
|
|
|
GType gdk_x11_drag_surface_get_type (void) G_GNUC_CONST;
|
|
|
|
|
|
|
|
|
|
#define GDK_TYPE_X11_TOPLEVEL (gdk_x11_toplevel_get_type ())
|
|
|
|
|
#define GDK_TYPE_X11_POPUP (gdk_x11_popup_get_type ())
|
|
|
|
|
#define GDK_TYPE_X11_DRAG_SURFACE (gdk_x11_drag_surface_get_type ())
|
|
|
|
|
|
2010-12-21 02:34:31 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_init (GdkX11Surface *impl)
|
2002-09-25 19:16:46 +00:00
|
|
|
|
{
|
2018-03-20 11:05:26 +00:00
|
|
|
|
impl->surface_scale = 1;
|
2013-06-26 14:05:38 +00:00
|
|
|
|
impl->frame_sync_enabled = TRUE;
|
2020-04-16 10:58:39 +00:00
|
|
|
|
impl->surface_is_on_monitor = NULL;
|
1998-03-07 18:38:18 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-05 02:34:52 +00:00
|
|
|
|
GdkToplevelX11 *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_x11_surface_get_toplevel (GdkSurface *surface)
|
2003-07-05 02:34:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2003-07-05 02:34:52 +00:00
|
|
|
|
|
2020-03-05 06:02:24 +00:00
|
|
|
|
g_assert (GDK_IS_SURFACE (surface));
|
2003-07-05 02:34:52 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
|
|
|
|
|
if (!impl->toplevel)
|
2012-03-31 14:01:36 +00:00
|
|
|
|
{
|
|
|
|
|
impl->toplevel = g_new0 (GdkToplevelX11, 1);
|
2017-07-18 10:36:35 +00:00
|
|
|
|
impl->toplevel->have_focused = FALSE;
|
2020-03-20 14:24:06 +00:00
|
|
|
|
g_signal_connect (surface, "notify::state",
|
|
|
|
|
G_CALLBACK (gdk_x11_toplevel_state_callback),
|
|
|
|
|
NULL);
|
2020-03-31 12:38:08 +00:00
|
|
|
|
g_signal_connect (surface, "event",
|
|
|
|
|
G_CALLBACK (gdk_x11_toplevel_event_callback),
|
|
|
|
|
NULL);
|
2012-03-31 14:01:36 +00:00
|
|
|
|
}
|
2003-07-05 02:34:52 +00:00
|
|
|
|
|
|
|
|
|
return impl->toplevel;
|
|
|
|
|
}
|
|
|
|
|
|
2010-10-06 01:49:04 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* _gdk_x11_surface_update_size:
|
2019-04-22 01:14:46 +00:00
|
|
|
|
* @impl: a #GdkX11Surface.
|
2010-10-06 01:49:04 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Updates the state of the surface (in particular the drawable's
|
2010-10-06 01:49:04 +00:00
|
|
|
|
* cairo surface) when its size has changed.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
_gdk_x11_surface_update_size (GdkX11Surface *impl)
|
2010-10-06 01:49:04 +00:00
|
|
|
|
{
|
|
|
|
|
if (impl->cairo_surface)
|
|
|
|
|
{
|
|
|
|
|
cairo_xlib_surface_set_size (impl->cairo_surface,
|
2014-11-06 22:17:45 +00:00
|
|
|
|
impl->unscaled_width, impl->unscaled_height);
|
2010-10-06 01:49:04 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2017-04-28 21:55:47 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_get_unscaled_size (GdkSurface *surface,
|
2014-11-20 10:50:11 +00:00
|
|
|
|
int *unscaled_width,
|
|
|
|
|
int *unscaled_height)
|
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2014-11-20 10:50:11 +00:00
|
|
|
|
|
|
|
|
|
if (unscaled_width)
|
|
|
|
|
*unscaled_width = impl->unscaled_width;
|
|
|
|
|
|
|
|
|
|
if (unscaled_height)
|
|
|
|
|
*unscaled_height = impl->unscaled_height;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-09 18:38:08 +00:00
|
|
|
|
gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_supports_edge_constraints (GdkSurface *surface)
|
2017-09-18 02:09:10 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
2017-12-14 04:39:03 +00:00
|
|
|
|
g_intern_static_string ("_GTK_EDGE_CONSTRAINTS"));
|
2017-09-18 02:09:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 13:31:17 +00:00
|
|
|
|
static void
|
|
|
|
|
set_sync_counter(Display *display,
|
|
|
|
|
XSyncCounter counter,
|
|
|
|
|
gint64 value)
|
|
|
|
|
{
|
|
|
|
|
XSyncValue sync_value;
|
|
|
|
|
|
2014-11-08 01:39:43 +00:00
|
|
|
|
XSyncIntsToValue (&sync_value,
|
|
|
|
|
value & G_GINT64_CONSTANT(0xFFFFFFFF),
|
|
|
|
|
value >> 32);
|
|
|
|
|
XSyncSetCounter (display, counter, sync_value);
|
2012-09-18 13:31:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-30 08:43:26 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_x11_surface_pre_damage (GdkSurface *surface)
|
2012-11-14 17:23:41 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
|
|
|
|
if (impl->toplevel->in_frame &&
|
|
|
|
|
impl->toplevel->current_counter_value % 2 == 0)
|
|
|
|
|
{
|
|
|
|
|
impl->toplevel->current_counter_value += 1;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
set_sync_counter (GDK_SURFACE_XDISPLAY (surface),
|
2014-11-08 01:39:43 +00:00
|
|
|
|
impl->toplevel->extended_update_counter,
|
|
|
|
|
impl->toplevel->current_counter_value);
|
2012-11-14 17:23:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
on_surface_changed (void *data)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface = data;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
2016-01-08 18:44:36 +00:00
|
|
|
|
if (impl->tracking_damage)
|
2018-03-30 08:43:26 +00:00
|
|
|
|
gdk_x11_surface_pre_damage (surface);
|
2012-11-14 17:23:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* We want to know when cairo drawing causes damage to the window,
|
|
|
|
|
* so we engage in the _NET_WM_FRAME_DRAWN protocol with the
|
|
|
|
|
* window only when there actually is drawing. To do that we use
|
|
|
|
|
* a technique (hack) suggested by Uli Schlachter - if we set
|
|
|
|
|
* a dummy "mime data" on the cairo surface (this facility is
|
2020-08-21 12:41:13 +00:00
|
|
|
|
* used to attach JPEG data to an imager), then cairo will flush
|
2012-11-14 17:23:41 +00:00
|
|
|
|
* and remove the mime data before making any changes to the window.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
hook_surface_changed (GdkSurface *surface)
|
2012-11-14 17:23:41 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
|
|
|
|
if (impl->cairo_surface)
|
2016-01-08 18:44:36 +00:00
|
|
|
|
{
|
|
|
|
|
cairo_surface_set_mime_data (impl->cairo_surface,
|
|
|
|
|
"x-gdk/change-notify",
|
|
|
|
|
(unsigned char *)"X",
|
|
|
|
|
1,
|
|
|
|
|
on_surface_changed,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface);
|
2016-01-08 18:44:36 +00:00
|
|
|
|
impl->tracking_damage = 1;
|
|
|
|
|
}
|
2012-11-14 17:23:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
unhook_surface_changed (GdkSurface *surface)
|
2012-11-14 17:23:41 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
|
|
|
|
if (impl->cairo_surface)
|
2016-01-08 18:44:36 +00:00
|
|
|
|
{
|
|
|
|
|
impl->tracking_damage = 0;
|
|
|
|
|
cairo_surface_set_mime_data (impl->cairo_surface,
|
|
|
|
|
"x-gdk/change-notify",
|
|
|
|
|
NULL, 0,
|
|
|
|
|
NULL, NULL);
|
|
|
|
|
}
|
2012-11-14 17:23:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-11-15 19:11:41 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_predict_presentation_time (GdkSurface *surface)
|
2012-11-15 19:11:41 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2012-11-15 19:11:41 +00:00
|
|
|
|
GdkFrameClock *clock;
|
|
|
|
|
GdkFrameTimings *timings;
|
|
|
|
|
gint64 presentation_time;
|
|
|
|
|
gint64 refresh_interval;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
clock = gdk_surface_get_frame_clock (surface);
|
2012-11-15 19:11:41 +00:00
|
|
|
|
|
2013-02-12 20:03:21 +00:00
|
|
|
|
timings = gdk_frame_clock_get_current_timings (clock);
|
2012-11-15 19:11:41 +00:00
|
|
|
|
|
|
|
|
|
gdk_frame_clock_get_refresh_info (clock,
|
2013-02-12 21:14:24 +00:00
|
|
|
|
timings->frame_time,
|
2012-11-15 19:11:41 +00:00
|
|
|
|
&refresh_interval, &presentation_time);
|
|
|
|
|
|
|
|
|
|
if (presentation_time != 0)
|
|
|
|
|
{
|
2013-02-12 21:14:24 +00:00
|
|
|
|
if (timings->slept_before)
|
2012-11-15 19:11:41 +00:00
|
|
|
|
{
|
|
|
|
|
presentation_time += refresh_interval;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-02-12 21:14:24 +00:00
|
|
|
|
if (presentation_time < timings->frame_time + refresh_interval / 2)
|
2012-11-15 19:11:41 +00:00
|
|
|
|
presentation_time += refresh_interval;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-02-12 21:14:24 +00:00
|
|
|
|
if (timings->slept_before)
|
|
|
|
|
presentation_time = timings->frame_time + refresh_interval + refresh_interval / 2;
|
2012-11-15 19:11:41 +00:00
|
|
|
|
else
|
2013-02-12 21:14:24 +00:00
|
|
|
|
presentation_time = timings->frame_time + refresh_interval;
|
2012-11-15 19:11:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (presentation_time < impl->toplevel->throttled_presentation_time)
|
|
|
|
|
presentation_time = impl->toplevel->throttled_presentation_time;
|
|
|
|
|
|
2013-02-12 21:14:24 +00:00
|
|
|
|
timings->predicted_presentation_time = presentation_time;
|
2012-11-15 19:11:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 13:37:03 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_begin_frame (GdkSurface *surface,
|
2013-06-13 15:36:56 +00:00
|
|
|
|
gboolean force_frame)
|
2012-09-18 13:37:03 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2012-09-18 13:37:03 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2012-09-18 13:37:03 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2012-09-18 13:37:03 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (impl->toplevel->extended_update_counter == None)
|
2012-09-18 13:37:03 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2012-11-14 17:23:41 +00:00
|
|
|
|
impl->toplevel->in_frame = TRUE;
|
|
|
|
|
|
2012-12-19 17:49:32 +00:00
|
|
|
|
if (impl->toplevel->configure_counter_value != 0 &&
|
|
|
|
|
impl->toplevel->configure_counter_value_is_extended)
|
|
|
|
|
{
|
|
|
|
|
impl->toplevel->current_counter_value = impl->toplevel->configure_counter_value;
|
|
|
|
|
if ((impl->toplevel->current_counter_value % 2) == 1)
|
|
|
|
|
impl->toplevel->current_counter_value += 1;
|
|
|
|
|
|
|
|
|
|
impl->toplevel->configure_counter_value = 0;
|
|
|
|
|
|
2018-03-30 08:43:26 +00:00
|
|
|
|
gdk_x11_surface_pre_damage (surface);
|
2012-12-19 17:49:32 +00:00
|
|
|
|
}
|
2013-06-13 15:36:56 +00:00
|
|
|
|
else if (force_frame)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
/* When mapping the surface, we really want to freeze the
|
|
|
|
|
rendering of the surface by the compositor until we've
|
|
|
|
|
actually painted something into the surface's buffer. */
|
2018-03-30 08:43:26 +00:00
|
|
|
|
gdk_x11_surface_pre_damage (surface);
|
2013-06-13 15:36:56 +00:00
|
|
|
|
}
|
2012-12-19 17:49:32 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
hook_surface_changed (surface);
|
2012-12-19 17:49:32 +00:00
|
|
|
|
}
|
2012-09-18 13:37:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-14 13:40:34 +00:00
|
|
|
|
gboolean
|
|
|
|
|
_gdk_x11_surface_syncs_frames (GdkSurface *surface)
|
2020-06-02 20:29:03 +00:00
|
|
|
|
{
|
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
|
|
|
|
|
|
|
|
|
/* disabled client side */
|
|
|
|
|
if (!impl->frame_sync_enabled)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
/* disabled compositor side */
|
|
|
|
|
if (!gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
|
|
|
|
g_intern_static_string ("_NET_WM_FRAME_DRAWN")))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sync_counter_for_end_frame (GdkSurface *surface)
|
|
|
|
|
{
|
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
|
|
|
|
|
|
|
|
|
g_assert (!impl->toplevel->in_frame);
|
|
|
|
|
g_assert (impl->toplevel->extended_update_counter != None);
|
|
|
|
|
g_assert ((impl->toplevel->current_counter_value % 2) == 0);
|
|
|
|
|
|
|
|
|
|
set_sync_counter (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
impl->toplevel->extended_update_counter,
|
|
|
|
|
impl->toplevel->current_counter_value);
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-27 19:12:35 +00:00
|
|
|
|
static void
|
|
|
|
|
maybe_sync_counter_for_end_frame (GdkSurface *surface)
|
|
|
|
|
{
|
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2020-07-14 13:40:34 +00:00
|
|
|
|
gboolean frame_sync_negotiated = _gdk_x11_surface_syncs_frames (surface);
|
2020-05-27 19:12:35 +00:00
|
|
|
|
gboolean frame_done_painting = !impl->toplevel->frame_pending;
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_XDAMAGE
|
|
|
|
|
frame_done_painting = !impl->toplevel->frame_still_painting && frame_sync_negotiated;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
if (!impl->toplevel->frame_pending)
|
|
|
|
|
{
|
|
|
|
|
if (!frame_sync_negotiated || frame_done_painting)
|
|
|
|
|
sync_counter_for_end_frame (surface);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (frame_done_painting)
|
|
|
|
|
sync_counter_for_end_frame (surface);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_XDAMAGE
|
|
|
|
|
void
|
|
|
|
|
_gdk_x11_surface_set_frame_still_painting (GdkSurface *surface,
|
|
|
|
|
gboolean painting)
|
|
|
|
|
{
|
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
|
|
|
|
|
|
|
|
|
if (impl->toplevel->frame_still_painting == painting)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
impl->toplevel->frame_still_painting = painting;
|
|
|
|
|
|
|
|
|
|
if (!impl->toplevel->frame_still_painting)
|
|
|
|
|
maybe_sync_counter_for_end_frame (surface);
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2012-09-18 13:37:03 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_end_frame (GdkSurface *surface)
|
2012-09-18 13:37:03 +00:00
|
|
|
|
{
|
2012-11-14 21:50:05 +00:00
|
|
|
|
GdkFrameClock *clock;
|
|
|
|
|
GdkFrameTimings *timings;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2012-09-18 13:37:03 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2012-09-18 13:37:03 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2012-09-18 13:37:03 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (impl->toplevel->extended_update_counter == None ||
|
2012-11-14 17:23:41 +00:00
|
|
|
|
!impl->toplevel->in_frame)
|
2012-09-18 13:37:03 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
clock = gdk_surface_get_frame_clock (surface);
|
2013-02-12 20:03:21 +00:00
|
|
|
|
timings = gdk_frame_clock_get_current_timings (clock);
|
2012-11-14 21:50:05 +00:00
|
|
|
|
|
2018-03-30 13:36:54 +00:00
|
|
|
|
/* Make sure we request timing updates even if nothing was damaged.
|
|
|
|
|
* We want the frame clock to be accurate. */
|
|
|
|
|
gdk_x11_surface_pre_damage (surface);
|
|
|
|
|
|
2012-11-14 17:23:41 +00:00
|
|
|
|
impl->toplevel->in_frame = FALSE;
|
|
|
|
|
|
2012-10-04 00:15:44 +00:00
|
|
|
|
if (impl->toplevel->current_counter_value % 2 == 1)
|
2012-09-18 13:37:03 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_DISPLAY_DEBUG_CHECK (gdk_surface_get_display (surface), FRAMES))
|
2012-11-15 00:21:33 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XImage *image = XGetImage (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
2012-11-15 00:21:33 +00:00
|
|
|
|
0, 0, 1, 1,
|
|
|
|
|
(1 << 24) - 1,
|
|
|
|
|
ZPixmap);
|
|
|
|
|
XDestroyImage (image);
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-14 21:50:05 +00:00
|
|
|
|
/* An increment of 3 means that the frame was not drawn as fast as possible,
|
|
|
|
|
* but rather at a particular time. This can trigger different handling from
|
|
|
|
|
* the compositor.
|
|
|
|
|
*/
|
2013-02-12 21:14:24 +00:00
|
|
|
|
if (timings->slept_before)
|
2012-11-14 21:50:05 +00:00
|
|
|
|
impl->toplevel->current_counter_value += 3;
|
|
|
|
|
else
|
|
|
|
|
impl->toplevel->current_counter_value += 1;
|
|
|
|
|
|
2020-05-27 19:12:35 +00:00
|
|
|
|
maybe_sync_counter_for_end_frame (surface);
|
2012-10-04 00:15:44 +00:00
|
|
|
|
|
2020-07-14 13:40:34 +00:00
|
|
|
|
if (_gdk_x11_surface_syncs_frames (surface))
|
2012-10-04 00:15:44 +00:00
|
|
|
|
{
|
|
|
|
|
impl->toplevel->frame_pending = TRUE;
|
2019-06-28 16:45:44 +00:00
|
|
|
|
gdk_surface_freeze_updates (surface);
|
2013-02-12 21:14:24 +00:00
|
|
|
|
timings->cookie = impl->toplevel->current_counter_value;
|
2012-10-04 00:15:44 +00:00
|
|
|
|
}
|
2012-09-18 13:37:03 +00:00
|
|
|
|
}
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
unhook_surface_changed (surface);
|
2012-11-14 21:50:05 +00:00
|
|
|
|
|
2012-12-19 17:49:32 +00:00
|
|
|
|
if (impl->toplevel->configure_counter_value != 0 &&
|
|
|
|
|
!impl->toplevel->configure_counter_value_is_extended)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
set_sync_counter (GDK_SURFACE_XDISPLAY (surface),
|
2012-12-19 17:49:32 +00:00
|
|
|
|
impl->toplevel->update_counter,
|
|
|
|
|
impl->toplevel->configure_counter_value);
|
|
|
|
|
|
|
|
|
|
impl->toplevel->configure_counter_value = 0;
|
|
|
|
|
}
|
|
|
|
|
|
2012-11-14 21:50:05 +00:00
|
|
|
|
if (!impl->toplevel->frame_pending)
|
2013-02-12 21:14:24 +00:00
|
|
|
|
timings->complete = TRUE;
|
2012-09-18 13:37:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-10-06 01:49:04 +00:00
|
|
|
|
/*****************************************************
|
|
|
|
|
* X11 specific implementations of generic functions *
|
|
|
|
|
*****************************************************/
|
|
|
|
|
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_finalize (GObject *object)
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_X11_SURFACE (object));
|
2010-12-15 22:45:05 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (object);
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (impl->toplevel->in_frame)
|
2019-04-22 01:14:46 +00:00
|
|
|
|
unhook_surface_changed (GDK_SURFACE (impl));
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
2020-03-20 14:24:06 +00:00
|
|
|
|
g_signal_handlers_disconnect_by_func (GDK_SURFACE (impl),
|
|
|
|
|
gdk_x11_toplevel_state_callback,
|
|
|
|
|
NULL);
|
2020-03-31 12:38:08 +00:00
|
|
|
|
g_signal_handlers_disconnect_by_func (GDK_SURFACE (impl),
|
|
|
|
|
gdk_x11_toplevel_event_callback,
|
|
|
|
|
NULL);
|
2020-03-20 14:24:06 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
_gdk_x11_surface_grab_check_destroy (GDK_SURFACE (impl));
|
2002-03-02 20:37:07 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
if (!GDK_SURFACE_DESTROYED (impl))
|
1999-02-10 08:06:30 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkDisplay *display = GDK_SURFACE_DISPLAY (GDK_SURFACE (impl));
|
2010-12-15 22:45:05 +00:00
|
|
|
|
|
2010-12-16 04:35:15 +00:00
|
|
|
|
_gdk_x11_display_remove_window (display, impl->xid);
|
2010-10-06 01:49:04 +00:00
|
|
|
|
if (impl->toplevel && impl->toplevel->focus_window)
|
2010-12-16 04:35:15 +00:00
|
|
|
|
_gdk_x11_display_remove_window (display, impl->toplevel->focus_window);
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-04-16 10:58:39 +00:00
|
|
|
|
g_clear_pointer (&impl->surface_is_on_monitor, g_list_free);
|
|
|
|
|
|
2010-10-06 01:49:04 +00:00
|
|
|
|
g_free (impl->toplevel);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
|
2010-10-06 01:49:04 +00:00
|
|
|
|
if (impl->cursor)
|
2011-10-15 12:35:28 +00:00
|
|
|
|
g_object_unref (impl->cursor);
|
2005-06-15 18:37:18 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
G_OBJECT_CLASS (gdk_x11_surface_parent_class)->finalize (object);
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
}
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2010-08-27 10:08:30 +00:00
|
|
|
|
typedef struct {
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
Pixmap pixmap;
|
|
|
|
|
} FreePixmapData;
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
free_pixmap (gpointer datap)
|
|
|
|
|
{
|
|
|
|
|
FreePixmapData *data = datap;
|
|
|
|
|
|
|
|
|
|
if (!gdk_display_is_closed (data->display))
|
|
|
|
|
{
|
|
|
|
|
XFreePixmap (GDK_DISPLAY_XDISPLAY (data->display),
|
|
|
|
|
data->pixmap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
g_object_unref (data->display);
|
|
|
|
|
g_slice_free (FreePixmapData, data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
attach_free_pixmap_handler (cairo_surface_t *surface,
|
|
|
|
|
GdkDisplay *display,
|
|
|
|
|
Pixmap pixmap)
|
|
|
|
|
{
|
|
|
|
|
static const cairo_user_data_key_t key;
|
|
|
|
|
FreePixmapData *data;
|
|
|
|
|
|
|
|
|
|
data = g_slice_new (FreePixmapData);
|
|
|
|
|
data->display = g_object_ref (display);
|
|
|
|
|
data->pixmap = pixmap;
|
|
|
|
|
|
|
|
|
|
cairo_surface_set_user_data (surface, &key, data, free_pixmap);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Cairo does not guarantee we get an xlib surface if we call
|
|
|
|
|
* cairo_surface_create_similar(). In some cases however, we must use a
|
|
|
|
|
* pixmap or bitmap in the X11 API.
|
|
|
|
|
* These functions ensure an Xlib surface.
|
|
|
|
|
*/
|
2010-08-27 13:09:49 +00:00
|
|
|
|
cairo_surface_t *
|
2017-11-09 23:40:16 +00:00
|
|
|
|
_gdk_x11_display_create_bitmap_surface (GdkDisplay *display,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
2010-08-27 10:08:30 +00:00
|
|
|
|
{
|
|
|
|
|
cairo_surface_t *surface;
|
|
|
|
|
Pixmap pixmap;
|
|
|
|
|
|
2017-11-09 23:40:16 +00:00
|
|
|
|
pixmap = XCreatePixmap (GDK_DISPLAY_XDISPLAY (display),
|
|
|
|
|
GDK_SCREEN_XROOTWIN (GDK_X11_DISPLAY (display)->screen),
|
2010-08-27 10:08:30 +00:00
|
|
|
|
width, height, 1);
|
2017-11-09 23:40:16 +00:00
|
|
|
|
surface = cairo_xlib_surface_create_for_bitmap (GDK_DISPLAY_XDISPLAY (display),
|
2010-08-27 10:08:30 +00:00
|
|
|
|
pixmap,
|
2017-11-09 23:40:16 +00:00
|
|
|
|
GDK_X11_SCREEN (GDK_X11_DISPLAY (display)->screen)->xscreen,
|
2010-08-27 10:08:30 +00:00
|
|
|
|
width, height);
|
2017-11-09 23:40:16 +00:00
|
|
|
|
attach_free_pixmap_handler (surface, display, pixmap);
|
2010-08-27 10:08:30 +00:00
|
|
|
|
|
|
|
|
|
return surface;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
/* Create a surface backed with a pixmap without alpha on the same screen as surface */
|
2010-08-27 10:08:30 +00:00
|
|
|
|
static cairo_surface_t *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_create_pixmap_surface (GdkSurface *surface,
|
2010-08-27 10:08:30 +00:00
|
|
|
|
int width,
|
|
|
|
|
int height)
|
|
|
|
|
{
|
2016-11-03 04:46:46 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
Display *dpy;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cairo_surface_t *cairo_surface;
|
2010-08-27 10:08:30 +00:00
|
|
|
|
Pixmap pixmap;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2016-11-03 04:46:46 +00:00
|
|
|
|
dpy = GDK_DISPLAY_XDISPLAY (display);
|
|
|
|
|
|
|
|
|
|
pixmap = XCreatePixmap (dpy,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2010-08-27 10:08:30 +00:00
|
|
|
|
width, height,
|
2016-11-03 04:46:46 +00:00
|
|
|
|
DefaultDepth (dpy, DefaultScreen (dpy)));
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cairo_surface = cairo_xlib_surface_create (dpy,
|
2010-08-27 10:08:30 +00:00
|
|
|
|
pixmap,
|
2016-11-03 04:46:46 +00:00
|
|
|
|
DefaultVisual (dpy, DefaultScreen (dpy)),
|
2010-08-27 10:08:30 +00:00
|
|
|
|
width, height);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
attach_free_pixmap_handler (cairo_surface, display, pixmap);
|
2010-08-27 10:08:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return cairo_surface;
|
2010-08-27 10:08:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
set_wm_protocols (GdkSurface *surface)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkDisplay *display = gdk_surface_get_display (surface);
|
2004-07-11 13:26:57 +00:00
|
|
|
|
Atom protocols[4];
|
|
|
|
|
int n = 0;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2004-07-11 13:26:57 +00:00
|
|
|
|
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "WM_DELETE_WINDOW");
|
2013-12-04 16:21:42 +00:00
|
|
|
|
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "WM_TAKE_FOCUS");
|
2004-07-11 13:26:57 +00:00
|
|
|
|
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_PING");
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2004-07-11 13:26:57 +00:00
|
|
|
|
#ifdef HAVE_XSYNC
|
2010-12-20 18:20:10 +00:00
|
|
|
|
if (GDK_X11_DISPLAY (display)->use_sync)
|
2004-07-11 13:26:57 +00:00
|
|
|
|
protocols[n++] = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_SYNC_REQUEST");
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSetWMProtocols (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface), protocols, n);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
}
|
1999-01-17 22:58:59 +00:00
|
|
|
|
|
2020-07-24 18:40:36 +00:00
|
|
|
|
static const char *
|
2002-11-08 22:29:33 +00:00
|
|
|
|
get_default_title (void)
|
|
|
|
|
{
|
|
|
|
|
const char *title;
|
|
|
|
|
|
|
|
|
|
title = g_get_application_name ();
|
|
|
|
|
if (!title)
|
|
|
|
|
title = g_get_prgname ();
|
2007-12-28 15:51:31 +00:00
|
|
|
|
if (!title)
|
|
|
|
|
title = "";
|
2002-11-08 22:29:33 +00:00
|
|
|
|
|
|
|
|
|
return title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
check_leader_window_title (GdkDisplay *display)
|
|
|
|
|
{
|
2010-12-20 18:20:10 +00:00
|
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
2002-11-08 22:29:33 +00:00
|
|
|
|
|
2003-12-09 23:12:53 +00:00
|
|
|
|
if (display_x11->leader_window && !display_x11->leader_window_title_set)
|
2002-11-08 22:29:33 +00:00
|
|
|
|
{
|
|
|
|
|
set_wm_name (display,
|
|
|
|
|
display_x11->leader_window,
|
|
|
|
|
get_default_title ());
|
|
|
|
|
|
|
|
|
|
display_x11->leader_window_title_set = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-21 16:37:43 +00:00
|
|
|
|
static Window
|
2010-05-25 22:38:44 +00:00
|
|
|
|
create_focus_window (GdkDisplay *display,
|
|
|
|
|
XID parent)
|
2003-12-21 16:37:43 +00:00
|
|
|
|
{
|
2010-12-20 16:14:04 +00:00
|
|
|
|
GdkX11Display *display_x11;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkEventMask event_mask;
|
|
|
|
|
Display *xdisplay;
|
|
|
|
|
Window focus_window;
|
2014-01-31 19:33:27 +00:00
|
|
|
|
XSetWindowAttributes attrs;
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
2010-12-20 18:20:10 +00:00
|
|
|
|
display_x11 = GDK_X11_DISPLAY (display);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2014-01-31 16:13:29 +00:00
|
|
|
|
focus_window = XCreateWindow (xdisplay, parent,
|
|
|
|
|
-1, -1, 1, 1, 0,
|
|
|
|
|
0, /* depth */
|
|
|
|
|
InputOnly,
|
|
|
|
|
CopyFromParent,
|
2014-01-31 19:33:27 +00:00
|
|
|
|
0, &attrs);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
|
|
|
|
event_mask = (GDK_KEY_PRESS_MASK |
|
|
|
|
|
GDK_KEY_RELEASE_MASK |
|
|
|
|
|
GDK_FOCUS_CHANGE_MASK);
|
|
|
|
|
|
2010-12-15 17:25:38 +00:00
|
|
|
|
gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source,
|
|
|
|
|
focus_window,
|
|
|
|
|
event_mask, 0);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2003-12-21 16:37:43 +00:00
|
|
|
|
XMapWindow (xdisplay, focus_window);
|
|
|
|
|
|
|
|
|
|
return focus_window;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-02 20:01:27 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
ensure_sync_counter (GdkSurface *surface)
|
2004-08-02 20:01:27 +00:00
|
|
|
|
{
|
|
|
|
|
#ifdef HAVE_XSYNC
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!GDK_SURFACE_DESTROYED (surface))
|
2004-08-02 20:01:27 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkDisplay *display = GDK_SURFACE_DISPLAY (surface);
|
|
|
|
|
GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2004-08-02 20:01:27 +00:00
|
|
|
|
|
2012-09-18 13:37:03 +00:00
|
|
|
|
if (toplevel &&
|
2004-08-02 20:01:27 +00:00
|
|
|
|
toplevel->update_counter == None &&
|
2010-12-20 18:20:10 +00:00
|
|
|
|
GDK_X11_DISPLAY (display)->use_sync)
|
2004-08-02 20:01:27 +00:00
|
|
|
|
{
|
|
|
|
|
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
|
|
|
|
XSyncValue value;
|
|
|
|
|
Atom atom;
|
2012-09-18 13:31:17 +00:00
|
|
|
|
XID counters[2];
|
2004-08-02 20:01:27 +00:00
|
|
|
|
|
|
|
|
|
XSyncIntToValue (&value, 0);
|
|
|
|
|
|
|
|
|
|
toplevel->update_counter = XSyncCreateCounter (xdisplay, value);
|
2012-09-18 13:31:17 +00:00
|
|
|
|
toplevel->extended_update_counter = XSyncCreateCounter (xdisplay, value);
|
2004-08-02 20:01:27 +00:00
|
|
|
|
|
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display,
|
|
|
|
|
"_NET_WM_SYNC_REQUEST_COUNTER");
|
2012-09-18 13:31:17 +00:00
|
|
|
|
|
|
|
|
|
counters[0] = toplevel->update_counter;
|
|
|
|
|
counters[1] = toplevel->extended_update_counter;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XChangeProperty (xdisplay, GDK_SURFACE_XID (surface),
|
2004-08-02 20:01:27 +00:00
|
|
|
|
atom, XA_CARDINAL,
|
|
|
|
|
32, PropModeReplace,
|
2012-09-18 13:31:17 +00:00
|
|
|
|
(guchar *)counters, 2);
|
2004-08-02 20:01:27 +00:00
|
|
|
|
|
2012-09-18 13:31:17 +00:00
|
|
|
|
toplevel->current_counter_value = 0;
|
2004-08-02 20:01:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2003-12-21 16:37:43 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
setup_toplevel_window (GdkSurface *surface,
|
2017-11-06 00:25:22 +00:00
|
|
|
|
GdkX11Screen *x11_screen)
|
2003-12-21 16:37:43 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkDisplay *display = gdk_surface_get_display (surface);
|
|
|
|
|
Display *xdisplay = GDK_SURFACE_XDISPLAY (surface);
|
|
|
|
|
XID xid = GDK_SURFACE_XID (surface);
|
2003-12-21 16:37:43 +00:00
|
|
|
|
XSizeHints size_hints;
|
2007-05-02 00:02:14 +00:00
|
|
|
|
Window leader_window;
|
2010-08-29 00:10:02 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
set_wm_protocols (surface);
|
2010-08-29 00:10:02 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
/* The focus surface is off the visible area, and serves to receive key
|
|
|
|
|
* press events so they don't get sent to child surfaces.
|
|
|
|
|
*/
|
|
|
|
|
toplevel->focus_window = create_focus_window (display, xid);
|
|
|
|
|
_gdk_x11_display_add_window (x11_screen->display,
|
|
|
|
|
&toplevel->focus_window,
|
|
|
|
|
surface);
|
2010-12-16 04:35:15 +00:00
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
|
check_leader_window_title (x11_screen->display);
|
2010-12-16 04:35:15 +00:00
|
|
|
|
|
2003-12-21 16:37:43 +00:00
|
|
|
|
/* FIXME: Is there any point in doing this? Do any WM's pay
|
|
|
|
|
* attention to PSize, and even if they do, is this the
|
|
|
|
|
* correct value???
|
|
|
|
|
*/
|
|
|
|
|
size_hints.flags = PSize;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
size_hints.width = surface->width * impl->surface_scale;
|
|
|
|
|
size_hints.height = surface->height * impl->surface_scale;
|
2003-12-21 16:37:43 +00:00
|
|
|
|
|
|
|
|
|
XSetWMNormalHints (xdisplay, xid, &size_hints);
|
|
|
|
|
|
|
|
|
|
/* This will set WM_CLIENT_MACHINE and WM_LOCALE_NAME */
|
|
|
|
|
XSetWMProperties (xdisplay, xid, NULL, NULL, NULL, 0, NULL, NULL, NULL);
|
|
|
|
|
|
2018-05-28 16:09:47 +00:00
|
|
|
|
if (!gdk_running_in_sandbox ())
|
|
|
|
|
{
|
|
|
|
|
/* if sandboxed, we're likely in a pid namespace and would only confuse the wm with this */
|
2019-01-03 00:26:56 +00:00
|
|
|
|
long pid = getpid ();
|
2018-05-28 16:09:47 +00:00
|
|
|
|
XChangeProperty (xdisplay, xid,
|
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (x11_screen->display, "_NET_WM_PID"),
|
|
|
|
|
XA_CARDINAL, 32,
|
|
|
|
|
PropModeReplace,
|
|
|
|
|
(guchar *)&pid, 1);
|
|
|
|
|
}
|
2007-05-02 00:02:14 +00:00
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
|
leader_window = GDK_X11_DISPLAY (x11_screen->display)->leader_window;
|
2007-05-02 00:02:14 +00:00
|
|
|
|
if (!leader_window)
|
|
|
|
|
leader_window = xid;
|
2003-12-21 16:37:43 +00:00
|
|
|
|
XChangeProperty (xdisplay, xid,
|
2010-12-21 01:32:13 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (x11_screen->display, "WM_CLIENT_LEADER"),
|
2003-12-21 16:37:43 +00:00
|
|
|
|
XA_WINDOW, 32, PropModeReplace,
|
2007-05-02 00:02:14 +00:00
|
|
|
|
(guchar *) &leader_window, 1);
|
2004-04-18 14:33:07 +00:00
|
|
|
|
|
2007-04-01 03:38:34 +00:00
|
|
|
|
if (toplevel->focus_window != None)
|
|
|
|
|
XChangeProperty (xdisplay, xid,
|
2010-12-21 01:32:13 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (x11_screen->display, "_NET_WM_USER_TIME_WINDOW"),
|
2007-04-01 03:38:34 +00:00
|
|
|
|
XA_WINDOW, 32, PropModeReplace,
|
|
|
|
|
(guchar *) &toplevel->focus_window, 1);
|
|
|
|
|
|
2020-03-14 14:06:57 +00:00
|
|
|
|
if (GDK_X11_DISPLAY (x11_screen->display)->user_time != 0)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_user_time (surface, GDK_X11_DISPLAY (x11_screen->display)->user_time);
|
2004-08-02 20:01:27 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
ensure_sync_counter (surface);
|
2012-10-04 00:15:44 +00:00
|
|
|
|
|
|
|
|
|
/* Start off in a frozen state - we'll finish this when we first paint */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_begin_frame (surface, TRUE);
|
2003-12-21 16:37:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-09-18 13:37:03 +00:00
|
|
|
|
static void
|
|
|
|
|
on_frame_clock_before_paint (GdkFrameClock *clock,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface)
|
2012-09-18 13:37:03 +00:00
|
|
|
|
{
|
2019-05-19 02:53:17 +00:00
|
|
|
|
if (surface->update_freeze_count > 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_predict_presentation_time (surface);
|
|
|
|
|
gdk_x11_surface_begin_frame (surface, FALSE);
|
2012-09-18 13:37:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
on_frame_clock_after_paint (GdkFrameClock *clock,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface)
|
2012-09-18 13:37:03 +00:00
|
|
|
|
{
|
2019-05-19 02:53:17 +00:00
|
|
|
|
if (surface->update_freeze_count > 0)
|
|
|
|
|
return;
|
2012-11-14 17:49:06 +00:00
|
|
|
|
|
2019-05-19 02:53:17 +00:00
|
|
|
|
gdk_x11_surface_end_frame (surface);
|
2012-09-18 13:37:03 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-30 20:09:44 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
connect_frame_clock (GdkSurface *surface)
|
2013-01-30 20:09:44 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2013-01-30 20:09:44 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (!impl->frame_clock_connected)
|
2013-01-30 20:09:44 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkFrameClock *frame_clock = gdk_surface_get_frame_clock (surface);
|
2013-01-30 20:09:44 +00:00
|
|
|
|
|
|
|
|
|
g_signal_connect (frame_clock, "before-paint",
|
2018-03-20 14:14:10 +00:00
|
|
|
|
G_CALLBACK (on_frame_clock_before_paint), surface);
|
2013-01-30 20:09:44 +00:00
|
|
|
|
g_signal_connect (frame_clock, "after-paint",
|
2018-03-20 14:14:10 +00:00
|
|
|
|
G_CALLBACK (on_frame_clock_after_paint), surface);
|
2013-01-30 20:09:44 +00:00
|
|
|
|
|
|
|
|
|
impl->frame_clock_connected = TRUE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-24 01:55:57 +00:00
|
|
|
|
static void
|
|
|
|
|
disconnect_frame_clock (GdkSurface *surface)
|
|
|
|
|
{
|
|
|
|
|
GdkX11Surface *impl;
|
|
|
|
|
|
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
|
|
|
|
if (impl->frame_clock_connected)
|
|
|
|
|
{
|
|
|
|
|
GdkFrameClock *frame_clock = gdk_surface_get_frame_clock (surface);
|
|
|
|
|
|
|
|
|
|
g_signal_handlers_disconnect_by_func (frame_clock,
|
|
|
|
|
on_frame_clock_before_paint, surface);
|
|
|
|
|
g_signal_handlers_disconnect_by_func (frame_clock,
|
|
|
|
|
on_frame_clock_after_paint, surface);
|
|
|
|
|
|
|
|
|
|
impl->frame_clock_connected = FALSE;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-14 01:38:44 +00:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_NORMAL,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_DIALOG,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_MENU, /* Torn off menu */
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_TOOLBAR,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_SPLASHSCREEN,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_UTILITY,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_DOCK,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_DESKTOP,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU, /* A drop down menu (from a menubar) */
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_POPUP_MENU, /* A popup menu (from right-click) */
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_TOOLTIP,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_NOTIFICATION,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_COMBO,
|
|
|
|
|
GDK_SURFACE_TYPE_HINT_DND
|
|
|
|
|
} GdkSurfaceTypeHint;
|
|
|
|
|
|
2020-03-07 17:07:53 +00:00
|
|
|
|
static void gdk_x11_surface_set_title (GdkSurface *surface,
|
|
|
|
|
const char *title);
|
|
|
|
|
static void gdk_x11_surface_set_type_hint (GdkSurface *surface,
|
|
|
|
|
GdkSurfaceTypeHint hint);
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurface *
|
|
|
|
|
_gdk_x11_display_create_surface (GdkDisplay *display,
|
|
|
|
|
GdkSurfaceType surface_type,
|
|
|
|
|
GdkSurface *parent,
|
|
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurface *surface;
|
|
|
|
|
GdkFrameClock *frame_clock;
|
|
|
|
|
GdkX11Surface *impl;
|
2010-12-21 01:32:13 +00:00
|
|
|
|
GdkX11Screen *x11_screen;
|
2010-12-20 16:14:04 +00:00
|
|
|
|
GdkX11Display *display_x11;
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
Window xparent;
|
|
|
|
|
Visual *xvisual;
|
2001-04-18 17:57:36 +00:00
|
|
|
|
Display *xdisplay;
|
1999-11-08 20:14:59 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
XSetWindowAttributes xattributes;
|
|
|
|
|
long xattributes_mask;
|
|
|
|
|
XClassHint *class_hint;
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
unsigned int class;
|
2016-10-27 14:24:42 +00:00
|
|
|
|
int depth;
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2017-11-06 00:25:22 +00:00
|
|
|
|
int abs_x;
|
|
|
|
|
int abs_y;
|
|
|
|
|
|
2010-12-20 18:20:10 +00:00
|
|
|
|
display_x11 = GDK_X11_DISPLAY (display);
|
2017-11-01 22:06:24 +00:00
|
|
|
|
x11_screen = GDK_X11_SCREEN (display_x11->screen);
|
2019-04-22 13:16:55 +00:00
|
|
|
|
xparent = GDK_SCREEN_XROOTWIN (x11_screen);
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2019-05-05 22:59:51 +00:00
|
|
|
|
if (parent)
|
|
|
|
|
frame_clock = g_object_ref (gdk_surface_get_frame_clock (parent));
|
|
|
|
|
else
|
|
|
|
|
frame_clock = _gdk_frame_clock_idle_new ();
|
2019-04-22 01:14:46 +00:00
|
|
|
|
|
2020-03-07 21:59:24 +00:00
|
|
|
|
switch (surface_type)
|
|
|
|
|
{
|
|
|
|
|
case GDK_SURFACE_TOPLEVEL:
|
|
|
|
|
surface = g_object_new (GDK_TYPE_X11_TOPLEVEL,
|
|
|
|
|
"display", display,
|
|
|
|
|
"frame-clock", frame_clock,
|
|
|
|
|
NULL);
|
|
|
|
|
break;
|
|
|
|
|
case GDK_SURFACE_POPUP:
|
|
|
|
|
surface = g_object_new (GDK_TYPE_X11_POPUP,
|
|
|
|
|
"parent", parent,
|
|
|
|
|
"display", display,
|
|
|
|
|
"frame-clock", frame_clock,
|
|
|
|
|
NULL);
|
|
|
|
|
break;
|
|
|
|
|
case GDK_SURFACE_TEMP:
|
|
|
|
|
surface = g_object_new (GDK_TYPE_X11_DRAG_SURFACE,
|
|
|
|
|
"display", display,
|
|
|
|
|
"frame-clock", frame_clock,
|
|
|
|
|
NULL);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
g_assert_not_reached ();
|
|
|
|
|
break;
|
|
|
|
|
}
|
2019-04-22 01:14:46 +00:00
|
|
|
|
|
|
|
|
|
g_object_unref (frame_clock);
|
|
|
|
|
|
|
|
|
|
surface->x = x;
|
|
|
|
|
surface->y = y;
|
|
|
|
|
surface->width = width;
|
|
|
|
|
surface->height = height;
|
|
|
|
|
|
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2018-03-20 11:05:26 +00:00
|
|
|
|
impl->surface_scale = x11_screen->surface_scale;
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2010-12-21 01:32:13 +00:00
|
|
|
|
xdisplay = x11_screen->xdisplay;
|
2001-10-24 14:15:50 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
xattributes_mask = 0;
|
2006-05-25 05:30:14 +00:00
|
|
|
|
|
2016-11-03 21:40:36 +00:00
|
|
|
|
xvisual = gdk_x11_display_get_window_visual (display_x11);
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2016-11-04 02:35:49 +00:00
|
|
|
|
impl->override_redirect = FALSE;
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
class = InputOutput;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
xattributes.background_pixmap = None;
|
|
|
|
|
xattributes_mask |= CWBackPixmap;
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
xattributes.border_pixel = BlackPixel (xdisplay, x11_screen->screen_num);
|
|
|
|
|
xattributes_mask |= CWBorderPixel;
|
2014-10-13 09:15:41 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
xattributes.bit_gravity = NorthWestGravity;
|
|
|
|
|
xattributes_mask |= CWBitGravity;
|
2001-07-05 02:58:34 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
xattributes.colormap = gdk_x11_display_get_window_colormap (display_x11);
|
|
|
|
|
xattributes_mask |= CWColormap;
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2020-03-09 15:00:51 +00:00
|
|
|
|
if (surface_type == GDK_SURFACE_TEMP ||
|
|
|
|
|
surface_type == GDK_SURFACE_POPUP)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-21 16:06:11 +00:00
|
|
|
|
xattributes.save_under = True;
|
|
|
|
|
xattributes.override_redirect = True;
|
|
|
|
|
xattributes.cursor = None;
|
|
|
|
|
xattributes_mask |= CWSaveUnder | CWOverrideRedirect;
|
2016-11-06 14:43:06 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
impl->override_redirect = TRUE;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
1999-11-08 20:14:59 +00:00
|
|
|
|
|
2019-04-21 16:06:11 +00:00
|
|
|
|
depth = gdk_x11_display_get_window_depth (display_x11);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->width * impl->surface_scale > 32767 ||
|
|
|
|
|
surface->height * impl->surface_scale > 32767)
|
2009-01-22 13:10:19 +00:00
|
|
|
|
{
|
2013-07-30 00:51:39 +00:00
|
|
|
|
g_warning ("Native Windows wider or taller than 32767 pixels are not supported");
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->width * impl->surface_scale > 32767)
|
|
|
|
|
surface->width = 32767 / impl->surface_scale;
|
|
|
|
|
if (surface->height * impl->surface_scale > 32767)
|
|
|
|
|
surface->height = 32767 / impl->surface_scale;
|
2009-01-22 13:10:19 +00:00
|
|
|
|
}
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
impl->unscaled_width = surface->width * impl->surface_scale;
|
|
|
|
|
impl->unscaled_height = surface->height * impl->surface_scale;
|
2014-11-06 22:17:45 +00:00
|
|
|
|
|
2019-03-23 13:12:10 +00:00
|
|
|
|
abs_x = 0;
|
|
|
|
|
abs_y = 0;
|
2017-11-06 00:25:22 +00:00
|
|
|
|
|
2010-10-06 00:15:51 +00:00
|
|
|
|
impl->xid = XCreateWindow (xdisplay, xparent,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
(surface->x + abs_x) * impl->surface_scale,
|
|
|
|
|
(surface->y + abs_y) * impl->surface_scale,
|
2020-07-30 21:06:59 +00:00
|
|
|
|
MAX (1, surface->width * impl->surface_scale),
|
|
|
|
|
MAX (1, surface->height * impl->surface_scale),
|
2016-10-27 14:24:42 +00:00
|
|
|
|
0, depth, class, xvisual,
|
2010-10-06 00:15:51 +00:00
|
|
|
|
xattributes_mask, &xattributes);
|
Make this compile without framebuffer enabled
2000-06-20 Havoc Pennington <hp@redhat.com>
* modules/linux-fb/Makefile.am: Make this compile
without framebuffer enabled
* gdk/linux-fb/Makefile.am: Add conditional to not build
framebuffer unless specified in configure
* gdk/gdkdraw.c (gdk_draw_drawable): Fix bug where I was getting
the size of the target instead of source if -1 was passed for
width/height
* gdk/x11/gdkgeometry-x11.c (gdk_window_compute_position): Fix
width/height confusion.
2000-06-19 Havoc Pennington <hp@redhat.com>
* gdk/x11/gdkx.h (GDK_WINDOW_XWINDOW): change this to be
GDK_DRAWABLE_XID. In the future, we probably want to make it
faster with G_DISABLE_CHECKS turned on.
2000-06-14 Havoc Pennington <hp@redhat.com>
* gdk/Makefile.am: add gdkpixmap.c
* gdk/gdk.c: s/gdk_window_init/_gdk_windowing_window_init/
s/gdk_image_init/_gdk_windowing_image_init
* gdk/gdkcolor.c: make ref/unref compat wrappers for GObject
ref/unref
* gdk/gdkcolor.h: make GdkColormap a GObject subclass
* gdk/gdkcompat.h: remove GdkWindowType compat, since
GdkWindowType is now non-deprecated;
change gdk_window_get_type() compat to be
gdk_window_get_window_type().
* gdk/gdkdnd.h: make GdkDragContext a GObject.
* gdk/gdkdraw.c, gdk/gdkdraw.h: Convert GdkDrawable to a pure
virtual GObject. Make all functions call into the vtable.
Move gdk_image_put() guts in here. Remove GdkDrawableType
and gdk_drawable_get_type(), these are now GdkWindow-specific.
draw_image, get_depth, get_size, set_colormap, get_colormap,
get_visual added to the vtable.
* gdk/gdkgc.h, gdk/gdkgc.c: Convert GdkGC to a pure virtual
GObject. Virtualize everything.
(gdk_gc_new_with_values): remove check for destroyed window,
because now GdkWindow::create_gc will check this.
(gdk_gc_set_values): New function to set GC values, this
was already implemented but wasn't in the header
* gdk/gdkimage.h, gdk/gdkimage.c: Convert GdkImage to a GObject.
* gdk/gdkinternals.h: Remove _gdk_window_alloc(), remove
_gdk_window_draw_image(), remove _gdk_windowing_window_class,
remove _gdk_window_class; add _gdk_window_impl_get_type() and
_gdk_pixmap_impl_get_type(). Rename gdk_window_init to
_gdk_windowing_window_init, rename gdk_image_init to
_gdk_windowing_image_init.
* gdk/gdkpango.c: Reflect GObject-ification of PangoContext.
(gdk_draw_layout): Remove check for destroyed window,
because all the drawable methods already check it.
* gdk/gdkpixmap.h, gdk/gdkpixmap.c: Convert GdkPixmap to GObject.
Add gdkpixmap.c which contains implementation of GdkDrawable
virtual table (by chaining to a platform-specific implementation
object).
* gdk/gdkprivate.h: Remove GDK_IS_WINDOW, GDK_IS_PIXMAP,
GDK_DRAWABLE_DESTROYED. Add GDK_WINDOW_DESTROYED. Replace
GDK_DRAWABLE_TYPE with GDK_WINDOW_TYPE. Remove GdkDrawablePrivate,
GdkWindowPrivate, GdkImageClass, GdkImagePrivate, GdkGCPrivate,
GdkColormapPrivate.
* gdk/gdktypes.h: #include <glib-object.h>
* gdk/gdkwindow.h, gdk/gdkwindow.c: Convert GdkWindow to GObject.
Move most functionality to platform-specific implementation
object. GdkWindow itself now handles the backing store, then
chains to the platform-specific implementation.
(gdk_window_get_window_type): return GdkWindowType of the window.
(gdk_window_peek_children): New routine, returns the children of
a GdkWindow
(gdk_window_get_children): Was in X11-specific code and did
XQueryTree. Changed to simply return a copy of window->children;
so it can go in cross-platform code.
* gdk/x11/Makefile.am: fix broken MKINSTALLDIRS path
* gdk/x11/gdkcolor-x11.c: implement X-specific parts of
GdkColormap; just changed to use the new private data instead
of casting to GdkColormapPrivate.
* gdk/x11/gdkcursor-x11.c: added a couple typechecks to
gdk_cursor_new().
* gdk/x11/gdkdnd-x11.c: Change the way we access private fields
(private data member in the GObject).
(xdnd_manager_source_filter): Function had broken
error handling, fix it (use gdk_error_trap_push).
* gdk/x11/gdkdrawable-x11.c: This file now implements
a base class for GdkWindowImplX11/GdkPixmapImplX11. This
base class is purely for the convenience of the X port,
and not part of the interface to cross-platform GDK.
* gdk/x11/gdkevents-x11.c: Reflect various renamings.
* gdk/x11/gdkgc-x11.c: Implement a subclass of GdkGC that's
specific to X, and returned by the create_gc virtual method
of GdkDrawableImplX11.
(gdk_x11_gc_set_dashes): Change this to take an array of gint8
rather than gchar, this was also changed in the GdkGC vtable.
(gdk_x11_gc_values_to_xvalues): If GdkGCValues is NULL, or the
mask is 0, return immediately, instead of checking every flag.
This is faster, and keeps us from segfaulting if values is NULL
and the mask contains some nonzero flags.
* gdk/x11/gdkgeometry-x11.c: deal with all the rearranging of
GdkWindow.
* gdk/x11/gdkglobals-x11.c: change type of grab window, since
GdkWindowPrivate is gone.
* gdk/x11/gdkim-x11.c: rename things that got renamed.
* gdk/x11/gdkimage-x11.c: implement in terms of GObject, and
remove the image_put stuff that got transferred to GdkDrawable.
* gdk/x11/gdkinput.c: renamings
* gdk/x11/gdkmain-x11.c: #include <pango/pangox.h>
* gdk/x11/gdkpixmap-x11.c: GObject conversion
* gdk/x11/gdkprivate-x11.h: indentation fixes
* gdk/x11/gdkproperty-x11.c: renamings
* gdk/x11/gdkselection-x11.c: renamings
* gdk/x11/gdkwindow-x11.c: Restructuring and renaming; this now
implements the platform-specific "impl" object.
Moved gdk_window_get_children to gdk/gdkwindow.c
* gdk/x11/gdkx.h: Remove all the private structs and private datas
that no longer exist. Add declaration of GdkGCX11 object here.
Fix all the macros to still work.
* gtk/gtk-boxed.defs: Remove GtkStyle, GdkColormap, GdkWindow,
GdkDragContext from the boxed types since they are now GObjects.
* gtk/gtkstyle.h, gtk/gtkstyle.c: Converted GtkStyle to a GObject,
moved xthickness/ythickness into the instance. GtkStyleClass
functions are now in the standard vtable for GtkStyle, so you have
to create a GObject subclass to write a theme engine.
(gtk_style_copy): fixed a leaked PangoFontDescription
(gtk_style_init): renamed gtk_style_realize, so gtk_style_init
can be the standard GObject function.
* Throughout GTK:
s/style->klass->[xy]thickness/style->[xy]thickness
s/pango_layout_unref/g_object_unref/
* gtk/gtkrc.h, gtk/gtkrc.c: Converted GtkRcStyle to a GObject.
* gtk/gtksocket.c: Use gdk_window_get_user_data() instead of
accessing GDK internals.
* gtk/gtkwidget.c: Use gdk_window_peek_children() instead of
accessing GDK internals.
2000-06-20 21:04:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_object_ref (surface);
|
|
|
|
|
_gdk_x11_display_add_window (x11_screen->display, &impl->xid, surface);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2020-03-07 17:07:53 +00:00
|
|
|
|
gdk_x11_surface_set_title (surface, get_default_title ());
|
2020-03-09 15:00:51 +00:00
|
|
|
|
if (surface_type == GDK_SURFACE_TOPLEVEL)
|
2020-03-07 17:07:53 +00:00
|
|
|
|
gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_NORMAL);
|
2020-03-09 15:00:51 +00:00
|
|
|
|
else if (surface_type == GDK_SURFACE_POPUP)
|
2020-03-07 17:07:53 +00:00
|
|
|
|
gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_MENU);
|
2010-12-16 00:07:36 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
class_hint = XAllocClassHint ();
|
|
|
|
|
class_hint->res_name = (char *) g_get_prgname ();
|
|
|
|
|
class_hint->res_class = (char *) display_x11->program_class;
|
|
|
|
|
XSetClassHint (xdisplay, impl->xid, class_hint);
|
|
|
|
|
XFree (class_hint);
|
2003-12-21 16:37:43 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
setup_toplevel_window (surface, x11_screen);
|
2001-04-18 17:57:36 +00:00
|
|
|
|
|
2010-12-15 17:25:38 +00:00
|
|
|
|
gdk_x11_event_source_select_events ((GdkEventSource *) display_x11->event_source,
|
2018-06-14 02:13:59 +00:00
|
|
|
|
GDK_SURFACE_XID (surface), GDK_ALL_EVENTS_MASK,
|
2010-12-15 17:25:38 +00:00
|
|
|
|
StructureNotifyMask | PropertyChangeMask);
|
2012-10-03 23:42:13 +00:00
|
|
|
|
|
2020-02-22 14:56:36 +00:00
|
|
|
|
_gdk_x11_surface_register_dnd (surface);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
connect_frame_clock (surface);
|
2012-10-04 00:13:42 +00:00
|
|
|
|
|
2019-05-19 02:53:17 +00:00
|
|
|
|
gdk_surface_freeze_updates (surface);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
|
|
|
|
|
return surface;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-05 02:34:52 +00:00
|
|
|
|
static void
|
2004-07-11 13:26:57 +00:00
|
|
|
|
gdk_toplevel_x11_free_contents (GdkDisplay *display,
|
|
|
|
|
GdkToplevelX11 *toplevel)
|
2003-07-05 02:34:52 +00:00
|
|
|
|
{
|
|
|
|
|
if (toplevel->icon_pixmap)
|
|
|
|
|
{
|
2010-08-27 10:08:30 +00:00
|
|
|
|
cairo_surface_destroy (toplevel->icon_pixmap);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
toplevel->icon_pixmap = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (toplevel->icon_mask)
|
|
|
|
|
{
|
2010-08-27 10:08:30 +00:00
|
|
|
|
cairo_surface_destroy (toplevel->icon_mask);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
toplevel->icon_mask = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (toplevel->group_leader)
|
|
|
|
|
{
|
|
|
|
|
g_object_unref (toplevel->group_leader);
|
|
|
|
|
toplevel->group_leader = NULL;
|
|
|
|
|
}
|
2004-07-12 05:57:41 +00:00
|
|
|
|
#ifdef HAVE_XSYNC
|
2004-07-11 13:26:57 +00:00
|
|
|
|
if (toplevel->update_counter != None)
|
|
|
|
|
{
|
|
|
|
|
XSyncDestroyCounter (GDK_DISPLAY_XDISPLAY (display),
|
|
|
|
|
toplevel->update_counter);
|
2016-01-05 23:36:21 +00:00
|
|
|
|
XSyncDestroyCounter (GDK_DISPLAY_XDISPLAY (display),
|
|
|
|
|
toplevel->extended_update_counter);
|
2004-07-11 13:26:57 +00:00
|
|
|
|
toplevel->update_counter = None;
|
2016-01-05 23:36:21 +00:00
|
|
|
|
toplevel->extended_update_counter = None;
|
2004-07-11 13:26:57 +00:00
|
|
|
|
|
2012-09-18 13:31:17 +00:00
|
|
|
|
toplevel->current_counter_value = 0;
|
2004-07-11 13:26:57 +00:00
|
|
|
|
}
|
2004-07-12 05:57:41 +00:00
|
|
|
|
#endif
|
2003-07-05 02:34:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-12-15 14:04:44 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_destroy (GdkSurface *surface,
|
2019-03-24 20:24:30 +00:00
|
|
|
|
gboolean foreign_destroy)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
2010-12-15 06:39:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
Remove g_convert (moved to glib) and now useless utf_to_latin1()
Thu Sep 14 12:21:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktexttypes.[ch]: Remove g_convert (moved to
glib) and now useless utf_to_latin1() latin1_to_utf()
* gtk/gtktextview.[ch]: Change ::move_insert and
::delete_text action signals to ::move and ::delete;
create the signals with the right enumeration type,
not GTK_TYPE_ENUM so that bindings work. Add C-d, M-d,
C-v bindings, change Home, End to move to beginning/end
of line, Add C-Home C-End to move to beginning/end
of buffer. Change ::cut_text to ::cut_clipboard, etc;
combine ::scroll_text into ::move; use new GtkSelectionData
functions to simplify DND text handling.
* gtk/gtkenums.h gtk/gtktextview.h: Move movement,
deletion enumerations here, rename enumeration values to
be consistently plural.
* gtk/gtktextbuffer.c: Use new clipboard interfaces
for cut/copy/paste and primary selection.
* gtk/gtktextbuffer.[ch]: Remove excess time and
'interactive' arguments from cut/copy/paste;
rename cut to cut_clipboard, etc; remove
gtk_text_buffer_get_clipboard_contents().
* gtk/gtktextlayout.[ch]: Add
gtk_text_layout_move_iter_to_line_end() to move the iter to
line ends.
* gtk/gtkselection.[ch] (gtk_selection_data_set/get_text):
Functions to set or get a UTF-8 string on the selection
data.
* gtk/gtkclipboard.[ch]: New, simplified selection handling
interfaces.
* gtk/gtkinvisible.c (gtk_invisible_new): Realize newly
created widgets - one of these is useless if we don't.
* gtk/gtkselection.[ch] (gtk_selection_clear_targets): Export
a public function clear all targets registered for the
widget.
* gtk/gtkselection.c (gtk_selection_owner_set) docs/Changes-2.0.txt:
Never call gtk_widget_realize() - that was just asking
for bizarre side-effects.
* gtk/gtkselection.c (gtk_selection_owner_set): Call
gdk_selection_owner_set even if the widget is the
same so that we reliably update the timestamp on
the server.
* gdk/x11/gdkevents-x11.c gdk/x11/gdkx.h: Add a
gdk_x11_get_server_time() function.
* gdk/x11/gdkevents-x11.c gdk/x11/gdkprivate-x11.h
gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.h:
Add some tricky filtering on serial numbers for
selection clear events to fix up long-standard
race condition FIXME's in gtkselection.c.
* gdk/gdkproperty.h gdk/x11/gdkselection-x11.h: Add
routines to convert from utf8 to compound text or
STRING and from a text property to UTF-8.
* gtk/gtkmain.[ch] (gtk_get_current_event_time): Add
a convenience function gdk_get_current_event_time().
* gtk/gtkselection.c (gtk_selection_data_copy/free): Copy
and free selection_data->data properly
2000-09-14 16:41:20 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
if (toplevel)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_toplevel_x11_free_contents (GDK_SURFACE_DISPLAY (surface), toplevel);
|
2003-07-05 01:54:05 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
unhook_surface_changed (surface);
|
2019-05-24 01:55:57 +00:00
|
|
|
|
disconnect_frame_clock (surface);
|
2016-01-08 18:48:10 +00:00
|
|
|
|
|
2010-10-06 01:49:04 +00:00
|
|
|
|
if (impl->cairo_surface)
|
|
|
|
|
{
|
|
|
|
|
cairo_surface_finish (impl->cairo_surface);
|
2014-10-30 09:30:33 +00:00
|
|
|
|
cairo_surface_destroy (impl->cairo_surface);
|
|
|
|
|
impl->cairo_surface = NULL;
|
2010-10-06 01:49:04 +00:00
|
|
|
|
}
|
2001-11-05 17:48:58 +00:00
|
|
|
|
|
2019-03-24 20:24:30 +00:00
|
|
|
|
if (!foreign_destroy)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XDestroyWindow (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-05-15 16:09:53 +00:00
|
|
|
|
/* This function is called when the XWindow is really gone.
|
|
|
|
|
*/
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_destroy_notify (GdkSurface *surface)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *surface_impl;
|
2001-04-18 17:57:36 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
surface_impl = GDK_X11_SURFACE (surface);
|
2001-04-18 17:57:36 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!GDK_SURFACE_DESTROYED (surface))
|
1998-03-14 05:15:16 +00:00
|
|
|
|
{
|
2018-06-25 22:47:40 +00:00
|
|
|
|
g_warning ("GdkSurface %#lx unexpectedly destroyed", GDK_SURFACE_XID (surface));
|
[ Merges from gtk-1-2 ]
Wed Sep 8 07:13:29 1999 Tim Janik <timj@gtk.org>
* configure.in: fixed "GNU Make" check to pass with new make version
3.77.95.
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.@GTK_MICRO_VERSION@, so the
AM_PATH_GTK() macros don't get confused by the -pre1.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (REBUILD): Change check for perl5
to check explicitely for v >= 5.002. (5.001
does not work with our scripts.)
Wed Aug 25 15:45:46 1999 Tim Janik <timj@gtk.org>
* configure.in: evaluate $PERL for the perl version check. added
--disable-rebuilds to give the user an option to completely disable
any source autogeneration rules.
Mon Aug 23 23:16:14 1999 Tim Janik <timj@gtk.org>
* configure.in: evaluate $ac_make when checking for GNU Make.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* docs/Makefile.am: added generation.txt.
* Makefile.am: require automake 1.4, build README from README.in and
INSTALL from INSTALL.in in dist-hook.
* README.in:
* INSTALL.in: new files to autogenerate README and INSTALL from.
* configure.in: figure whether we have GNU Make
* docs/generation.txt: minor additions/corrections.
Wed Aug 11 13:38:26 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update
July 30, 1999 Elliot Lee <sopwith@redhat.com>
* configure.in: Fix autoconf warnings about cross compilation by
trying to provide sane defaults for AC_TRY_RUN.
Fri Jul 16 22:20:21 PDT 1999 Manish Singh <yosh@gimp.org>
* ltconfig
* ltmain.sh: upgrade to libtool 1.3.3
Thu Jul 8 11:30:18 1999 Owen Taylor <otaylor@redhat.com>
* INSTALL: Indicate that the --with-glib= configure
time flag is unsupported.
Mon Jul 5 20:36:03 1999 Owen Taylor <otaylor@redhat.com>
* docs/generation.txt: Added a file that gives
documenation about the autogeneration process for
various autogenerated files.
Tue Jun 29 15:59:25 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Look for libgmodule in the
right location.
Thu Jun 17 13:57:31 1999 Owen Taylor <otaylor@redhat.com>
* docs/gtk_tut.sgml: Removed references to
code examples in my directory on gtk.org as
they should all be in the tutorial now.
* docs/gtk_tut.sgml: Added sources for dial-test
and scribble-xinput programs that were previously
missing.
Fri Jun 4 00:08:59 1999 Owen Taylor <otaylor@redhat.com>
* TODO: Added entry about menu keyboard navigation, removed
some finished items.
Mon May 31 00:11:24 1999 Owen Taylor <otaylor@redhat.com>
* acinclude.m4: Standardize on func_dgettext
not func_gettext, so that the checks for dgettext
actually are paid attention to.
Wed May 5 10:47:54 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Add $INTLLIBS into $LIBS
directly, rather than repeating the checks for
gettext.
* INSTALL: Added information about gettext and
NLS support.
* acinclude.m4 (LIBM): Check for dgettext, not
just gettext. This should hopefully fix things wrt
systems with old versions of GNU gettext installed.
Tue Jun 29 15:59:25 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Look for libgmodule in the
right location.
Thu Apr 1 16:58:10 PST 1999 Manish Singh <yosh@gimp.org>
* autogen.sh: add --enable-maintainer-mode
* configure.in: set ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
Wed Mar 24 23:03:49 CST 1999 Shawn T. Amundson <amundson@gtk.org>
* docs/gtk-config.1.in:
docs/Makefile.am:
configure.in: gtk-config is now generated.
* docs/gtk-config.1: Removed, now generated.
Thu Sep 23 17:59:59 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): grr, even if Gdk doesn't
handle CreateNotify itself, still put out a debuging message for
--gdk-debug=events. made the ReparentNotify debugging message more
verbose.
wrap xcoords translation for ConfigureEvents into an error trap,
a destroy event may already be pending, and in that case, the
actuall coordinate values are not at all critical.
Sat Sep 18 22:24:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcc.c: Stop leaking the color_hash all over
the place. Simplify and improve the logic.
Fri Sep 17 09:57:15 1999 Tim Janik <timj@gtk.org>
* gdk/gdk.h, gdk/gdkcolor.c: make return types (gint or gboolean)
for prototypes and function implementations consistent (reported
by Tomas Ogren).
Tue Sep 14 18:23:01 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): tell if expose events have
send_event set in debugging output.
(gdk_compress_exposures): default initialize the event so we don't
operate on bogus values (namely send_event).
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
Sun Sep 5 08:10:53 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.c (gdk_font_hash_insert): Add
name => font and name => fontset hashes. The
name => fontset hash is a _big_ win since we
weren't previously caching fontsets at all and loading
fontsets is expensive. The name => font hash
is less of a win, but it does save us from doing
repeated XQueryFont calls on the same font.
* gdk/gdkprivate.h (struct _GdkFontPrivate): Add a names
list so we can remove font/fontset from hash.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Remove useless
and slightly confusing test. [ XInternAtom (,,TRUE)
will never return None ].
Sat Sep 4 08:39:26 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints)
gdk/gdkwindow.c (gdk_window_set_hints):
Don't omit setting the properties if flags == 0 -
there may be an existing set of properties there
already. (Very old bug. Would it be better to
delete the property instead?)
* gdk/gdkselection.c (gdk_selection_property_get): Fix
spelling error in comment.
Wed Sep 1 14:05:30 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Use gdk_error_trap_push()
to avoid stomping over gdk_error_warnings.
* gdk/gdkimage.c (gdk_image_new): compute image->bpp
as (bits_per_pixel + 7) / 8. This gives the same
result as before for multiples of 8, but actually
a "reasonable" value for 1bit or 4bit displays.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* gdk/Makefile.am: minor cleanups, strip spaces on build rules for
GNU Make.
Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): give a debugging note when
discarding configure events.
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gdk/gdkpixmap.c (gdk_pixmap_unref): g_return_if_fail() the
refcount is greater than zero.
* gdk/gdkwindow.c (gdk_window_unref): Likewise.
* gdk/gdkfont.c (gdk_font_unref): Likewise.
* gdk/gdkgc.c (gdk_gc_unref): Likewise.
* gdk/gdkdnd.c (gdk_drag_context_unref): Likewise.
Wed Aug 11 01:04:57 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Fix assumption
that format 32 => sizeof(item) == 4. It really is
sizeof(long).
Tue Jun 29 23:02:42 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_x_error / gdk_x_io_error): Don't
core dump at all on X IO errors, only core dump
if --enable-debug for X errors.
Thu Jun 24 17:06:23 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): removed old ""Got event for
unknown window:" message. disabled ConfigureNotify discarding code,
because it led to events being processed out of order.
Thu Jun 24 12:22:02 1999 Tim Janik <timj@gtk.org>
* gdk/gdkglobals.c: preinitialize gdk_error_code to 0.
* gdk/gdkevents.c (gdk_event_send_client_message_to_all_recurse): since
we export this function, supress error warnings and don't reset the
error code in the first half of this function.
* gdk/gdk.c (gdk_x_error): set gdk_error_code to the actuall X error
code (instead of just -1) so gdk_error_trap_pop() reveals something
actually informative about the error that happened.
* gdk/*.c:
don't rely on gdk_error_code being -1 if an error occoured, but just
gdk_error_code != 0.
Thu Jun 24 11:50:07 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_apply_filters): advance the filter list
pointer *before* invoking the filter function, so we at least don't
crash if a filter is removed that is currently executed. window filters
*really* need to be made truely reentrant at some point.
Mon Jun 14 11:10:15 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): print the atom name in the
PropertyNotify debug messages.
Wed May 5 22:51:06 1999 Owen Taylor <otaylor@redhat.com>
Patch from Sung-Hyun Nam <namsh@lgic.co.kr>
* gdk/gdkim.c: Fix cut-and-paste errors for
x/y and PreeditAttributes/StatusAttributes.
Wed May 5 22:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints): Change
G_MAXINT to 2^16 to alleviate overflow problems in
various window managers.
Wed Apr 21 00:42:08 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.c (gdk_text_measure): Fix the return value
for fontsets.
Wed May 5 12:42:01 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints):
Initialize size_hints.x and size_hints.y because kwm
brokenly pays attention to them.
(Bug #1181 - Lars Heete <hel@admin.de>)
Wed May 5 11:38:56 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_choose_visual): Free the
return value of gdk_list_visuals().
(Bug #1193 - Morten Welinder <terra@diku.dk>)
Tue May 4 11:12:56 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkim.c (gdk_im_real_open): cast the return value of
XSetIMValues to (void *) when comparing to NULL, to workaround
the problem of some compilers barfing since older X headers don't
have the prototype for it.
Mon Apr 19 10:11:12 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcolor.c (gdk_colormap_new): Fix memory leak
for pseudocolor where colormap->colors was double
allocated.
* gdk/gdkcolor.c (gdk_colormap_alloc1): Store the
color value in the hash table with the pixel filled
in so when we do later hash table lookups, the color
value is correct.
Sun May 2 15:29:45 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkdraw.c (gdk_draw_lines): check private->destroyed before
making the call
Tue Apr 27 11:17:35 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (xdnd_set_{targets,actions}): Fix leak
pointed out by Morten Welinder <terra@diku.dk>.
Wed Apr 21 14:20:22 1999 George Lebl <jirka@5z.com>
* gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the
default filter from the list
Wed Apr 21 14:20:22 1999 George Lebl <jirka@5z.com>
* gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the
default filter from the list
Fri Apr 16 20:41:43 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c: #include "gdkkeysyms.h" for gdk_XConvertCase #defines
* gtk/gtkfontsel.c (gtk_font_selection_create_xlfd): use
g_strdup_printf instead of calcing the length separately
Tue Apr 13 02:49:33 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: removed some silly #ifdef HAVE_CONFIG
that we don't do in many other places. (Fixing duplicate
#include of config.h)
* gdk/gdkevents.c: include gdkinput.h _after_ config.h.
Otherwise, #ifndef XINPUT_NONE check in the latter
doesn't work. (Bug #546)
Sun Apr 11 14:38:03 1999 Tim Janik <timj@gtk.org>
* gdk/gdkpixmap.c (_gdk_pixmap_create_from_xpm): check for color
"None" case insensitive.
Tue Apr 6 16:38:51 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkselection.c:
Add error traps so if the other end of the connection
dies, we survive.
Tue Apr 6 12:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (gdk_drag_motion): Separate out the
dest_xid field into two fields - one for the window
to send in messages, one to indicate the last looked
up window for caching purposes. This is needed, so
that Leave messages get the correct window.
Mon Apr 5 13:21:30 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_check, gdk_event_prepare):
Fix warning created by people mucking around
with the gsource API.
* gdk/gdkevents.c (gdk_io_invoke, gdk_input_add_full):
Change mapping between GIOCondition and GdkInputCondition
to match the way the Linux kernel does it. This should
fix problems where closed pipes were no longer signalling
GDK_INPUT_READ on systems with a native poll().
Mon Apr 5 17:11:57 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.c (_gdk_pixmap_create_from_xpm): Check
explicitly for the string "None" - it is in the XPM
spec and some servers treat unknown colors in odd ways
(like asking the user!)
Thu Apr 1 16:58:10 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkevents.c: made "->" into a "." of previous change so
it compiles
Thu Apr 1 18:41:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_compress_exposures): Set the
window field of the event structure before calling
user filters.
1999-03-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdk/gdk.c (gdk_init_check): Use False as the last argument to
XInternAtom() here. This is a particularly Old And Nasty(tm) bug.
Mon Mar 29 17:31:52 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkim.c (gdk_mbstowcs): Free the value of the
intermediate text property - prevents major memory
leak when gdk_use_mb.
gtk-d3august-990311-0: Bj|rn Augustsson <d3august@dtek.chalmers.se>
Mon Mar 29 17:02:58 1999 Owen Taylor <otaylor@redhat.com>
Patches from Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
gtk-a-higuti-990322-[0-3]
* gdk/gdkfont.c (gdk_text_extents_wc): Make work when
sizeof(wchar_t) != sizeof (GdkWChar)
* configure.in: Fix confusion between GTK_LOCALE_[C]FLAGS
that was causing -DX_LOCALE not to work.
* gtk/gtkrc.c (gtk_rc_init):
X_LOCALE will never have LC_MESSAGES defined
* gdk/gdk.c (gdk_init_check):
Remove --xim-preedit and --xim-status from argv properly.
* gdk/gdkim.c (gdk_ic_real_new): Add a gdk_flush() so
that the client window is present on the X server
before we pass it to the input method.
Tue Mar 9 10:46:49 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (motif_find_drag_window): Fix bug where
if --display is specified on the command line, than
the drag window will not be created on that display.
Tue Mar 9 10:38:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Fixed bug where
lookups with only_if_exists == TRUE were inserting
bogus values into the atom cache.
Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org>
* gdk/gdkselection.c (gdk_selection_property_get): first XFree(t),
then reset it to NULL.
* gdk/gdkcolor.c:
(gdk_colors_free):
(gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the
key for g_hash_table_remove() in both functions, this prevents us
from accessing possibly uninitialized portions of a GdkColor structure
where we are only interested in its pixel value.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
1999-09-21 Tor Lillqvist <tml@iki.fi>
1999-09-28 20:19:13 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_surface_destroy (surface, TRUE);
|
1998-03-14 05:15:16 +00:00
|
|
|
|
}
|
2010-12-15 22:45:05 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_x11_display_remove_window (GDK_SURFACE_DISPLAY (surface), GDK_SURFACE_XID (surface));
|
2018-03-20 11:05:26 +00:00
|
|
|
|
if (surface_impl->toplevel && surface_impl->toplevel->focus_window)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_x11_display_remove_window (GDK_SURFACE_DISPLAY (surface), surface_impl->toplevel->focus_window);
|
2002-03-02 20:37:07 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_x11_surface_grab_check_destroy (surface);
|
2010-12-15 22:45:05 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_object_unref (surface);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-05 01:54:05 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
update_wm_hints (GdkSurface *surface,
|
2003-07-05 01:54:05 +00:00
|
|
|
|
gboolean force)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkToplevelX11 *toplevel = _gdk_x11_surface_get_toplevel (surface);
|
|
|
|
|
GdkDisplay *display = GDK_SURFACE_DISPLAY (surface);
|
2003-07-05 01:54:05 +00:00
|
|
|
|
XWMHints wm_hints;
|
|
|
|
|
|
|
|
|
|
if (!force &&
|
2004-10-18 21:02:37 +00:00
|
|
|
|
!toplevel->is_leader &&
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->state & GDK_SURFACE_STATE_WITHDRAWN)
|
2003-07-05 01:54:05 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2003-12-10 23:58:23 +00:00
|
|
|
|
wm_hints.flags = StateHint | InputHint;
|
2020-03-14 14:06:57 +00:00
|
|
|
|
wm_hints.input = True;
|
2003-07-05 01:54:05 +00:00
|
|
|
|
wm_hints.initial_state = NormalState;
|
|
|
|
|
|
2019-11-16 19:50:57 +00:00
|
|
|
|
if (surface->state & GDK_SURFACE_STATE_MINIMIZED)
|
2003-07-05 01:54:05 +00:00
|
|
|
|
{
|
|
|
|
|
wm_hints.flags |= StateHint;
|
|
|
|
|
wm_hints.initial_state = IconicState;
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-05 02:34:52 +00:00
|
|
|
|
if (toplevel->icon_pixmap)
|
2003-07-05 01:54:05 +00:00
|
|
|
|
{
|
|
|
|
|
wm_hints.flags |= IconPixmapHint;
|
2010-08-27 10:08:30 +00:00
|
|
|
|
wm_hints.icon_pixmap = cairo_xlib_surface_get_drawable (toplevel->icon_pixmap);
|
2003-07-05 01:54:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-07-05 02:34:52 +00:00
|
|
|
|
if (toplevel->icon_mask)
|
2003-07-05 01:54:05 +00:00
|
|
|
|
{
|
|
|
|
|
wm_hints.flags |= IconMaskHint;
|
2010-08-27 10:08:30 +00:00
|
|
|
|
wm_hints.icon_mask = cairo_xlib_surface_get_drawable (toplevel->icon_mask);
|
2003-07-05 01:54:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wm_hints.flags |= WindowGroupHint;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
if (toplevel->group_leader && !GDK_SURFACE_DESTROYED (toplevel->group_leader))
|
2003-07-05 01:54:05 +00:00
|
|
|
|
{
|
|
|
|
|
wm_hints.flags |= WindowGroupHint;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
wm_hints.window_group = GDK_SURFACE_XID (toplevel->group_leader);
|
2003-07-05 01:54:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
2010-12-20 18:20:10 +00:00
|
|
|
|
wm_hints.window_group = GDK_X11_DISPLAY (display)->leader_window;
|
2005-06-17 20:19:32 +00:00
|
|
|
|
|
|
|
|
|
if (toplevel->urgency_hint)
|
|
|
|
|
wm_hints.flags |= XUrgencyHint;
|
2003-07-05 01:54:05 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSetWMHints (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
2003-07-05 01:54:05 +00:00
|
|
|
|
&wm_hints);
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-27 20:40:15 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
set_initial_hints (GdkSurface *surface)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkDisplay *display = GDK_SURFACE_DISPLAY (surface);
|
2002-12-10 23:25:33 +00:00
|
|
|
|
Display *xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
Window xwindow = GDK_SURFACE_XID (surface);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
2006-04-16 05:05:49 +00:00
|
|
|
|
Atom atoms[9];
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int i;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
|
|
|
|
|
if (!toplevel)
|
|
|
|
|
return;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
update_wm_hints (surface, TRUE);
|
2003-07-05 01:54:05 +00:00
|
|
|
|
|
2001-02-27 20:40:15 +00:00
|
|
|
|
/* We set the spec hints regardless of whether the spec is supported,
|
|
|
|
|
* since it can't hurt and it's kind of expensive to check whether
|
|
|
|
|
* it's supported.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
i = 0;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->state & GDK_SURFACE_STATE_MAXIMIZED)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2002-12-10 23:48:07 +00:00
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
2002-04-25 22:29:14 +00:00
|
|
|
|
"_NET_WM_STATE_MAXIMIZED_VERT");
|
2001-02-27 20:40:15 +00:00
|
|
|
|
++i;
|
2002-12-10 23:48:07 +00:00
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
2002-04-25 22:29:14 +00:00
|
|
|
|
"_NET_WM_STATE_MAXIMIZED_HORZ");
|
2001-02-27 20:40:15 +00:00
|
|
|
|
++i;
|
2008-05-25 23:09:09 +00:00
|
|
|
|
toplevel->have_maxhorz = toplevel->have_maxvert = TRUE;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->state & GDK_SURFACE_STATE_ABOVE)
|
2004-06-26 05:17:59 +00:00
|
|
|
|
{
|
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
|
|
|
|
"_NET_WM_STATE_ABOVE");
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->state & GDK_SURFACE_STATE_BELOW)
|
2004-06-26 05:17:59 +00:00
|
|
|
|
{
|
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
|
|
|
|
"_NET_WM_STATE_BELOW");
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->state & GDK_SURFACE_STATE_FULLSCREEN)
|
2002-09-25 19:16:46 +00:00
|
|
|
|
{
|
2002-12-10 23:48:07 +00:00
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
2002-09-25 19:16:46 +00:00
|
|
|
|
"_NET_WM_STATE_FULLSCREEN");
|
|
|
|
|
++i;
|
2008-05-25 23:09:09 +00:00
|
|
|
|
toplevel->have_fullscreen = TRUE;
|
2002-09-25 19:16:46 +00:00
|
|
|
|
}
|
2003-04-21 19:03:15 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->modal_hint)
|
2001-03-05 15:09:02 +00:00
|
|
|
|
{
|
2002-12-10 23:48:07 +00:00
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
2002-04-25 22:29:14 +00:00
|
|
|
|
"_NET_WM_STATE_MODAL");
|
2001-03-05 15:09:02 +00:00
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-05 02:34:52 +00:00
|
|
|
|
if (toplevel->skip_taskbar_hint)
|
2003-04-21 19:03:15 +00:00
|
|
|
|
{
|
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
|
|
|
|
"_NET_WM_STATE_SKIP_TASKBAR");
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
2003-07-05 02:34:52 +00:00
|
|
|
|
if (toplevel->skip_pager_hint)
|
2003-04-21 19:03:15 +00:00
|
|
|
|
{
|
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
|
|
|
|
"_NET_WM_STATE_SKIP_PAGER");
|
|
|
|
|
++i;
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-16 19:50:57 +00:00
|
|
|
|
if (surface->state & GDK_SURFACE_STATE_MINIMIZED)
|
2012-02-21 16:14:16 +00:00
|
|
|
|
{
|
|
|
|
|
atoms[i] = gdk_x11_get_xatom_by_name_for_display (display,
|
|
|
|
|
"_NET_WM_STATE_HIDDEN");
|
|
|
|
|
++i;
|
|
|
|
|
toplevel->have_hidden = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2001-02-27 20:40:15 +00:00
|
|
|
|
if (i > 0)
|
|
|
|
|
{
|
2002-12-10 23:25:33 +00:00
|
|
|
|
XChangeProperty (xdisplay,
|
|
|
|
|
xwindow,
|
2002-12-10 23:48:07 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
|
2001-02-27 20:40:15 +00:00
|
|
|
|
XA_ATOM, 32, PropModeReplace,
|
|
|
|
|
(guchar*) atoms, i);
|
|
|
|
|
}
|
2002-12-10 23:25:33 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
XDeleteProperty (xdisplay,
|
|
|
|
|
xwindow,
|
2002-12-10 23:48:07 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"));
|
2002-12-10 23:25:33 +00:00
|
|
|
|
}
|
2001-02-27 20:40:15 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->state & GDK_SURFACE_STATE_STICKY)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
|
|
|
|
atoms[0] = 0xFFFFFFFF;
|
2002-12-10 23:25:33 +00:00
|
|
|
|
XChangeProperty (xdisplay,
|
|
|
|
|
xwindow,
|
2002-12-10 23:48:07 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"),
|
2001-02-27 20:40:15 +00:00
|
|
|
|
XA_CARDINAL, 32, PropModeReplace,
|
|
|
|
|
(guchar*) atoms, 1);
|
2008-05-25 23:09:09 +00:00
|
|
|
|
toplevel->on_all_desktops = TRUE;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
2002-12-10 23:25:33 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
XDeleteProperty (xdisplay,
|
|
|
|
|
xwindow,
|
2002-12-10 23:48:07 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_DESKTOP"));
|
2002-12-10 23:25:33 +00:00
|
|
|
|
}
|
2003-07-05 02:34:52 +00:00
|
|
|
|
|
|
|
|
|
toplevel->map_serial = NextRequest (xdisplay);
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-09 17:20:13 +00:00
|
|
|
|
void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_show (GdkSurface *surface, gboolean already_mapped)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2004-08-23 17:10:34 +00:00
|
|
|
|
GdkDisplay *display;
|
2010-12-20 16:14:04 +00:00
|
|
|
|
GdkX11Display *display_x11;
|
2004-08-23 17:10:34 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
Display *xdisplay = GDK_SURFACE_XDISPLAY (surface);
|
|
|
|
|
Window xwindow = GDK_SURFACE_XID (surface);
|
2020-02-12 11:44:43 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2009-06-16 19:34:37 +00:00
|
|
|
|
|
|
|
|
|
if (!already_mapped)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
set_initial_hints (surface);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
|
|
|
|
display_x11 = GDK_X11_DISPLAY (display);
|
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (toplevel->user_time != 0 &&
|
|
|
|
|
display_x11->user_time != 0 &&
|
|
|
|
|
XSERVER_TIME_IS_LATER (display_x11->user_time, toplevel->user_time))
|
|
|
|
|
gdk_x11_surface_set_user_time (surface, display_x11->user_time);
|
2020-02-12 11:44:43 +00:00
|
|
|
|
|
|
|
|
|
if (GDK_PROFILER_IS_RUNNING)
|
|
|
|
|
{
|
|
|
|
|
if (impl->map_time == 0)
|
|
|
|
|
impl->map_time = g_get_monotonic_time ();
|
|
|
|
|
}
|
|
|
|
|
|
2008-12-18 10:30:10 +00:00
|
|
|
|
XMapWindow (xdisplay, xwindow);
|
|
|
|
|
|
2013-01-21 10:52:32 +00:00
|
|
|
|
/* Fullscreen on current monitor is the default, no need to apply this mode
|
|
|
|
|
* when mapping a window. This also ensures that the default behavior remains
|
|
|
|
|
* consistent with pre-fullscreen mode implementation.
|
|
|
|
|
*/
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->fullscreen_mode != GDK_FULLSCREEN_ON_CURRENT_MONITOR)
|
|
|
|
|
gdk_x11_surface_apply_fullscreen_mode (surface);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-07-15 19:12:14 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_withdraw (GdkSurface *surface)
|
2018-07-15 19:12:14 +00:00
|
|
|
|
{
|
|
|
|
|
if (!surface->destroyed)
|
|
|
|
|
{
|
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
gdk_synthesize_surface_state (surface,
|
|
|
|
|
0,
|
|
|
|
|
GDK_SURFACE_STATE_WITHDRAWN);
|
|
|
|
|
|
|
|
|
|
g_assert (!GDK_SURFACE_IS_MAPPED (surface));
|
|
|
|
|
XWithdrawWindow (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface), 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_hide (GdkSurface *surface)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2002-03-02 20:37:07 +00:00
|
|
|
|
/* We'll get the unmap notify eventually, and handle it then,
|
|
|
|
|
* but checking here makes things more consistent if we are
|
|
|
|
|
* just doing stuff ourself.
|
|
|
|
|
*/
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_x11_surface_grab_check_unmap (surface,
|
|
|
|
|
NextRequest (GDK_SURFACE_XDISPLAY (surface)));
|
2002-03-02 20:37:07 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
gdk_x11_surface_withdraw (surface);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
static inline void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
x11_surface_move (GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2000-03-28 01:24:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XMoveWindow (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
2018-03-20 11:05:26 +00:00
|
|
|
|
x * impl->surface_scale, y * impl->surface_scale);
|
2004-07-09 21:27:09 +00:00
|
|
|
|
|
2016-12-15 16:53:08 +00:00
|
|
|
|
if (impl->override_redirect)
|
|
|
|
|
{
|
2019-05-29 04:31:04 +00:00
|
|
|
|
impl->abs_x = x;
|
|
|
|
|
impl->abs_y = y;
|
2019-04-22 15:22:33 +00:00
|
|
|
|
|
|
|
|
|
if (surface->parent)
|
|
|
|
|
{
|
2019-05-29 04:31:04 +00:00
|
|
|
|
surface->x = impl->abs_x - GDK_X11_SURFACE (surface->parent)->abs_x;
|
|
|
|
|
surface->y = impl->abs_y - GDK_X11_SURFACE (surface->parent)->abs_y;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
surface->x = x;
|
|
|
|
|
surface->y = y;
|
2019-04-22 15:22:33 +00:00
|
|
|
|
}
|
2000-09-01 20:10:58 +00:00
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
static inline void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
x11_surface_resize (GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int width,
|
|
|
|
|
int height)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2016-12-15 16:53:08 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
if (width < 1)
|
|
|
|
|
width = 1;
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
if (height < 1)
|
|
|
|
|
height = 1;
|
1999-10-03 22:12:41 +00:00
|
|
|
|
|
2018-03-30 08:43:26 +00:00
|
|
|
|
gdk_x11_surface_pre_damage (surface);
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XResizeWindow (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
2018-03-20 11:05:26 +00:00
|
|
|
|
width * impl->surface_scale, height * impl->surface_scale);
|
2016-12-15 16:53:08 +00:00
|
|
|
|
|
|
|
|
|
if (impl->override_redirect)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2018-03-20 11:05:26 +00:00
|
|
|
|
impl->unscaled_width = width * impl->surface_scale;
|
|
|
|
|
impl->unscaled_height = height * impl->surface_scale;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->width = width;
|
|
|
|
|
surface->height = height;
|
2020-03-14 01:33:23 +00:00
|
|
|
|
_gdk_surface_update_size (surface);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
_gdk_x11_surface_update_size (GDK_X11_SURFACE (surface));
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-20 11:05:26 +00:00
|
|
|
|
if (width * impl->surface_scale != impl->unscaled_width || height * impl->surface_scale != impl->unscaled_height)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->resize_count += 1;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
static inline void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
x11_surface_move_resize (GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2016-12-15 16:53:08 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
if (width < 1)
|
|
|
|
|
width = 1;
|
2008-06-27 14:27:44 +00:00
|
|
|
|
|
1997-11-24 22:37:52 +00:00
|
|
|
|
if (height < 1)
|
|
|
|
|
height = 1;
|
1999-10-03 22:12:41 +00:00
|
|
|
|
|
2018-03-30 08:43:26 +00:00
|
|
|
|
gdk_x11_surface_pre_damage (surface);
|
2012-11-14 17:23:41 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XMoveResizeWindow (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
2018-03-20 11:05:26 +00:00
|
|
|
|
x * impl->surface_scale, y * impl->surface_scale,
|
|
|
|
|
width * impl->surface_scale, height * impl->surface_scale);
|
2016-12-15 16:53:08 +00:00
|
|
|
|
|
|
|
|
|
if (impl->override_redirect)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-05-29 04:31:04 +00:00
|
|
|
|
impl->abs_x = x;
|
|
|
|
|
impl->abs_y = y;
|
2016-12-15 16:53:08 +00:00
|
|
|
|
|
2018-03-20 11:05:26 +00:00
|
|
|
|
impl->unscaled_width = width * impl->surface_scale;
|
|
|
|
|
impl->unscaled_height = height * impl->surface_scale;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->width = width;
|
|
|
|
|
surface->height = height;
|
2016-12-15 16:53:08 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
_gdk_x11_surface_update_size (GDK_X11_SURFACE (surface));
|
2019-04-22 15:22:33 +00:00
|
|
|
|
|
|
|
|
|
if (surface->parent)
|
|
|
|
|
{
|
2019-05-29 04:31:04 +00:00
|
|
|
|
surface->x = impl->abs_x - GDK_X11_SURFACE (surface->parent)->abs_x;
|
|
|
|
|
surface->y = impl->abs_y - GDK_X11_SURFACE (surface->parent)->abs_y;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
surface->x = x;
|
|
|
|
|
surface->y = y;
|
2019-04-22 15:22:33 +00:00
|
|
|
|
}
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-20 11:05:26 +00:00
|
|
|
|
if (width * impl->surface_scale != impl->unscaled_width || height * impl->surface_scale != impl->unscaled_height)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->resize_count += 1;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_move_resize (GdkSurface *surface,
|
2019-04-22 15:22:33 +00:00
|
|
|
|
gboolean with_move,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
2008-06-27 14:27:44 +00:00
|
|
|
|
{
|
|
|
|
|
if (with_move && (width < 0 && height < 0))
|
2019-04-22 01:14:46 +00:00
|
|
|
|
x11_surface_move (surface, x, y);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (with_move)
|
2019-04-22 01:14:46 +00:00
|
|
|
|
x11_surface_move_resize (surface, x, y, width, height);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
else
|
2019-04-22 01:14:46 +00:00
|
|
|
|
x11_surface_resize (surface, width, height);
|
2008-06-27 14:27:44 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 08:54:44 +00:00
|
|
|
|
static void
|
|
|
|
|
gdk_x11_surface_toplevel_resize (GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int width,
|
|
|
|
|
int height)
|
2019-07-15 08:54:44 +00:00
|
|
|
|
{
|
|
|
|
|
x11_surface_resize (surface, width, height);
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 09:32:35 +00:00
|
|
|
|
void
|
|
|
|
|
gdk_x11_surface_move (GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y)
|
2019-07-15 09:32:35 +00:00
|
|
|
|
{
|
|
|
|
|
gdk_x11_surface_move_resize (surface, TRUE, x, y, -1, -1);
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 09:35:24 +00:00
|
|
|
|
static void
|
2020-02-16 11:59:24 +00:00
|
|
|
|
gdk_x11_surface_layout_popup (GdkSurface *surface,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
GdkPopupLayout *layout)
|
2019-07-15 09:35:24 +00:00
|
|
|
|
{
|
2020-07-29 13:47:48 +00:00
|
|
|
|
GdkMonitor *monitor;
|
|
|
|
|
GdkRectangle bounds;
|
2020-02-16 11:59:24 +00:00
|
|
|
|
GdkRectangle final_rect;
|
2019-07-15 09:35:24 +00:00
|
|
|
|
int x, y;
|
|
|
|
|
|
2020-07-29 13:47:48 +00:00
|
|
|
|
monitor = gdk_surface_get_layout_monitor (surface, layout,
|
|
|
|
|
gdk_x11_monitor_get_workarea);
|
|
|
|
|
gdk_x11_monitor_get_workarea (monitor, &bounds);
|
|
|
|
|
|
2020-02-16 11:59:24 +00:00
|
|
|
|
gdk_surface_layout_popup_helper (surface,
|
|
|
|
|
width,
|
|
|
|
|
height,
|
2020-07-29 13:47:48 +00:00
|
|
|
|
monitor,
|
|
|
|
|
&bounds,
|
2020-02-16 11:59:24 +00:00
|
|
|
|
layout,
|
|
|
|
|
&final_rect);
|
2019-07-15 09:35:24 +00:00
|
|
|
|
|
2020-02-16 11:59:24 +00:00
|
|
|
|
gdk_surface_get_origin (surface->parent, &x, &y);
|
2019-07-15 09:35:24 +00:00
|
|
|
|
x += final_rect.x;
|
|
|
|
|
y += final_rect.y;
|
|
|
|
|
|
|
|
|
|
if (final_rect.width != surface->width ||
|
|
|
|
|
final_rect.height != surface->height)
|
|
|
|
|
{
|
|
|
|
|
gdk_x11_surface_move_resize (surface,
|
|
|
|
|
TRUE,
|
2020-02-16 11:59:24 +00:00
|
|
|
|
x,
|
|
|
|
|
y,
|
|
|
|
|
final_rect.width,
|
|
|
|
|
final_rect.height);
|
2019-07-15 09:35:24 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
gdk_x11_surface_move (surface, x, y);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2020-02-16 11:59:24 +00:00
|
|
|
|
show_popup (GdkSurface *surface)
|
|
|
|
|
{
|
2020-02-29 17:54:24 +00:00
|
|
|
|
gdk_x11_surface_raise (surface);
|
2020-02-16 11:59:24 +00:00
|
|
|
|
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
|
|
|
|
gdk_x11_surface_show (surface, FALSE);
|
|
|
|
|
gdk_surface_invalidate_rect (surface, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
show_grabbing_popup (GdkSeat *seat,
|
|
|
|
|
GdkSurface *surface,
|
|
|
|
|
gpointer user_data)
|
|
|
|
|
{
|
|
|
|
|
show_popup (surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_surface_present_popup (GdkSurface *surface,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
GdkPopupLayout *layout)
|
|
|
|
|
{
|
|
|
|
|
gdk_x11_surface_layout_popup (surface, width, height, layout);
|
|
|
|
|
|
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
if (surface->autohide)
|
|
|
|
|
{
|
|
|
|
|
gdk_seat_grab (gdk_display_get_default_seat (surface->display),
|
|
|
|
|
surface,
|
|
|
|
|
GDK_SEAT_CAPABILITY_ALL,
|
|
|
|
|
TRUE,
|
|
|
|
|
NULL, NULL,
|
|
|
|
|
show_grabbing_popup, NULL);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
show_popup (surface);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return GDK_SURFACE_IS_MAPPED (surface);
|
2019-07-15 09:35:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-04-22 15:22:33 +00:00
|
|
|
|
static void gdk_x11_surface_restack_toplevel (GdkSurface *surface,
|
|
|
|
|
GdkSurface *sibling,
|
|
|
|
|
gboolean above);
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdk_x11_surface_update_popups (GdkSurface *parent)
|
|
|
|
|
{
|
|
|
|
|
GList *l;
|
|
|
|
|
|
2019-05-22 22:04:45 +00:00
|
|
|
|
for (l = parent->children; l; l = l->next)
|
2019-04-22 15:22:33 +00:00
|
|
|
|
{
|
|
|
|
|
GdkX11Surface *popup_impl = l->data;
|
|
|
|
|
GdkSurface *popup = GDK_SURFACE (popup_impl);
|
2019-05-29 04:31:04 +00:00
|
|
|
|
int new_x = GDK_X11_SURFACE (parent)->abs_x + popup->x;
|
|
|
|
|
int new_y = GDK_X11_SURFACE (parent)->abs_y + popup->y;
|
2019-04-22 15:22:33 +00:00
|
|
|
|
|
2019-05-29 04:31:04 +00:00
|
|
|
|
if (new_x != popup_impl->abs_x || new_y != popup_impl->abs_y)
|
2019-04-22 15:22:33 +00:00
|
|
|
|
x11_surface_move (popup, new_x, new_y);
|
|
|
|
|
gdk_x11_surface_restack_toplevel (popup, parent, TRUE);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-04-16 10:58:39 +00:00
|
|
|
|
static void
|
|
|
|
|
gdk_x11_surface_set_is_on_monitor (GdkSurface *surface,
|
|
|
|
|
GdkMonitor *monitor,
|
|
|
|
|
gboolean is_on_monitor)
|
|
|
|
|
{
|
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
|
|
|
|
GList *was_on_monitor;
|
|
|
|
|
|
|
|
|
|
was_on_monitor = g_list_find (impl->surface_is_on_monitor, monitor);
|
|
|
|
|
|
|
|
|
|
if (!was_on_monitor && is_on_monitor)
|
|
|
|
|
{
|
|
|
|
|
impl->surface_is_on_monitor = g_list_append (impl->surface_is_on_monitor,
|
|
|
|
|
monitor);
|
|
|
|
|
gdk_surface_enter_monitor (surface, monitor);
|
|
|
|
|
}
|
|
|
|
|
else if (was_on_monitor && !is_on_monitor)
|
|
|
|
|
{
|
|
|
|
|
impl->surface_is_on_monitor = g_list_remove (impl->surface_is_on_monitor,
|
|
|
|
|
monitor);
|
|
|
|
|
gdk_surface_leave_monitor (surface, monitor);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-05-17 03:35:14 +00:00
|
|
|
|
void
|
2020-04-16 10:58:39 +00:00
|
|
|
|
gdk_x11_surface_check_monitor (GdkSurface *surface,
|
|
|
|
|
GdkMonitor *monitor)
|
|
|
|
|
{
|
|
|
|
|
GdkRectangle monitor_geometry;
|
|
|
|
|
GdkRectangle surface_geometry;
|
|
|
|
|
gboolean is_on_monitor;
|
|
|
|
|
|
|
|
|
|
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
|
|
|
|
gdk_surface_get_geometry (surface,
|
|
|
|
|
&surface_geometry.x,
|
|
|
|
|
&surface_geometry.y,
|
|
|
|
|
&surface_geometry.width,
|
|
|
|
|
&surface_geometry.height);
|
|
|
|
|
|
|
|
|
|
is_on_monitor = gdk_rectangle_intersect (&surface_geometry,
|
|
|
|
|
&monitor_geometry,
|
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
|
|
gdk_x11_surface_set_is_on_monitor (surface, monitor, is_on_monitor);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
gdk_x11_surface_enter_leave_monitors (GdkSurface *surface)
|
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display = gdk_surface_get_display (surface);
|
2020-05-17 03:58:20 +00:00
|
|
|
|
GListModel *monitors;
|
|
|
|
|
guint i;
|
2020-04-16 10:58:39 +00:00
|
|
|
|
|
2020-05-17 03:58:20 +00:00
|
|
|
|
monitors = gdk_display_get_monitors (display);
|
|
|
|
|
for (i = 0; i < g_list_model_get_n_items (monitors); i++)
|
2020-04-16 10:58:39 +00:00
|
|
|
|
{
|
2020-05-17 03:58:20 +00:00
|
|
|
|
GdkMonitor *monitor = g_list_model_get_item (monitors, i);
|
2020-04-16 10:58:39 +00:00
|
|
|
|
gdk_x11_surface_check_monitor (surface, monitor);
|
2020-05-17 03:58:20 +00:00
|
|
|
|
g_object_unref (monitor);
|
2020-04-16 10:58:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-29 18:06:43 +00:00
|
|
|
|
static void gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
|
|
|
|
|
const GdkGeometry *geometry,
|
|
|
|
|
GdkSurfaceHints geom_mask);
|
|
|
|
|
|
2013-06-27 20:45:40 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_x11_surface_set_surface_scale (GdkSurface *surface,
|
2013-06-27 20:45:40 +00:00
|
|
|
|
int scale)
|
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2013-06-27 20:45:40 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceHints geom_mask;
|
2013-06-27 20:45:40 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2013-06-27 20:45:40 +00:00
|
|
|
|
|
2018-03-20 11:05:26 +00:00
|
|
|
|
impl->surface_scale = scale;
|
2014-11-04 03:35:11 +00:00
|
|
|
|
if (impl->cairo_surface)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
cairo_surface_set_device_scale (impl->cairo_surface, impl->surface_scale, impl->surface_scale);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_surface_update_size (surface);
|
2013-06-27 20:45:40 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2018-06-25 22:47:40 +00:00
|
|
|
|
if (toplevel)
|
2013-06-27 20:45:40 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
/* These are affected by surface scale: */
|
2020-07-30 02:42:11 +00:00
|
|
|
|
geom_mask = toplevel->last_geometry_hints_mask & (GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
|
2013-06-27 20:45:40 +00:00
|
|
|
|
if (geom_mask)
|
2020-02-29 18:06:43 +00:00
|
|
|
|
gdk_x11_surface_set_geometry_hints (surface,
|
|
|
|
|
&toplevel->last_geometry_hints,
|
|
|
|
|
geom_mask);
|
2013-06-27 20:45:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-06-25 22:47:40 +00:00
|
|
|
|
if (impl->override_redirect)
|
2014-11-06 22:17:45 +00:00
|
|
|
|
{
|
2018-06-25 22:47:40 +00:00
|
|
|
|
impl->unscaled_width = surface->width * impl->surface_scale;
|
|
|
|
|
impl->unscaled_height = surface->height * impl->surface_scale;
|
2014-11-06 22:17:45 +00:00
|
|
|
|
}
|
2013-06-27 20:45:40 +00:00
|
|
|
|
|
2018-06-25 22:47:40 +00:00
|
|
|
|
XResizeWindow (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
|
|
|
|
surface->width * impl->surface_scale,
|
|
|
|
|
surface->height * impl->surface_scale);
|
|
|
|
|
|
2018-03-21 03:07:37 +00:00
|
|
|
|
gdk_surface_invalidate_rect (surface, NULL);
|
2013-06-27 20:45:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-29 17:54:24 +00:00
|
|
|
|
void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_raise (GdkSurface *surface)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XRaiseWindow (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface));
|
2009-01-19 11:47:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-09-02 21:38:55 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_restack_toplevel (GdkSurface *surface,
|
2019-04-22 15:22:33 +00:00
|
|
|
|
GdkSurface *sibling,
|
|
|
|
|
gboolean above)
|
2009-09-02 21:38:55 +00:00
|
|
|
|
{
|
|
|
|
|
XWindowChanges changes;
|
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
changes.sibling = GDK_SURFACE_XID (sibling);
|
2009-09-02 21:38:55 +00:00
|
|
|
|
changes.stack_mode = above ? Above : Below;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XReconfigureWMWindow (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
|
|
|
|
gdk_x11_screen_get_screen_number (GDK_SURFACE_SCREEN (surface)),
|
2009-09-02 21:38:55 +00:00
|
|
|
|
CWStackMode | CWSibling, &changes);
|
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_lower (GdkSurface *surface)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XLowerWindow (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface));
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-07-11 18:28:23 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_x11_surface_move_to_current_desktop:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a #GdkSurface
|
2005-07-11 18:28:23 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Moves the surface to the correct workspace when running under a
|
2005-07-11 18:28:23 +00:00
|
|
|
|
* window manager that supports multiple workspaces, as described
|
2014-02-03 21:56:15 +00:00
|
|
|
|
* in the [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) specification.
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Will not do anything if the surface is already on all workspaces.
|
2005-07-11 18:28:23 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_move_to_current_desktop (GdkSurface *surface)
|
2005-07-11 18:28:23 +00:00
|
|
|
|
{
|
2005-08-01 16:01:24 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
2007-01-30 18:36:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2007-01-30 18:36:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2005-08-01 16:01:24 +00:00
|
|
|
|
|
|
|
|
|
if (toplevel->on_all_desktops)
|
|
|
|
|
return;
|
2006-05-25 05:30:14 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
move_to_current_desktop (surface);
|
2006-05-25 05:30:14 +00:00
|
|
|
|
}
|
2005-08-01 16:01:24 +00:00
|
|
|
|
|
2006-05-25 05:30:14 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
move_to_current_desktop (GdkSurface *surface)
|
2006-05-25 05:30:14 +00:00
|
|
|
|
{
|
2013-08-24 04:51:01 +00:00
|
|
|
|
guint32 desktop;
|
2005-07-11 18:28:23 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
desktop = gdk_x11_screen_get_current_desktop (GDK_SURFACE_SCREEN (surface));
|
|
|
|
|
gdk_x11_surface_move_to_desktop (surface, desktop);
|
2013-08-24 04:51:01 +00:00
|
|
|
|
}
|
2005-07-11 18:28:23 +00:00
|
|
|
|
|
2013-08-24 04:51:01 +00:00
|
|
|
|
static guint32
|
2018-03-20 14:14:10 +00:00
|
|
|
|
get_netwm_cardinal_property (GdkSurface *surface,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *name)
|
2013-08-24 04:51:01 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkX11Screen *x11_screen = GDK_SURFACE_SCREEN (surface);
|
2013-08-24 04:51:01 +00:00
|
|
|
|
guint32 prop = 0;
|
|
|
|
|
Atom type;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int format;
|
2013-08-24 04:51:01 +00:00
|
|
|
|
gulong nitems;
|
|
|
|
|
gulong bytes_after;
|
|
|
|
|
guchar *data;
|
|
|
|
|
|
2020-02-23 00:33:56 +00:00
|
|
|
|
if (!gdk_x11_screen_supports_net_wm_hint (x11_screen, name))
|
2013-08-24 04:51:01 +00:00
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
XGetWindowProperty (x11_screen->xdisplay,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface), name),
|
2013-08-24 04:51:01 +00:00
|
|
|
|
0, G_MAXLONG,
|
|
|
|
|
False, XA_CARDINAL, &type, &format, &nitems,
|
|
|
|
|
&bytes_after, &data);
|
|
|
|
|
if (type == XA_CARDINAL)
|
|
|
|
|
{
|
|
|
|
|
prop = *(gulong *)data;
|
|
|
|
|
XFree (data);
|
2005-07-11 18:28:23 +00:00
|
|
|
|
}
|
2013-08-24 04:51:01 +00:00
|
|
|
|
|
|
|
|
|
return prop;
|
|
|
|
|
}
|
|
|
|
|
|
2013-09-17 05:13:03 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_x11_surface_get_desktop:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a #GdkSurface
|
2013-09-17 05:13:03 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Gets the number of the workspace @surface is on.
|
2013-09-17 05:13:03 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns: the current workspace of @surface
|
2013-09-17 05:13:03 +00:00
|
|
|
|
*/
|
2013-08-24 04:51:01 +00:00
|
|
|
|
guint32
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_get_desktop (GdkSurface *surface)
|
2013-08-24 04:51:01 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
|
2013-08-24 04:51:01 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return get_netwm_cardinal_property (surface, "_NET_WM_DESKTOP");
|
2013-08-24 04:51:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_x11_surface_move_to_desktop:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a #GdkSurface
|
|
|
|
|
* @desktop: the number of the workspace to move the surface to
|
2013-08-24 04:51:01 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Moves the surface to the given workspace when running unde a
|
2013-08-24 04:51:01 +00:00
|
|
|
|
* window manager that supports multiple workspaces, as described
|
2014-02-03 21:56:15 +00:00
|
|
|
|
* in the [Extended Window Manager Hints](http://www.freedesktop.org/Standards/wm-spec) specification.
|
2013-08-24 04:51:01 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_move_to_desktop (GdkSurface *surface,
|
2013-08-24 04:51:01 +00:00
|
|
|
|
guint32 desktop)
|
|
|
|
|
{
|
2020-02-23 00:33:56 +00:00
|
|
|
|
const char *atom_name = "_NET_WM_DESKTOP";
|
2013-08-24 04:51:01 +00:00
|
|
|
|
XClientMessageEvent xclient;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2013-08-24 04:51:01 +00:00
|
|
|
|
|
2020-02-23 00:33:56 +00:00
|
|
|
|
if (!gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface), atom_name))
|
2013-08-24 04:51:01 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
memset (&xclient, 0, sizeof (xclient));
|
|
|
|
|
xclient.type = ClientMessage;
|
|
|
|
|
xclient.serial = 0;
|
|
|
|
|
xclient.send_event = True;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xclient.window = GDK_SURFACE_XID (surface);
|
2020-02-23 00:33:56 +00:00
|
|
|
|
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface), atom_name);
|
2013-08-24 04:51:01 +00:00
|
|
|
|
xclient.format = 32;
|
|
|
|
|
|
|
|
|
|
xclient.data.l[0] = desktop;
|
|
|
|
|
xclient.data.l[1] = 1; /* source indication */
|
|
|
|
|
xclient.data.l[2] = 0;
|
|
|
|
|
xclient.data.l[3] = 0;
|
|
|
|
|
xclient.data.l[4] = 0;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSendEvent (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XROOTWIN (surface),
|
2013-08-24 04:51:01 +00:00
|
|
|
|
False,
|
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
|
|
|
|
(XEvent *)&xclient);
|
2005-07-11 18:28:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_focus (GdkSurface *surface,
|
2010-12-05 20:58:23 +00:00
|
|
|
|
guint32 timestamp)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2003-07-05 01:54:05 +00:00
|
|
|
|
GdkDisplay *display;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2009-08-07 16:00:10 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-02-27 20:40:15 +00:00
|
|
|
|
return;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = GDK_SURFACE_DISPLAY (surface);
|
2003-07-05 01:54:05 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
2017-12-14 04:39:03 +00:00
|
|
|
|
g_intern_static_string ("_NET_ACTIVE_WINDOW")))
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2007-01-04 01:28:07 +00:00
|
|
|
|
XClientMessageEvent xclient;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
|
2007-01-04 01:28:07 +00:00
|
|
|
|
memset (&xclient, 0, sizeof (xclient));
|
|
|
|
|
xclient.type = ClientMessage;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xclient.window = GDK_SURFACE_XID (surface);
|
2007-01-04 01:28:07 +00:00
|
|
|
|
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display,
|
2011-12-28 16:16:54 +00:00
|
|
|
|
"_NET_ACTIVE_WINDOW");
|
2007-01-04 01:28:07 +00:00
|
|
|
|
xclient.format = 32;
|
|
|
|
|
xclient.data.l[0] = 1; /* requestor type; we're an app */
|
|
|
|
|
xclient.data.l[1] = timestamp;
|
|
|
|
|
xclient.data.l[2] = None; /* currently active window */
|
|
|
|
|
xclient.data.l[3] = 0;
|
|
|
|
|
xclient.data.l[4] = 0;
|
2001-02-27 20:40:15 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XROOTWIN (surface), False,
|
2001-02-27 20:40:15 +00:00
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
2007-01-04 01:28:07 +00:00
|
|
|
|
(XEvent *)&xclient);
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XRaiseWindow (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface));
|
2001-05-02 21:31:52 +00:00
|
|
|
|
|
2003-07-05 01:54:05 +00:00
|
|
|
|
/* There is no way of knowing reliably whether we are viewable;
|
2011-02-27 03:13:06 +00:00
|
|
|
|
* so trap errors asynchronously around the XSetInputFocus call
|
2001-05-02 21:31:52 +00:00
|
|
|
|
*/
|
2011-02-27 03:13:06 +00:00
|
|
|
|
gdk_x11_display_error_trap_push (display);
|
|
|
|
|
XSetInputFocus (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2011-02-27 03:13:06 +00:00
|
|
|
|
RevertToParent,
|
|
|
|
|
timestamp);
|
|
|
|
|
gdk_x11_display_error_trap_pop_ignored (display);
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_type_hint (GdkSurface *surface,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceTypeHint hint)
|
2001-03-05 15:09:02 +00:00
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
GdkDisplay *display;
|
Fix problem with g_return_if_fail return value.
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: Move over the
virtual atom code from the gdk-multihead branch, removing the per-display
part. Virtualizing atoms needs to be done now to prevent compat
breakage in direct Xlib accessing code in the future. (#62208)
* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
2001-10-22 04:34:42 +00:00
|
|
|
|
Atom atom;
|
2001-03-05 15:09:02 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-03-05 15:09:02 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2001-03-05 15:09:02 +00:00
|
|
|
|
switch (hint)
|
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_DIALOG:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DIALOG");
|
2001-03-05 15:09:02 +00:00
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_MENU:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_MENU");
|
2001-03-05 15:09:02 +00:00
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_TOOLBAR:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_TOOLBAR");
|
2001-03-05 15:09:02 +00:00
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_UTILITY:
|
2002-09-25 19:16:46 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_UTILITY");
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_SPLASHSCREEN:
|
2002-11-25 22:05:52 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_SPLASH");
|
2002-09-25 19:16:46 +00:00
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_DOCK:
|
2002-09-25 19:16:46 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DOCK");
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_DESKTOP:
|
2002-09-25 19:16:46 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DESKTOP");
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_DROPDOWN_MENU:
|
2006-04-25 14:27:32 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU");
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_POPUP_MENU:
|
2006-04-25 14:27:32 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_POPUP_MENU");
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_TOOLTIP:
|
2006-04-25 14:27:32 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_TOOLTIP");
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_NOTIFICATION:
|
2006-04-25 14:27:32 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_NOTIFICATION");
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_COMBO:
|
2006-04-25 14:27:32 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_COMBO");
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_DND:
|
2006-04-25 14:27:32 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_DND");
|
|
|
|
|
break;
|
2001-03-05 15:09:02 +00:00
|
|
|
|
default:
|
2018-03-20 10:40:08 +00:00
|
|
|
|
g_warning ("Unknown hint %d passed to gdk_surface_set_type_hint", hint);
|
2020-03-06 07:32:21 +00:00
|
|
|
|
G_GNUC_FALLTHROUGH;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_TYPE_HINT_NORMAL:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE_NORMAL");
|
2001-03-05 15:09:02 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface),
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_TYPE"),
|
2001-03-05 15:09:02 +00:00
|
|
|
|
XA_ATOM, 32, PropModeReplace,
|
|
|
|
|
(guchar *)&atom, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2020-02-23 00:33:56 +00:00
|
|
|
|
gdk_wmspec_change_state (gboolean add,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
const char *state1,
|
|
|
|
|
const char *state2)
|
2001-03-05 15:09:02 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkDisplay *display = GDK_SURFACE_DISPLAY (surface);
|
2007-01-04 01:28:07 +00:00
|
|
|
|
XClientMessageEvent xclient;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2001-07-03 01:39:36 +00:00
|
|
|
|
#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */
|
|
|
|
|
#define _NET_WM_STATE_ADD 1 /* add/set property */
|
|
|
|
|
#define _NET_WM_STATE_TOGGLE 2 /* toggle property */
|
2001-03-05 15:09:02 +00:00
|
|
|
|
|
2007-01-04 01:28:07 +00:00
|
|
|
|
memset (&xclient, 0, sizeof (xclient));
|
|
|
|
|
xclient.type = ClientMessage;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xclient.window = GDK_SURFACE_XID (surface);
|
2007-01-04 01:28:07 +00:00
|
|
|
|
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE");
|
|
|
|
|
xclient.format = 32;
|
|
|
|
|
xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
|
2020-02-23 00:33:56 +00:00
|
|
|
|
xclient.data.l[1] = gdk_x11_get_xatom_by_name_for_display (display, state1);
|
|
|
|
|
xclient.data.l[2] = gdk_x11_get_xatom_by_name_for_display (display, state2);
|
2011-12-28 16:16:54 +00:00
|
|
|
|
xclient.data.l[3] = 1; /* source indication */
|
2007-01-04 01:28:07 +00:00
|
|
|
|
xclient.data.l[4] = 0;
|
2001-03-05 15:09:02 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSendEvent (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XROOTWIN (surface), False,
|
2001-03-05 15:09:02 +00:00
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
2007-01-04 01:28:07 +00:00
|
|
|
|
(XEvent *)&xclient);
|
2001-03-05 15:09:02 +00:00
|
|
|
|
}
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_modal_hint (GdkSurface *surface,
|
2010-12-05 20:58:23 +00:00
|
|
|
|
gboolean modal)
|
2001-03-05 15:09:02 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-03-05 15:09:02 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->modal_hint = modal;
|
2001-03-05 15:09:02 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
gdk_wmspec_change_state (modal, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_MODAL",
|
2017-11-15 17:13:31 +00:00
|
|
|
|
NULL);
|
2001-03-05 15:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-01 13:03:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_x11_surface_set_skip_taskbar_hint:
|
|
|
|
|
* @surface: (type GdkX11Surface): a native #GdkSurface
|
2019-05-02 02:39:36 +00:00
|
|
|
|
* @skips_taskbar: %TRUE to skip taskbars
|
|
|
|
|
*
|
|
|
|
|
* Sets a hint on @surface that taskbars should not
|
|
|
|
|
* display it. See the EWMH for details.
|
2019-05-01 13:03:16 +00:00
|
|
|
|
*/
|
2019-04-20 01:13:41 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_skip_taskbar_hint (GdkSurface *surface,
|
2019-04-20 01:13:41 +00:00
|
|
|
|
gboolean skips_taskbar)
|
2002-09-25 19:16:46 +00:00
|
|
|
|
{
|
2003-07-05 02:34:52 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
2002-09-25 19:16:46 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2002-09-25 19:16:46 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
toplevel->skip_taskbar_hint = skips_taskbar;
|
2002-09-25 19:16:46 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
gdk_wmspec_change_state (skips_taskbar, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_SKIP_TASKBAR",
|
2017-11-15 17:13:31 +00:00
|
|
|
|
NULL);
|
2002-09-25 19:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-01 13:03:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_x11_surface_set_skip_pager_hint:
|
2019-05-02 02:39:36 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a #GdkSurface
|
|
|
|
|
* @skips_pager: %TRUE to skip pagers
|
|
|
|
|
*
|
|
|
|
|
* Sets a hint on @surface that pagers should not
|
|
|
|
|
* display it. See the EWMH for details.
|
2019-05-01 13:03:16 +00:00
|
|
|
|
*/
|
2019-04-20 01:13:41 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_skip_pager_hint (GdkSurface *surface,
|
2019-04-20 01:13:41 +00:00
|
|
|
|
gboolean skips_pager)
|
2002-09-25 19:16:46 +00:00
|
|
|
|
{
|
2003-07-05 02:34:52 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2002-09-25 19:16:46 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
toplevel->skip_pager_hint = skips_pager;
|
2002-09-25 19:16:46 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
gdk_wmspec_change_state (skips_pager, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_SKIP_PAGER",
|
2017-11-15 17:13:31 +00:00
|
|
|
|
NULL);
|
2002-09-25 19:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-05-01 13:03:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_x11_surface_set_urgency_hint:
|
|
|
|
|
* @surface: (type GdkX11Surface): a native #GdkSurface
|
2019-05-02 02:39:36 +00:00
|
|
|
|
* @urgent: %TRUE to indicate urgenct attention needed
|
|
|
|
|
*
|
|
|
|
|
* Sets a hint on @surface that it needs user attention.
|
|
|
|
|
* See the ICCCM for details.
|
2019-05-01 13:03:16 +00:00
|
|
|
|
*/
|
2019-04-20 01:13:41 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_urgency_hint (GdkSurface *surface,
|
2019-04-20 01:13:41 +00:00
|
|
|
|
gboolean urgent)
|
2005-06-17 20:19:32 +00:00
|
|
|
|
{
|
|
|
|
|
GdkToplevelX11 *toplevel;
|
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2005-06-17 20:19:32 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2005-06-17 20:19:32 +00:00
|
|
|
|
toplevel->urgency_hint = urgent;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
update_wm_hints (surface, FALSE);
|
2005-06-17 20:19:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_geometry_hints (GdkSurface *surface,
|
2010-12-05 20:58:23 +00:00
|
|
|
|
const GdkGeometry *geometry,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceHints geom_mask)
|
1998-12-07 06:37:27 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
1998-12-07 06:37:27 +00:00
|
|
|
|
XSizeHints size_hints;
|
2013-06-27 20:45:40 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
1998-12-07 06:37:27 +00:00
|
|
|
|
return;
|
2013-06-27 20:45:40 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2013-06-27 20:45:40 +00:00
|
|
|
|
if (toplevel)
|
|
|
|
|
{
|
2013-07-31 01:02:08 +00:00
|
|
|
|
if (geometry)
|
|
|
|
|
toplevel->last_geometry_hints = *geometry;
|
2013-06-27 20:45:40 +00:00
|
|
|
|
toplevel->last_geometry_hints_mask = geom_mask;
|
|
|
|
|
}
|
1998-12-07 06:37:27 +00:00
|
|
|
|
|
|
|
|
|
size_hints.flags = 0;
|
|
|
|
|
|
2020-07-30 15:05:23 +00:00
|
|
|
|
size_hints.flags |= PPosition;
|
|
|
|
|
/* We need to initialize the following obsolete fields because KWM
|
|
|
|
|
* apparently uses these fields if they are non-zero.
|
|
|
|
|
* #@#!#!$!.
|
|
|
|
|
*/
|
|
|
|
|
size_hints.x = 0;
|
|
|
|
|
size_hints.y = 0;
|
fix a typo.
2001-08-07 Havoc Pennington <hp@pobox.com>
* gtk/gtkfilesel.c (open_ref_dir): fix a typo.
* gtk/gtkplug.c (gtk_plug_init): remove setting of auto_shrink;
some fixage is needed here, but nothing simple. Owen understands
it. ;-)
* gtk/gtkwindow.h, gtk/gtkwindow.c: Rework code and API for window
sizing and positioning. Also, fix bug in compute_geometry_hints
(width/height confusion for setting min size).
(gtk_window_move): new function
(gtk_window_resize): new function
(gtk_window_get_size): new function
(gtk_window_get_position): new function
(gtk_window_parse_geometry): new function
* gtk/gtkwidget.c (gtk_widget_set_size_request): new function
(gtk_widget_get_size_request): new function
(gtk_widget_get_usize): delete, that was a short-lived function
;-)
(gtk_widget_set_usize): deprecate
(gtk_widget_set_uposition): deprecate, make it a trivial
gtk_window_move() wrapper
(gtk_widget_class_init): remove x/y/width/height properties,
add width_request height_request
* demos/*: update to avoid deprecated functions
* gtk/gtklayout.c: add x/y child properties
* gtk/gtkfixed.c: add x/y child properties, and get rid of
uses of "gint16"
* tests/testgtk.c (create_window_sizing): lots of tweaks to window
sizing test
* gdk/x11/gdkevents-x11.c (gdk_event_translate): Ensure that
configure events on toplevel windows are always in root window
coordinates, following ICCCM spec that all synthetic events
are in root window coords already, while real events are
in parent window coords. Previously the code assumed that
coords of 0,0 were parent window coords, which was
really broken.
* gtk/gtkcontainer.c (gtk_container_get_focus_chain): fix
warning
* gdk/gdkwindow.h (GdkWindowHints): add GDK_HINT_USER_POS
and GDK_HINT_USER_SIZE so we can set USSize and USPosition
hints in gtk_window_parse_geometry()
* gdk/x11/gdkwindow-x11.c (gdk_window_set_geometry_hints): support
new USER_POS USER_SIZE hints
2001-08-10 03:46:08 +00:00
|
|
|
|
|
1998-12-07 06:37:27 +00:00
|
|
|
|
if (geom_mask & GDK_HINT_MIN_SIZE)
|
|
|
|
|
{
|
|
|
|
|
size_hints.flags |= PMinSize;
|
2018-03-20 11:05:26 +00:00
|
|
|
|
size_hints.min_width = geometry->min_width * impl->surface_scale;
|
|
|
|
|
size_hints.min_height = geometry->min_height * impl->surface_scale;
|
1998-12-07 06:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (geom_mask & GDK_HINT_MAX_SIZE)
|
|
|
|
|
{
|
|
|
|
|
size_hints.flags |= PMaxSize;
|
2018-03-20 11:05:26 +00:00
|
|
|
|
size_hints.max_width = MAX (geometry->max_width, 1) * impl->surface_scale;
|
|
|
|
|
size_hints.max_height = MAX (geometry->max_height, 1) * impl->surface_scale;
|
1998-12-07 06:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 11:05:26 +00:00
|
|
|
|
else if (impl->surface_scale > 1)
|
2013-06-20 09:40:07 +00:00
|
|
|
|
{
|
|
|
|
|
size_hints.flags |= PResizeInc;
|
2018-03-20 11:05:26 +00:00
|
|
|
|
size_hints.width_inc = impl->surface_scale;
|
|
|
|
|
size_hints.height_inc = impl->surface_scale;
|
2013-06-20 09:40:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-06-06 14:35:58 +00:00
|
|
|
|
/* FIXME: Would it be better to delete this property if
|
[ Merges from gtk-1-2 ]
Wed Sep 8 07:13:29 1999 Tim Janik <timj@gtk.org>
* configure.in: fixed "GNU Make" check to pass with new make version
3.77.95.
Fri Sep 3 16:04:41 1999 Tim Janik <timj@gtk.org>
* gtk-config.in (--version): don't echo @GTK_VERSION@, but
@GTK_MAJOR_VERSION@.@GTK_MINOR_VERSION@.@GTK_MICRO_VERSION@, so the
AM_PATH_GTK() macros don't get confused by the -pre1.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (REBUILD): Change check for perl5
to check explicitely for v >= 5.002. (5.001
does not work with our scripts.)
Wed Aug 25 15:45:46 1999 Tim Janik <timj@gtk.org>
* configure.in: evaluate $PERL for the perl version check. added
--disable-rebuilds to give the user an option to completely disable
any source autogeneration rules.
Mon Aug 23 23:16:14 1999 Tim Janik <timj@gtk.org>
* configure.in: evaluate $ac_make when checking for GNU Make.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* docs/Makefile.am: added generation.txt.
* Makefile.am: require automake 1.4, build README from README.in and
INSTALL from INSTALL.in in dist-hook.
* README.in:
* INSTALL.in: new files to autogenerate README and INSTALL from.
* configure.in: figure whether we have GNU Make
* docs/generation.txt: minor additions/corrections.
Wed Aug 11 13:38:26 BST 1999 Tony Gale <gale@gtk.org>
* docs/gtkfaq.sgml: FAQ Update
July 30, 1999 Elliot Lee <sopwith@redhat.com>
* configure.in: Fix autoconf warnings about cross compilation by
trying to provide sane defaults for AC_TRY_RUN.
Fri Jul 16 22:20:21 PDT 1999 Manish Singh <yosh@gimp.org>
* ltconfig
* ltmain.sh: upgrade to libtool 1.3.3
Thu Jul 8 11:30:18 1999 Owen Taylor <otaylor@redhat.com>
* INSTALL: Indicate that the --with-glib= configure
time flag is unsupported.
Mon Jul 5 20:36:03 1999 Owen Taylor <otaylor@redhat.com>
* docs/generation.txt: Added a file that gives
documenation about the autogeneration process for
various autogenerated files.
Tue Jun 29 15:59:25 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Look for libgmodule in the
right location.
Thu Jun 17 13:57:31 1999 Owen Taylor <otaylor@redhat.com>
* docs/gtk_tut.sgml: Removed references to
code examples in my directory on gtk.org as
they should all be in the tutorial now.
* docs/gtk_tut.sgml: Added sources for dial-test
and scribble-xinput programs that were previously
missing.
Fri Jun 4 00:08:59 1999 Owen Taylor <otaylor@redhat.com>
* TODO: Added entry about menu keyboard navigation, removed
some finished items.
Mon May 31 00:11:24 1999 Owen Taylor <otaylor@redhat.com>
* acinclude.m4: Standardize on func_dgettext
not func_gettext, so that the checks for dgettext
actually are paid attention to.
Wed May 5 10:47:54 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Add $INTLLIBS into $LIBS
directly, rather than repeating the checks for
gettext.
* INSTALL: Added information about gettext and
NLS support.
* acinclude.m4 (LIBM): Check for dgettext, not
just gettext. This should hopefully fix things wrt
systems with old versions of GNU gettext installed.
Tue Jun 29 15:59:25 1999 Owen Taylor <otaylor@redhat.com>
* configure.in (LIBS): Look for libgmodule in the
right location.
Thu Apr 1 16:58:10 PST 1999 Manish Singh <yosh@gimp.org>
* autogen.sh: add --enable-maintainer-mode
* configure.in: set ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
Wed Mar 24 23:03:49 CST 1999 Shawn T. Amundson <amundson@gtk.org>
* docs/gtk-config.1.in:
docs/Makefile.am:
configure.in: gtk-config is now generated.
* docs/gtk-config.1: Removed, now generated.
Thu Sep 23 17:59:59 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): grr, even if Gdk doesn't
handle CreateNotify itself, still put out a debuging message for
--gdk-debug=events. made the ReparentNotify debugging message more
verbose.
wrap xcoords translation for ConfigureEvents into an error trap,
a destroy event may already be pending, and in that case, the
actuall coordinate values are not at all critical.
Sat Sep 18 22:24:15 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcc.c: Stop leaking the color_hash all over
the place. Simplify and improve the logic.
Fri Sep 17 09:57:15 1999 Tim Janik <timj@gtk.org>
* gdk/gdk.h, gdk/gdkcolor.c: make return types (gint or gboolean)
for prototypes and function implementations consistent (reported
by Tomas Ogren).
Tue Sep 14 18:23:01 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): tell if expose events have
send_event set in debugging output.
(gdk_compress_exposures): default initialize the event so we don't
operate on bogus values (namely send_event).
Thu Sep 2 16:33:59 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: When we receive an unexpected
destroy notify on one of our windows, don't just
warn about it, also mark our windows as destroyed.
Sun Sep 5 08:10:53 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.c (gdk_font_hash_insert): Add
name => font and name => fontset hashes. The
name => fontset hash is a _big_ win since we
weren't previously caching fontsets at all and loading
fontsets is expensive. The name => font hash
is less of a win, but it does save us from doing
repeated XQueryFont calls on the same font.
* gdk/gdkprivate.h (struct _GdkFontPrivate): Add a names
list so we can remove font/fontset from hash.
Thu Sep 2 19:02:37 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Remove useless
and slightly confusing test. [ XInternAtom (,,TRUE)
will never return None ].
Sat Sep 4 08:39:26 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints)
gdk/gdkwindow.c (gdk_window_set_hints):
Don't omit setting the properties if flags == 0 -
there may be an existing set of properties there
already. (Very old bug. Would it be better to
delete the property instead?)
* gdk/gdkselection.c (gdk_selection_property_get): Fix
spelling error in comment.
Wed Sep 1 14:05:30 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkimage.c (gdk_image_new): Use gdk_error_trap_push()
to avoid stomping over gdk_error_warnings.
* gdk/gdkimage.c (gdk_image_new): compute image->bpp
as (bits_per_pixel + 7) / 8. This gives the same
result as before for multiples of 8, but actually
a "reasonable" value for 1bit or 4bit displays.
Mon Aug 23 19:11:17 1999 Tim Janik <timj@gtk.org>
* gdk/Makefile.am: minor cleanups, strip spaces on build rules for
GNU Make.
Tue Aug 17 07:43:04 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): give a debugging note when
discarding configure events.
1999-08-18 Federico Mena Quintero <federico@redhat.com>
* gdk/gdkpixmap.c (gdk_pixmap_unref): g_return_if_fail() the
refcount is greater than zero.
* gdk/gdkwindow.c (gdk_window_unref): Likewise.
* gdk/gdkfont.c (gdk_font_unref): Likewise.
* gdk/gdkgc.c (gdk_gc_unref): Likewise.
* gdk/gdkdnd.c (gdk_drag_context_unref): Likewise.
Wed Aug 11 01:04:57 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_property_get): Fix assumption
that format 32 => sizeof(item) == 4. It really is
sizeof(long).
Tue Jun 29 23:02:42 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_x_error / gdk_x_io_error): Don't
core dump at all on X IO errors, only core dump
if --enable-debug for X errors.
Thu Jun 24 17:06:23 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): removed old ""Got event for
unknown window:" message. disabled ConfigureNotify discarding code,
because it led to events being processed out of order.
Thu Jun 24 12:22:02 1999 Tim Janik <timj@gtk.org>
* gdk/gdkglobals.c: preinitialize gdk_error_code to 0.
* gdk/gdkevents.c (gdk_event_send_client_message_to_all_recurse): since
we export this function, supress error warnings and don't reset the
error code in the first half of this function.
* gdk/gdk.c (gdk_x_error): set gdk_error_code to the actuall X error
code (instead of just -1) so gdk_error_trap_pop() reveals something
actually informative about the error that happened.
* gdk/*.c:
don't rely on gdk_error_code being -1 if an error occoured, but just
gdk_error_code != 0.
Thu Jun 24 11:50:07 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_apply_filters): advance the filter list
pointer *before* invoking the filter function, so we at least don't
crash if a filter is removed that is currently executed. window filters
*really* need to be made truely reentrant at some point.
Mon Jun 14 11:10:15 1999 Tim Janik <timj@gtk.org>
* gdk/gdkevents.c (gdk_event_translate): print the atom name in the
PropertyNotify debug messages.
Wed May 5 22:51:06 1999 Owen Taylor <otaylor@redhat.com>
Patch from Sung-Hyun Nam <namsh@lgic.co.kr>
* gdk/gdkim.c: Fix cut-and-paste errors for
x/y and PreeditAttributes/StatusAttributes.
Wed May 5 22:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints): Change
G_MAXINT to 2^16 to alleviate overflow problems in
various window managers.
Wed Apr 21 00:42:08 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkfont.c (gdk_text_measure): Fix the return value
for fontsets.
Wed May 5 12:42:01 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c (gdk_window_set_geometry_hints):
Initialize size_hints.x and size_hints.y because kwm
brokenly pays attention to them.
(Bug #1181 - Lars Heete <hel@admin.de>)
Wed May 5 11:38:56 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkrgb.c (gdk_rgb_choose_visual): Free the
return value of gdk_list_visuals().
(Bug #1193 - Morten Welinder <terra@diku.dk>)
Tue May 4 11:12:56 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkim.c (gdk_im_real_open): cast the return value of
XSetIMValues to (void *) when comparing to NULL, to workaround
the problem of some compilers barfing since older X headers don't
have the prototype for it.
Mon Apr 19 10:11:12 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkcolor.c (gdk_colormap_new): Fix memory leak
for pseudocolor where colormap->colors was double
allocated.
* gdk/gdkcolor.c (gdk_colormap_alloc1): Store the
color value in the hash table with the pixel filled
in so when we do later hash table lookups, the color
value is correct.
Sun May 2 15:29:45 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkdraw.c (gdk_draw_lines): check private->destroyed before
making the call
Tue Apr 27 11:17:35 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (xdnd_set_{targets,actions}): Fix leak
pointed out by Morten Welinder <terra@diku.dk>.
Wed Apr 21 14:20:22 1999 George Lebl <jirka@5z.com>
* gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the
default filter from the list
Wed Apr 21 14:20:22 1999 George Lebl <jirka@5z.com>
* gdk/gdkwindow.c: (gdk_window_remove_filter) correctly remove the
default filter from the list
Fri Apr 16 20:41:43 PDT 1999 Manish Singh <yosh@gimp.org>
* gdk/gdk.c: #include "gdkkeysyms.h" for gdk_XConvertCase #defines
* gtk/gtkfontsel.c (gtk_font_selection_create_xlfd): use
g_strdup_printf instead of calcing the length separately
Tue Apr 13 02:49:33 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkwindow.c: removed some silly #ifdef HAVE_CONFIG
that we don't do in many other places. (Fixing duplicate
#include of config.h)
* gdk/gdkevents.c: include gdkinput.h _after_ config.h.
Otherwise, #ifndef XINPUT_NONE check in the latter
doesn't work. (Bug #546)
Sun Apr 11 14:38:03 1999 Tim Janik <timj@gtk.org>
* gdk/gdkpixmap.c (_gdk_pixmap_create_from_xpm): check for color
"None" case insensitive.
Tue Apr 6 16:38:51 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkselection.c:
Add error traps so if the other end of the connection
dies, we survive.
Tue Apr 6 12:24:21 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (gdk_drag_motion): Separate out the
dest_xid field into two fields - one for the window
to send in messages, one to indicate the last looked
up window for caching purposes. This is needed, so
that Leave messages get the correct window.
Mon Apr 5 13:21:30 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_event_check, gdk_event_prepare):
Fix warning created by people mucking around
with the gsource API.
* gdk/gdkevents.c (gdk_io_invoke, gdk_input_add_full):
Change mapping between GIOCondition and GdkInputCondition
to match the way the Linux kernel does it. This should
fix problems where closed pipes were no longer signalling
GDK_INPUT_READ on systems with a native poll().
Mon Apr 5 17:11:57 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixmap.c (_gdk_pixmap_create_from_xpm): Check
explicitly for the string "None" - it is in the XPM
spec and some servers treat unknown colors in odd ways
(like asking the user!)
Thu Apr 1 16:58:10 PST 1999 Manish Singh <yosh@gimp.org>
* gdk/gdkevents.c: made "->" into a "." of previous change so
it compiles
Thu Apr 1 18:41:25 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c (gdk_compress_exposures): Set the
window field of the event structure before calling
user filters.
1999-03-31 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gdk/gdk.c (gdk_init_check): Use False as the last argument to
XInternAtom() here. This is a particularly Old And Nasty(tm) bug.
Mon Mar 29 17:31:52 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkim.c (gdk_mbstowcs): Free the value of the
intermediate text property - prevents major memory
leak when gdk_use_mb.
gtk-d3august-990311-0: Bj|rn Augustsson <d3august@dtek.chalmers.se>
Mon Mar 29 17:02:58 1999 Owen Taylor <otaylor@redhat.com>
Patches from Akira Higuchi <a-higuti@math.sci.hokudai.ac.jp>
gtk-a-higuti-990322-[0-3]
* gdk/gdkfont.c (gdk_text_extents_wc): Make work when
sizeof(wchar_t) != sizeof (GdkWChar)
* configure.in: Fix confusion between GTK_LOCALE_[C]FLAGS
that was causing -DX_LOCALE not to work.
* gtk/gtkrc.c (gtk_rc_init):
X_LOCALE will never have LC_MESSAGES defined
* gdk/gdk.c (gdk_init_check):
Remove --xim-preedit and --xim-status from argv properly.
* gdk/gdkim.c (gdk_ic_real_new): Add a gdk_flush() so
that the client window is present on the X server
before we pass it to the input method.
Tue Mar 9 10:46:49 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdnd.c (motif_find_drag_window): Fix bug where
if --display is specified on the command line, than
the drag window will not be created on that display.
Tue Mar 9 10:38:24 1999 Owen Taylor <otaylor@redhat.com>
* gdk/gdkproperty.c (gdk_atom_intern): Fixed bug where
lookups with only_if_exists == TRUE were inserting
bogus values into the atom cache.
Wed Mar 17 09:00:00 1999 Tim Janik <timj@gtk.org>
* gdk/gdkselection.c (gdk_selection_property_get): first XFree(t),
then reset it to NULL.
* gdk/gdkcolor.c:
(gdk_colors_free):
(gdk_colormap_free_colors): use colormap->colors[in_pixels[i]] as the
key for g_hash_table_remove() in both functions, this prevents us
from accessing possibly uninitialized portions of a GdkColor structure
where we are only interested in its pixel value.
Tue Mar 9 01:01:28 1999 Tim Janik <timj@gtk.org>
* gdk/gdkfont.c (gdk_font_load): first lookup the xfont ID in our
font hash table, if we have a GdkFontPrivate entry for this font
already, simply increment its reference count, provided by Olaf Dietsche
<olaf.dietsche+list.gtk@netcologne.de>.
1999-09-21 Tor Lillqvist <tml@iki.fi>
1999-09-28 20:19:13 +00:00
|
|
|
|
* geom_mask == 0? It would save space on the server
|
|
|
|
|
*/
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSetWMNormalHints (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
1999-10-03 22:12:41 +00:00
|
|
|
|
&size_hints);
|
1998-12-07 06:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_geometry_hints (GdkSurface *surface,
|
2001-03-29 21:17:45 +00:00
|
|
|
|
GdkGeometry *geometry,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceHints *geom_mask)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2006-08-15 05:53:58 +00:00
|
|
|
|
XSizeHints *size_hints;
|
|
|
|
|
glong junk_supplied_mask = 0;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2001-03-29 21:17:45 +00:00
|
|
|
|
g_return_if_fail (geometry != NULL);
|
|
|
|
|
g_return_if_fail (geom_mask != NULL);
|
|
|
|
|
|
|
|
|
|
*geom_mask = 0;
|
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-03-29 21:17:45 +00:00
|
|
|
|
return;
|
2006-08-15 05:53:58 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2013-06-20 09:40:07 +00:00
|
|
|
|
|
2006-08-15 05:53:58 +00:00
|
|
|
|
size_hints = XAllocSizeHints ();
|
|
|
|
|
if (!size_hints)
|
|
|
|
|
return;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!XGetWMNormalHints (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
2006-08-15 05:53:58 +00:00
|
|
|
|
size_hints,
|
|
|
|
|
&junk_supplied_mask))
|
|
|
|
|
size_hints->flags = 0;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2006-08-15 05:53:58 +00:00
|
|
|
|
if (size_hints->flags & PMinSize)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
|
|
|
|
*geom_mask |= GDK_HINT_MIN_SIZE;
|
2018-03-20 11:05:26 +00:00
|
|
|
|
geometry->min_width = size_hints->min_width / impl->surface_scale;
|
|
|
|
|
geometry->min_height = size_hints->min_height / impl->surface_scale;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-08-15 05:53:58 +00:00
|
|
|
|
if (size_hints->flags & PMaxSize)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
|
|
|
|
*geom_mask |= GDK_HINT_MAX_SIZE;
|
2018-03-20 11:05:26 +00:00
|
|
|
|
geometry->max_width = MAX (size_hints->max_width, 1) / impl->surface_scale;
|
|
|
|
|
geometry->max_height = MAX (size_hints->max_height, 1) / impl->surface_scale;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2006-08-15 05:53:58 +00:00
|
|
|
|
XFree (size_hints);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-04 16:51:42 +00:00
|
|
|
|
static gboolean
|
2020-07-24 18:40:36 +00:00
|
|
|
|
utf8_is_latin1 (const char *str)
|
2000-10-04 16:51:42 +00:00
|
|
|
|
{
|
|
|
|
|
const char *p = str;
|
|
|
|
|
|
|
|
|
|
while (*p)
|
|
|
|
|
{
|
|
|
|
|
gunichar ch = g_utf8_get_char (p);
|
|
|
|
|
|
2001-06-06 14:35:58 +00:00
|
|
|
|
if (ch > 0xff)
|
2000-10-04 16:51:42 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
p = g_utf8_next_char (p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Set the property to @utf8_str as STRING if the @utf8_str is fully
|
2020-05-28 08:00:03 +00:00
|
|
|
|
* convertible to STRING, otherwise, set it as compound text
|
2000-10-04 16:51:42 +00:00
|
|
|
|
*/
|
|
|
|
|
static void
|
2002-11-08 22:29:33 +00:00
|
|
|
|
set_text_property (GdkDisplay *display,
|
|
|
|
|
Window xwindow,
|
Fix problem with g_return_if_fail return value.
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: Move over the
virtual atom code from the gdk-multihead branch, removing the per-display
part. Virtualizing atoms needs to be done now to prevent compat
breakage in direct Xlib accessing code in the future. (#62208)
* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
2001-10-22 04:34:42 +00:00
|
|
|
|
Atom property,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *utf8_str)
|
2000-10-04 16:51:42 +00:00
|
|
|
|
{
|
2020-07-24 18:40:36 +00:00
|
|
|
|
char *prop_text = NULL;
|
Fix problem with g_return_if_fail return value.
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: Move over the
virtual atom code from the gdk-multihead branch, removing the per-display
part. Virtualizing atoms needs to be done now to prevent compat
breakage in direct Xlib accessing code in the future. (#62208)
* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
2001-10-22 04:34:42 +00:00
|
|
|
|
Atom prop_type;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int prop_length;
|
|
|
|
|
int prop_format;
|
2004-02-26 18:28:07 +00:00
|
|
|
|
gboolean is_compound_text;
|
2000-10-04 16:51:42 +00:00
|
|
|
|
|
|
|
|
|
if (utf8_is_latin1 (utf8_str))
|
|
|
|
|
{
|
Fix problem with g_return_if_fail return value.
Sun Oct 21 23:27:00 2001 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.c (gtk_widget_translate_coordinates): Fix
problem with g_return_if_fail return value.
* gdk/x11/gdkproperty-x11.c docs/Changes-2.0.txt: Move over the
virtual atom code from the gdk-multihead branch, removing the per-display
part. Virtualizing atoms needs to be done now to prevent compat
breakage in direct Xlib accessing code in the future. (#62208)
* gdk/x11/gdkx.h: gdk/gdk/x11/gdkproperty-x11.c: Export
gdk_x11_xatom_to_atom, gdk_x11_atom_to_xatom().
* gdk/gdktypes.h docs/Changes-2.0.txt: Make GdkAtom
an opaque pointer type so the compiler catches attempts
to mingle it with X atoms.
* gdk/x11/{gdkdnd-x11.c,gdkevents-x11.c,gdkglobals-x11.c,
gdkkeys-x11.c, gdkmain-x11.c, gdkprivate-x11.c,
gdkproperty-x11.c, gdkselection-x11.c, gdkwindow-x11.c}
gtk/{gtkclist.c,gtkctree.c,gtkdnd.c,gtkplug.c,gtksocket.c}
tests/testdnd.c,tests/testselection.c:
Fix up for above atom changes.
* gdk/gdkselection.h (GDK_SELECTION_CLIPBOARD): Add, since we
now have the ability to add custom predefines.
* gtk/{gtkentry.c,gtklabel.c,gtkoldeditable.c,gtktextview.c}:
Use GDK_SELECTION_CLIPBOARD instead of GDK_NONE in calls
to gtk_clipboard_get().
* gdk/win32/gdkproperty-win32.c: Add CLIPBOARD, fix up
for GdkAtom => pointer change.
* gdk/linux-fb/gdkproperty-fb.c: Fix handling of predefined
atoms, fix for GdkAtom => pointer change.
2001-10-22 04:34:42 +00:00
|
|
|
|
prop_type = XA_STRING;
|
2020-02-22 17:33:20 +00:00
|
|
|
|
prop_text = gdk_x11_utf8_to_string_target (utf8_str, TRUE);
|
2002-04-04 23:10:58 +00:00
|
|
|
|
prop_length = prop_text ? strlen (prop_text) : 0;
|
2000-10-04 16:51:42 +00:00
|
|
|
|
prop_format = 8;
|
2004-02-26 18:28:07 +00:00
|
|
|
|
is_compound_text = FALSE;
|
2000-10-04 16:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-02-23 00:33:56 +00:00
|
|
|
|
const char *gdk_type;
|
2010-12-17 04:44:50 +00:00
|
|
|
|
|
|
|
|
|
gdk_x11_display_utf8_to_compound_text (display,
|
|
|
|
|
utf8_str, &gdk_type, &prop_format,
|
|
|
|
|
(guchar **)&prop_text, &prop_length);
|
2020-02-23 00:33:56 +00:00
|
|
|
|
prop_type = gdk_x11_get_xatom_by_name_for_display (display, gdk_type);
|
2004-02-26 18:28:07 +00:00
|
|
|
|
is_compound_text = TRUE;
|
2000-10-04 16:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (prop_text)
|
|
|
|
|
{
|
2002-11-08 22:29:33 +00:00
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
|
|
|
|
|
xwindow,
|
2000-10-04 16:51:42 +00:00
|
|
|
|
property,
|
|
|
|
|
prop_type, prop_format,
|
2005-09-13 19:14:51 +00:00
|
|
|
|
PropModeReplace, (guchar *)prop_text,
|
2000-10-04 16:51:42 +00:00
|
|
|
|
prop_length);
|
|
|
|
|
|
2004-02-26 18:28:07 +00:00
|
|
|
|
if (is_compound_text)
|
2010-12-17 04:44:50 +00:00
|
|
|
|
gdk_x11_free_compound_text ((guchar *)prop_text);
|
2004-02-26 18:28:07 +00:00
|
|
|
|
else
|
|
|
|
|
g_free (prop_text);
|
2000-10-04 16:51:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-11-08 22:29:33 +00:00
|
|
|
|
/* Set WM_NAME and _NET_WM_NAME
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
set_wm_name (GdkDisplay *display,
|
|
|
|
|
Window xwindow,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *name)
|
2002-11-08 22:29:33 +00:00
|
|
|
|
{
|
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xwindow,
|
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME"),
|
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
|
2005-09-13 19:14:51 +00:00
|
|
|
|
PropModeReplace, (guchar *)name, strlen (name));
|
2002-11-08 22:29:33 +00:00
|
|
|
|
|
|
|
|
|
set_text_property (display, xwindow,
|
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "WM_NAME"),
|
|
|
|
|
name);
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_title (GdkSurface *surface,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *title)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
GdkDisplay *display;
|
2002-11-08 22:29:33 +00:00
|
|
|
|
Display *xdisplay;
|
|
|
|
|
Window xwindow;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2001-10-03 18:19:48 +00:00
|
|
|
|
g_return_if_fail (title != NULL);
|
2000-10-04 16:51:42 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2000-10-04 16:51:42 +00:00
|
|
|
|
return;
|
1998-03-08 03:32:05 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2002-11-08 22:29:33 +00:00
|
|
|
|
xdisplay = GDK_DISPLAY_XDISPLAY (display);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xwindow = GDK_SURFACE_XID (surface);
|
2000-10-04 16:51:42 +00:00
|
|
|
|
|
2002-11-08 22:29:33 +00:00
|
|
|
|
set_wm_name (display, xwindow, title);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!gdk_surface_icon_name_set (surface))
|
2001-03-05 15:09:02 +00:00
|
|
|
|
{
|
2002-11-08 22:29:33 +00:00
|
|
|
|
XChangeProperty (xdisplay, xwindow,
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON_NAME"),
|
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
|
2005-09-13 19:14:51 +00:00
|
|
|
|
PropModeReplace, (guchar *)title, strlen (title));
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2002-11-08 22:29:33 +00:00
|
|
|
|
set_text_property (display, xwindow,
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "WM_ICON_NAME"),
|
|
|
|
|
title);
|
2001-03-05 15:09:02 +00:00
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_startup_id (GdkSurface *surface,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *startup_id)
|
2007-03-13 17:03:54 +00:00
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
2009-08-07 16:00:10 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2007-03-13 17:03:54 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2007-03-13 17:03:54 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2009-08-07 16:00:10 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (startup_id)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface),
|
2009-08-07 16:00:10 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"),
|
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
|
|
|
|
|
PropModeReplace, (unsigned char *)startup_id, strlen (startup_id));
|
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XDeleteProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface),
|
2009-08-07 16:00:10 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_STARTUP_ID"));
|
2007-03-13 17:03:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_transient_for (GdkSurface *surface,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurface *parent)
|
1998-12-07 06:37:27 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2017-12-14 01:59:58 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
/* XSetTransientForHint() doesn't allow unsetting, so do it manually */
|
2018-03-20 10:40:08 +00:00
|
|
|
|
if (parent && !GDK_SURFACE_DESTROYED (parent))
|
2020-03-07 17:07:53 +00:00
|
|
|
|
{
|
|
|
|
|
XSetTransientForHint (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
|
|
|
|
GDK_SURFACE_XID (parent));
|
|
|
|
|
gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_DIALOG);
|
|
|
|
|
}
|
2017-12-14 01:59:58 +00:00
|
|
|
|
else
|
2020-03-07 17:07:53 +00:00
|
|
|
|
{
|
|
|
|
|
XDeleteProperty (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface), "WM_TRANSIENT_FOR"));
|
|
|
|
|
gdk_x11_surface_set_type_hint (surface, GDK_SURFACE_TYPE_HINT_NORMAL);
|
|
|
|
|
}
|
1998-12-07 06:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-06-15 18:37:18 +00:00
|
|
|
|
GdkCursor *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_x11_surface_get_cursor (GdkSurface *surface)
|
2005-06-15 18:37:18 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2005-06-15 18:37:18 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
|
2005-06-15 18:37:18 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2005-06-15 18:37:18 +00:00
|
|
|
|
|
|
|
|
|
return impl->cursor;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2008-06-27 14:27:44 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_get_geometry (GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int *x,
|
|
|
|
|
int *y,
|
|
|
|
|
int *width,
|
|
|
|
|
int *height)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
Window root;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int tx;
|
|
|
|
|
int ty;
|
1997-11-24 22:37:52 +00:00
|
|
|
|
guint twidth;
|
|
|
|
|
guint theight;
|
|
|
|
|
guint tborder_width;
|
|
|
|
|
guint tdepth;
|
1998-03-08 03:32:05 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!GDK_SURFACE_DESTROYED (surface))
|
1998-01-26 01:20:14 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2013-06-20 09:40:07 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XGetGeometry (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
1998-01-26 01:20:14 +00:00
|
|
|
|
&root, &tx, &ty, &twidth, &theight, &tborder_width, &tdepth);
|
|
|
|
|
|
|
|
|
|
if (x)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
*x = tx / impl->surface_scale;
|
1998-01-26 01:20:14 +00:00
|
|
|
|
if (y)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
*y = ty / impl->surface_scale;
|
1998-01-26 01:20:14 +00:00
|
|
|
|
if (width)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
*width = twidth / impl->surface_scale;
|
1998-01-26 01:20:14 +00:00
|
|
|
|
if (height)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
*height = theight / impl->surface_scale;
|
1998-01-26 01:20:14 +00:00
|
|
|
|
}
|
1997-11-24 22:37:52 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-02-23 00:09:18 +00:00
|
|
|
|
void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_get_root_coords (GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x,
|
|
|
|
|
int y,
|
|
|
|
|
int *root_x,
|
|
|
|
|
int *root_y)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
1997-11-24 22:37:52 +00:00
|
|
|
|
Window child;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int tx;
|
|
|
|
|
int ty;
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XTranslateCoordinates (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
|
|
|
|
GDK_SURFACE_XROOTWIN (surface),
|
2018-03-20 11:05:26 +00:00
|
|
|
|
x * impl->surface_scale, y * impl->surface_scale, &tx, &ty,
|
2014-02-28 01:58:13 +00:00
|
|
|
|
&child);
|
|
|
|
|
|
2009-06-08 15:03:47 +00:00
|
|
|
|
if (root_x)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
*root_x = tx / impl->surface_scale;
|
2009-06-08 15:03:47 +00:00
|
|
|
|
if (root_y)
|
2018-03-20 11:05:26 +00:00
|
|
|
|
*root_y = ty / impl->surface_scale;
|
1998-11-18 03:15:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_get_frame_extents (GdkSurface *surface,
|
2010-12-15 07:05:05 +00:00
|
|
|
|
GdkRectangle *rect)
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
{
|
2005-01-19 19:53:12 +00:00
|
|
|
|
GdkDisplay *display;
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
Window xwindow;
|
|
|
|
|
Window xparent;
|
|
|
|
|
Window root;
|
2008-06-06 20:57:50 +00:00
|
|
|
|
Window child;
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
Window *children;
|
2005-01-20 01:19:45 +00:00
|
|
|
|
guchar *data;
|
2005-01-19 19:53:12 +00:00
|
|
|
|
Window *vroots;
|
|
|
|
|
Atom type_return;
|
2005-01-20 02:58:03 +00:00
|
|
|
|
guint nchildren;
|
|
|
|
|
guint nvroots;
|
|
|
|
|
gulong nitems_return;
|
|
|
|
|
gulong bytes_after_return;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int format_return;
|
|
|
|
|
int i;
|
2005-01-20 02:58:03 +00:00
|
|
|
|
guint ww, wh, wb, wd;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int wx, wy;
|
2008-05-25 23:14:39 +00:00
|
|
|
|
gboolean got_frame_extents = FALSE;
|
2010-12-15 07:05:05 +00:00
|
|
|
|
|
2001-03-29 23:02:30 +00:00
|
|
|
|
g_return_if_fail (rect != NULL);
|
2010-12-15 07:05:05 +00:00
|
|
|
|
|
2001-03-29 23:02:30 +00:00
|
|
|
|
rect->x = 0;
|
|
|
|
|
rect->y = 0;
|
|
|
|
|
rect->width = 1;
|
|
|
|
|
rect->height = 1;
|
2010-12-15 07:05:05 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (surface);
|
2013-06-20 09:40:07 +00:00
|
|
|
|
|
2002-12-15 03:28:44 +00:00
|
|
|
|
/* Refine our fallback answer a bit using local information */
|
2019-05-29 04:31:04 +00:00
|
|
|
|
rect->x = impl->abs_x * impl->surface_scale;
|
|
|
|
|
rect->y = impl->abs_y * impl->surface_scale;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
rect->width = surface->width * impl->surface_scale;
|
|
|
|
|
rect->height = surface->height * impl->surface_scale;
|
2002-12-15 03:28:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface) || impl->override_redirect)
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
return;
|
2002-12-15 03:28:44 +00:00
|
|
|
|
|
2008-05-25 23:14:39 +00:00
|
|
|
|
nvroots = 0;
|
|
|
|
|
vroots = NULL;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2010-12-15 07:05:05 +00:00
|
|
|
|
|
|
|
|
|
gdk_x11_display_error_trap_push (display);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xwindow = GDK_SURFACE_XID (surface);
|
2005-01-20 02:58:03 +00:00
|
|
|
|
|
2008-05-25 23:14:39 +00:00
|
|
|
|
/* first try: use _NET_FRAME_EXTENTS */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
2017-12-14 04:39:03 +00:00
|
|
|
|
g_intern_static_string ("_NET_FRAME_EXTENTS")) &&
|
2013-01-10 04:40:04 +00:00
|
|
|
|
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), xwindow,
|
2010-12-15 07:05:05 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display,
|
|
|
|
|
"_NET_FRAME_EXTENTS"),
|
|
|
|
|
0, G_MAXLONG, False, XA_CARDINAL, &type_return,
|
|
|
|
|
&format_return, &nitems_return, &bytes_after_return,
|
|
|
|
|
&data)
|
2008-05-25 23:14:39 +00:00
|
|
|
|
== Success)
|
|
|
|
|
{
|
|
|
|
|
if ((type_return == XA_CARDINAL) && (format_return == 32) &&
|
|
|
|
|
(nitems_return == 4) && (data))
|
|
|
|
|
{
|
2008-06-06 20:57:50 +00:00
|
|
|
|
gulong *ldata = (gulong *) data;
|
2008-05-25 23:14:39 +00:00
|
|
|
|
got_frame_extents = TRUE;
|
|
|
|
|
|
|
|
|
|
/* try to get the real client window geometry */
|
|
|
|
|
if (XGetGeometry (GDK_DISPLAY_XDISPLAY (display), xwindow,
|
2008-06-06 20:57:50 +00:00
|
|
|
|
&root, &wx, &wy, &ww, &wh, &wb, &wd) &&
|
|
|
|
|
XTranslateCoordinates (GDK_DISPLAY_XDISPLAY (display),
|
|
|
|
|
xwindow, root, 0, 0, &wx, &wy, &child))
|
|
|
|
|
{
|
2008-05-25 23:14:39 +00:00
|
|
|
|
rect->x = wx;
|
|
|
|
|
rect->y = wy;
|
|
|
|
|
rect->width = ww;
|
|
|
|
|
rect->height = wh;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* _NET_FRAME_EXTENTS format is left, right, top, bottom */
|
|
|
|
|
rect->x -= ldata[0];
|
|
|
|
|
rect->y -= ldata[2];
|
|
|
|
|
rect->width += ldata[0] + ldata[1];
|
|
|
|
|
rect->height += ldata[2] + ldata[3];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (data)
|
|
|
|
|
XFree (data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (got_frame_extents)
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
/* no frame extents property available, which means we either have a WM that
|
|
|
|
|
is not EWMH compliant or is broken - try fallback and walk up the window
|
|
|
|
|
tree to get our window's parent which hopefully is the window frame */
|
|
|
|
|
|
|
|
|
|
/* use NETWM_VIRTUAL_ROOTS if available */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
root = GDK_SURFACE_XROOTWIN (surface);
|
2005-01-20 02:58:03 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
2017-12-14 04:39:03 +00:00
|
|
|
|
g_intern_static_string ("_NET_VIRTUAL_ROOTS")) &&
|
2013-01-10 04:40:04 +00:00
|
|
|
|
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), root,
|
2005-01-19 19:53:12 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display,
|
|
|
|
|
"_NET_VIRTUAL_ROOTS"),
|
2005-01-20 02:58:03 +00:00
|
|
|
|
0, G_MAXLONG, False, XA_WINDOW, &type_return,
|
2005-01-19 19:53:12 +00:00
|
|
|
|
&format_return, &nitems_return, &bytes_after_return,
|
2005-01-20 01:19:45 +00:00
|
|
|
|
&data)
|
2005-01-19 19:53:12 +00:00
|
|
|
|
== Success)
|
|
|
|
|
{
|
2005-01-20 01:19:45 +00:00
|
|
|
|
if ((type_return == XA_WINDOW) && (format_return == 32) && (data))
|
|
|
|
|
{
|
|
|
|
|
nvroots = nitems_return;
|
|
|
|
|
vroots = (Window *)data;
|
|
|
|
|
}
|
2005-01-19 19:53:12 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xparent = GDK_SURFACE_XID (surface);
|
2005-01-20 02:58:03 +00:00
|
|
|
|
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
xwindow = xparent;
|
2005-01-20 02:58:03 +00:00
|
|
|
|
|
|
|
|
|
if (!XQueryTree (GDK_DISPLAY_XDISPLAY (display), xwindow,
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
&root, &xparent,
|
|
|
|
|
&children, &nchildren))
|
2008-05-25 23:14:39 +00:00
|
|
|
|
goto out;
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
if (children)
|
|
|
|
|
XFree (children);
|
2005-01-19 19:53:12 +00:00
|
|
|
|
|
|
|
|
|
/* check virtual roots */
|
|
|
|
|
for (i = 0; i < nvroots; i++)
|
|
|
|
|
{
|
|
|
|
|
if (xparent == vroots[i])
|
|
|
|
|
{
|
|
|
|
|
root = xparent;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
}
|
|
|
|
|
while (xparent != root);
|
2010-12-15 07:05:05 +00:00
|
|
|
|
|
|
|
|
|
if (XGetGeometry (GDK_DISPLAY_XDISPLAY (display), xwindow,
|
2005-01-19 19:53:12 +00:00
|
|
|
|
&root, &wx, &wy, &ww, &wh, &wb, &wd))
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
{
|
2005-01-19 19:53:12 +00:00
|
|
|
|
rect->x = wx;
|
|
|
|
|
rect->y = wy;
|
|
|
|
|
rect->width = ww;
|
|
|
|
|
rect->height = wh;
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
}
|
2002-12-15 03:28:44 +00:00
|
|
|
|
|
2008-05-25 23:14:39 +00:00
|
|
|
|
out:
|
2005-01-19 19:53:12 +00:00
|
|
|
|
if (vroots)
|
|
|
|
|
XFree (vroots);
|
|
|
|
|
|
2014-11-20 09:42:55 +00:00
|
|
|
|
/* Here we extend the size to include the extra pixels if we round x/y down
|
|
|
|
|
as well as round the size up when we divide by scale so that the returned
|
|
|
|
|
size is guaranteed to cover the real pixels, but it may overshoot a bit
|
|
|
|
|
in case the window is not positioned/sized according to the scale */
|
2018-03-20 11:05:26 +00:00
|
|
|
|
rect->width = (rect->width + rect->x % impl->surface_scale + impl->surface_scale - 1) / impl->surface_scale;
|
|
|
|
|
rect->height = (rect->height + rect->y % impl->surface_scale + impl->surface_scale - 1) / impl->surface_scale;
|
|
|
|
|
rect->x = rect->x / impl->surface_scale;
|
|
|
|
|
rect->y = rect->y / impl->surface_scale;
|
2010-12-15 07:05:05 +00:00
|
|
|
|
gdk_x11_display_error_trap_pop_ignored (display);
|
new function to get the *real* geometry position of a window, taken
Sat Sep 25 23:33:55 1998 Tim Janik <timj@gtk.org>
* gdk/gdkwindow.c (gdk_window_get_root_origin): new function to get
the *real* geometry position of a window, taken possible window
manager offsets into account.
this has been succesfully tested with fvwm, fvwm-2, bowman, olwm,
olvwm, twm, ctwm, mlvwm, windowmaker and enlightenment.
it does fail though for amiwm which adds windows to a pseudo root
window, and for icewm by a small offset because it defines the
geometry position whithin its border.
* gtk/testgtk.c: added "saved position" test to figure how
gdk_window_get_root_origin() interacts with window managers (repopup
this window to figure ;).
1998-09-25 23:04:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
2009-06-04 17:21:20 +00:00
|
|
|
|
static gboolean
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_get_device_state (GdkSurface *surface,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkDevice *device,
|
2020-07-24 20:32:16 +00:00
|
|
|
|
double *x,
|
|
|
|
|
double *y,
|
2010-05-25 22:38:44 +00:00
|
|
|
|
GdkModifierType *mask)
|
1997-11-24 22:37:52 +00:00
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurface *child;
|
1999-10-03 22:12:41 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2010-12-13 22:43:10 +00:00
|
|
|
|
return FALSE;
|
Changes multihead reorganizing code for win32 support, mostly from a patch
Wed Jun 5 18:34:47 2002 Owen Taylor <otaylor@redhat.com>
Changes multihead reorganizing code for win32 support,
mostly from a patch by Hans Breuer.
* gdk/gdkcolor.c gdk/x11/gdkcolor-x11.c gdk/gdkcursor.c
gdk/x11/gdkcursor-x11.c gdk/gdkevents.c gdk/x11/gdkevents-x11.c
gdk/gdkfont.c gdk/x11/gdkfont-x11.c gdk/gdkkeys.c
gdk/x11/gdkkeys-x11.c gdk/gdkimage.c gdk/x11/gdkimage-x11.c
gdk/gdkscreen.c gdk/x11/gdkmain-x11.c
gdk/gdkdisplay.c gdk/gdkevents-x11.c gdk/gdkpango.c
gdk/x11/gdkpango-x11.c gdk/gdkselection.c
gdk/x11/gdkselection-x11.c gdk/gdkwindow.c
gdk/x11/gdkwindow-x11.c gdk/gdkvisual.c gdk/x11/gdkvisual-x11.c:
Move port-independent singlehead wrapper functions into
port-independent part of GDK. (#80009)
* gdk/win32/gdkcolor-win32.c gdk/win32/gdkcursor-win32.c
gdk/win32/gdkevents-win32.c gdk/win32/gdkfont-win32.c
gdk/win32/gdkimage-win32.c gdk/win32/gdkkeys-win32.c
gdk/win32/gdkmain-win32.c gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c gdk/win32/gkwindow-win32.c:
Turn singlehead functions into "multihead" functions that ignore
their GdkDisplay or GdkScreen arguments.
* gdk/win32/gdkdrawable-win32.c gdk/win32/gdkevents-win32.c
gdk/win32/gdkinput-win32.c gdk/win32/gdkprivate-win32.h:
Misc multihead-compatibility changes.
* gtk/gtk.def gdk/gdk.def: Update for multihead functions.
* gdk/gdkcolormap.h gdk/gdkvisual.h gdk/x11/gdkcolormap-x11.c
gdk/x11/gdkvisual-x11.c: Remove the screen fields
from the public parts of the colormap/visual structures, add accessors
instead.
* gdk/gdkpixbuf-render.c gdk/gdkpixmap.c gdk/gdkrgb.c
gdk/x11/gdkcolormap-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkimage-x11.c gdk/x11/gdkprivate-x11.h gtk/gtkgc.c
gtk/gtkstyle.c gtk/gtkwidget.c: Use accessors to get the screen
for colormaps, visuals; move the fields into the private
structures for the x11 backend.
* gdk/gdkdisplay.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/gdkscreen.[ch] gdk/x11/gdkscreen-x11.c:
Remove virtualization of screen and display functions.
(#79990, patch from Erwann Chenede)
* gdk/win32/gdkdisplay-x11.c gdk/win32/gdkscreen-win32.c
gdk/win32/{Makefile.am, makefile.msc, makefile.mingw}:
New files containing stub implementations of Display,
Screen functions.
* gdk/x11/gdkscreen-x11.[ch] gdk/x11/gdkdisplay-x11.[ch]
gdk/x11/gdkx.h: Clean up function exports and what
headers they are in. (#79954)
* gdk/x11/gdkx.h: Fix macro that was referring to a non-existant
screen->screen_num. (In the patch for #79972, Erwann Chenede)
* gdk/gdkscreen.c gdk/gdkwindow.c gdk/x11/gdkinternals.h
gdk/x11/gdkscreen-x11.c: Fix gdk_screen_get_window_at_pointer()
to use window hooks. (#79972, patch partly from Erwann Chenede)
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkevents-x11.c: Fix
some warnings.
2002-06-06 00:26:42 +00:00
|
|
|
|
|
2020-08-26 20:06:11 +00:00
|
|
|
|
gdk_x11_device_xi2_query_state (device, surface, &child, x, y, mask);
|
2010-12-13 22:43:10 +00:00
|
|
|
|
return child != NULL;
|
1998-06-17 08:48:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-21 19:15:21 +00:00
|
|
|
|
static void
|
2020-03-01 19:29:06 +00:00
|
|
|
|
gdk_x11_surface_set_input_region (GdkSurface *surface,
|
|
|
|
|
cairo_region_t *input_region)
|
2006-02-20 01:36:50 +00:00
|
|
|
|
{
|
2018-03-21 19:15:21 +00:00
|
|
|
|
#ifdef ShapeInput
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2013-06-20 09:40:07 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-03-02 20:02:17 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-21 19:15:21 +00:00
|
|
|
|
if (!gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface)))
|
|
|
|
|
return;
|
|
|
|
|
|
2020-03-01 19:29:06 +00:00
|
|
|
|
if (input_region == NULL)
|
2001-03-02 20:02:17 +00:00
|
|
|
|
{
|
2018-03-21 19:15:21 +00:00
|
|
|
|
XShapeCombineMask (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
|
|
|
|
ShapeInput,
|
|
|
|
|
0, 0,
|
|
|
|
|
None,
|
|
|
|
|
ShapeSet);
|
2001-03-02 20:02:17 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
2018-03-21 19:15:21 +00:00
|
|
|
|
else
|
2001-03-02 20:02:17 +00:00
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int n_rects = 0;
|
2001-03-02 20:02:17 +00:00
|
|
|
|
XRectangle *xrects = NULL;
|
|
|
|
|
|
2020-03-01 19:29:06 +00:00
|
|
|
|
_gdk_x11_region_get_xrectangles (input_region,
|
2018-03-20 11:05:26 +00:00
|
|
|
|
0, 0, impl->surface_scale,
|
2010-12-15 22:32:29 +00:00
|
|
|
|
&xrects, &n_rects);
|
2001-03-02 20:02:17 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XShapeCombineRectangles (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
2018-03-21 19:15:21 +00:00
|
|
|
|
ShapeInput,
|
2020-03-01 19:29:06 +00:00
|
|
|
|
0, 0,
|
2001-03-02 20:02:17 +00:00
|
|
|
|
xrects, n_rects,
|
|
|
|
|
ShapeSet,
|
|
|
|
|
YXBanded);
|
2009-01-14 20:20:26 +00:00
|
|
|
|
|
2001-03-02 20:02:17 +00:00
|
|
|
|
g_free (xrects);
|
|
|
|
|
}
|
2006-02-20 01:36:50 +00:00
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-06 02:57:01 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_x11_surface_set_user_time:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): A toplevel #GdkSurface
|
2004-04-18 14:33:07 +00:00
|
|
|
|
* @timestamp: An XServer timestamp to which the property should be set
|
|
|
|
|
*
|
|
|
|
|
* The application can use this call to update the _NET_WM_USER_TIME
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* property on a toplevel surface. This property stores an Xserver
|
2004-04-18 14:33:07 +00:00
|
|
|
|
* time which represents the time of the last user input event
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* received for this surface. This property may be used by the window
|
2004-04-18 14:33:07 +00:00
|
|
|
|
* manager to alter the focus, stacking, and/or placement behavior of
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* surfaces when they are mapped depending on whether the new surface
|
|
|
|
|
* was created by a user action or is a "pop-up" surface activated by a
|
2004-04-18 14:33:07 +00:00
|
|
|
|
* timer or some other event.
|
|
|
|
|
*
|
|
|
|
|
* Note that this property is automatically updated by GDK, so this
|
|
|
|
|
* function should only be used by applications which handle input
|
|
|
|
|
* events bypassing GDK.
|
|
|
|
|
**/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_user_time (GdkSurface *surface,
|
2004-05-06 02:57:01 +00:00
|
|
|
|
guint32 timestamp)
|
2004-04-18 14:33:07 +00:00
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
2010-12-20 16:14:04 +00:00
|
|
|
|
GdkX11Display *display_x11;
|
2004-08-23 17:10:34 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
2004-07-07 02:59:47 +00:00
|
|
|
|
glong timestamp_long = (glong)timestamp;
|
2007-04-01 03:38:34 +00:00
|
|
|
|
Window xid;
|
2004-04-18 14:33:07 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2004-04-18 14:33:07 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2010-12-20 18:20:10 +00:00
|
|
|
|
display_x11 = GDK_X11_DISPLAY (display);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2004-04-18 14:33:07 +00:00
|
|
|
|
|
2007-04-01 03:38:34 +00:00
|
|
|
|
if (!toplevel)
|
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
g_warning ("gdk_surface_set_user_time called on non-toplevel\n");
|
2007-04-01 03:38:34 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (toplevel->focus_window != None &&
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
2017-12-14 04:39:03 +00:00
|
|
|
|
g_intern_static_string ("_NET_WM_USER_TIME_WINDOW")))
|
2007-04-01 03:38:34 +00:00
|
|
|
|
xid = toplevel->focus_window;
|
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xid = GDK_SURFACE_XID (surface);
|
2007-04-01 03:38:34 +00:00
|
|
|
|
|
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display), xid,
|
2004-04-18 14:33:07 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_USER_TIME"),
|
|
|
|
|
XA_CARDINAL, 32, PropModeReplace,
|
2004-07-07 02:59:47 +00:00
|
|
|
|
(guchar *)×tamp_long, 1);
|
2004-04-18 14:33:07 +00:00
|
|
|
|
|
2009-04-07 13:37:40 +00:00
|
|
|
|
if (timestamp_long != GDK_CURRENT_TIME &&
|
|
|
|
|
(display_x11->user_time == GDK_CURRENT_TIME ||
|
|
|
|
|
XSERVER_TIME_IS_LATER (timestamp_long, display_x11->user_time)))
|
2004-07-07 02:59:47 +00:00
|
|
|
|
display_x11->user_time = timestamp_long;
|
2004-08-23 17:10:34 +00:00
|
|
|
|
|
2007-01-30 18:36:44 +00:00
|
|
|
|
if (toplevel)
|
|
|
|
|
toplevel->user_time = timestamp_long;
|
2004-04-18 14:33:07 +00:00
|
|
|
|
}
|
2001-03-05 15:09:02 +00:00
|
|
|
|
|
2011-03-20 13:37:27 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_x11_surface_set_utf8_property:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a #GdkSurface
|
2011-11-25 22:21:05 +00:00
|
|
|
|
* @name: Property name, will be interned as an X atom
|
|
|
|
|
* @value: (allow-none): Property value, or %NULL to delete
|
2011-03-20 13:37:27 +00:00
|
|
|
|
*
|
2011-11-25 22:21:05 +00:00
|
|
|
|
* This function modifies or removes an arbitrary X11 window
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* property of type UTF8_STRING. If the given @surface is
|
|
|
|
|
* not a toplevel surface, it is ignored.
|
2011-03-20 13:37:27 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_utf8_property (GdkSurface *surface,
|
2020-07-24 18:40:36 +00:00
|
|
|
|
const char *name,
|
|
|
|
|
const char *value)
|
2011-03-20 13:37:27 +00:00
|
|
|
|
{
|
2011-04-03 21:40:37 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2011-03-20 13:37:27 +00:00
|
|
|
|
|
2011-11-25 22:21:05 +00:00
|
|
|
|
if (value != NULL)
|
2011-03-20 13:37:27 +00:00
|
|
|
|
{
|
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2011-11-25 22:21:05 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, name),
|
2011-03-20 13:37:27 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"), 8,
|
2011-11-25 22:21:05 +00:00
|
|
|
|
PropModeReplace, (guchar *)value, strlen (value));
|
2011-03-20 13:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
XDeleteProperty (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2011-11-25 22:21:05 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, name));
|
2011-03-20 13:37:27 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-12-13 03:38:12 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_shadow_width (GdkSurface *surface,
|
2013-12-13 03:38:12 +00:00
|
|
|
|
int left,
|
|
|
|
|
int right,
|
|
|
|
|
int top,
|
|
|
|
|
int bottom)
|
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2013-12-13 03:38:12 +00:00
|
|
|
|
Atom frame_extents;
|
2014-10-27 23:54:33 +00:00
|
|
|
|
gulong data[4] = {
|
2018-03-20 11:05:26 +00:00
|
|
|
|
left * impl->surface_scale,
|
|
|
|
|
right * impl->surface_scale,
|
|
|
|
|
top * impl->surface_scale,
|
|
|
|
|
bottom * impl->surface_scale
|
2014-10-27 23:54:33 +00:00
|
|
|
|
};
|
2013-12-13 03:38:12 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
frame_extents = gdk_x11_get_xatom_by_name_for_display (gdk_surface_get_display (surface),
|
2013-12-13 03:38:12 +00:00
|
|
|
|
"_GTK_FRAME_EXTENTS");
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XChangeProperty (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
2013-12-13 03:38:12 +00:00
|
|
|
|
frame_extents, XA_CARDINAL,
|
|
|
|
|
32, PropModeReplace,
|
|
|
|
|
(guchar *) &data, 4);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-25 22:21:05 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_x11_surface_set_theme_variant:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a #GdkSurface
|
2011-11-25 22:21:05 +00:00
|
|
|
|
* @variant: the theme variant to export
|
|
|
|
|
*
|
|
|
|
|
* GTK+ applications can request a dark theme variant. In order to
|
|
|
|
|
* make other applications - namely window managers using GTK+ for
|
|
|
|
|
* themeing - aware of this choice, GTK+ uses this function to
|
|
|
|
|
* export the requested theme variant as _GTK_THEME_VARIANT property
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* on toplevel surfaces.
|
2011-11-25 22:21:05 +00:00
|
|
|
|
*
|
|
|
|
|
* Note that this property is automatically updated by GTK+, so this
|
|
|
|
|
* function should only be used by applications which do not use GTK+
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* to create toplevel surfaces.
|
2011-11-25 22:21:05 +00:00
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_theme_variant (GdkSurface *surface,
|
2016-10-15 20:13:04 +00:00
|
|
|
|
const char *variant)
|
2011-11-25 22:21:05 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_utf8_property (surface, "_GTK_THEME_VARIANT",
|
2016-02-04 09:52:07 +00:00
|
|
|
|
variant ? variant : "");
|
2011-11-25 22:21:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
2005-11-08 18:26:37 +00:00
|
|
|
|
#define GDK_SELECTION_MAX_SIZE(display) \
|
|
|
|
|
MIN(262144, \
|
|
|
|
|
XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) == 0 \
|
|
|
|
|
? XMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100 \
|
|
|
|
|
: XExtendedMaxRequestSize (GDK_DISPLAY_XDISPLAY (display)) - 100)
|
|
|
|
|
|
2010-08-12 02:21:49 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_update_icon (GdkSurface *surface,
|
2010-08-12 02:21:49 +00:00
|
|
|
|
GList *icon_list)
|
|
|
|
|
{
|
|
|
|
|
GdkToplevelX11 *toplevel;
|
2017-11-04 19:23:33 +00:00
|
|
|
|
GdkTexture *best_icon;
|
2010-08-12 02:21:49 +00:00
|
|
|
|
GList *tmp_list;
|
|
|
|
|
int best_size;
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2010-08-12 02:21:49 +00:00
|
|
|
|
|
|
|
|
|
if (toplevel->icon_pixmap != NULL)
|
|
|
|
|
{
|
2010-08-27 10:08:30 +00:00
|
|
|
|
cairo_surface_destroy (toplevel->icon_pixmap);
|
2010-08-12 02:21:49 +00:00
|
|
|
|
toplevel->icon_pixmap = NULL;
|
|
|
|
|
}
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2010-08-12 02:21:49 +00:00
|
|
|
|
if (toplevel->icon_mask != NULL)
|
|
|
|
|
{
|
2010-08-27 10:08:30 +00:00
|
|
|
|
cairo_surface_destroy (toplevel->icon_mask);
|
2010-08-12 02:21:49 +00:00
|
|
|
|
toplevel->icon_mask = NULL;
|
|
|
|
|
}
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2010-08-12 02:21:49 +00:00
|
|
|
|
#define IDEAL_SIZE 48
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2010-08-12 02:21:49 +00:00
|
|
|
|
best_size = G_MAXINT;
|
|
|
|
|
best_icon = NULL;
|
|
|
|
|
for (tmp_list = icon_list; tmp_list; tmp_list = tmp_list->next)
|
|
|
|
|
{
|
2017-11-04 19:23:33 +00:00
|
|
|
|
GdkTexture *texture = tmp_list->data;
|
2010-08-12 02:21:49 +00:00
|
|
|
|
int this;
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2010-08-12 02:21:49 +00:00
|
|
|
|
/* average width and height - if someone passes in a rectangular
|
|
|
|
|
* icon they deserve what they get.
|
|
|
|
|
*/
|
2017-11-04 19:23:33 +00:00
|
|
|
|
this = gdk_texture_get_width (texture) + gdk_texture_get_height (texture);
|
2010-08-12 02:21:49 +00:00
|
|
|
|
this /= 2;
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2010-08-12 02:21:49 +00:00
|
|
|
|
if (best_icon == NULL)
|
|
|
|
|
{
|
2017-11-04 19:23:33 +00:00
|
|
|
|
best_icon = texture;
|
2010-08-12 02:21:49 +00:00
|
|
|
|
best_size = this;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* icon is better if it's 32 pixels or larger, and closer to
|
|
|
|
|
* the ideal size than the current best.
|
|
|
|
|
*/
|
|
|
|
|
if (this >= 32 &&
|
|
|
|
|
(ABS (best_size - IDEAL_SIZE) <
|
|
|
|
|
ABS (this - IDEAL_SIZE)))
|
|
|
|
|
{
|
2017-11-04 19:23:33 +00:00
|
|
|
|
best_icon = texture;
|
2010-08-12 02:21:49 +00:00
|
|
|
|
best_size = this;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (best_icon)
|
2010-08-27 10:08:30 +00:00
|
|
|
|
{
|
2017-11-04 19:23:33 +00:00
|
|
|
|
int width = gdk_texture_get_width (best_icon);
|
|
|
|
|
int height = gdk_texture_get_height (best_icon);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cairo_surface_t *cairo_surface;
|
2010-08-27 10:08:30 +00:00
|
|
|
|
cairo_t *cr;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel->icon_pixmap = gdk_x11_surface_create_pixmap_surface (surface, width, height);
|
2010-08-27 10:08:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cairo_surface = gdk_texture_download_surface (best_icon);
|
2017-11-04 19:23:33 +00:00
|
|
|
|
|
2010-08-27 10:08:30 +00:00
|
|
|
|
cr = cairo_create (toplevel->icon_pixmap);
|
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cairo_set_source_surface (cr, cairo_surface, 0, 0);
|
|
|
|
|
if (cairo_surface_get_content (cairo_surface) == CAIRO_CONTENT_COLOR_ALPHA)
|
2010-08-27 10:08:30 +00:00
|
|
|
|
{
|
|
|
|
|
/* Saturate the image, so it has bilevel alpha */
|
|
|
|
|
cairo_push_group_with_content (cr, CAIRO_CONTENT_COLOR_ALPHA);
|
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SATURATE);
|
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_pop_group_to_source (cr);
|
|
|
|
|
}
|
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_destroy (cr);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (cairo_surface_get_content (cairo_surface) == CAIRO_CONTENT_COLOR_ALPHA)
|
2010-08-27 10:08:30 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkDisplay *display = gdk_surface_get_display (surface);
|
2017-11-09 23:40:16 +00:00
|
|
|
|
|
|
|
|
|
toplevel->icon_mask = _gdk_x11_display_create_bitmap_surface (display, width, height);
|
2010-08-27 10:08:30 +00:00
|
|
|
|
|
|
|
|
|
cr = cairo_create (toplevel->icon_mask);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cairo_set_source_surface (cr, cairo_surface, 0, 0);
|
2010-08-27 10:08:30 +00:00
|
|
|
|
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
|
|
|
|
|
cairo_paint (cr);
|
|
|
|
|
cairo_destroy (cr);
|
|
|
|
|
}
|
2017-11-04 19:23:33 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
cairo_surface_destroy (cairo_surface);
|
2010-08-27 10:08:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
update_wm_hints (surface, FALSE);
|
2010-08-12 02:21:49 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_icon_list (GdkSurface *surface,
|
2017-11-04 19:23:33 +00:00
|
|
|
|
GList *textures)
|
2001-03-05 15:09:02 +00:00
|
|
|
|
{
|
2001-10-26 23:43:32 +00:00
|
|
|
|
gulong *data;
|
|
|
|
|
gulong *p;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int size;
|
2001-03-05 15:09:02 +00:00
|
|
|
|
GList *l;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int width, height;
|
2017-11-04 19:23:33 +00:00
|
|
|
|
GdkTexture *texture;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
GdkDisplay *display;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int i, n;
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-08-29 02:20:02 +00:00
|
|
|
|
return;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2001-03-05 15:09:02 +00:00
|
|
|
|
size = 0;
|
2005-11-08 18:26:37 +00:00
|
|
|
|
n = 0;
|
2017-11-04 19:23:33 +00:00
|
|
|
|
for (l = textures; l != NULL; l = l->next)
|
2001-03-05 15:09:02 +00:00
|
|
|
|
{
|
2017-11-04 19:23:33 +00:00
|
|
|
|
texture = l->data;
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2017-11-04 19:23:33 +00:00
|
|
|
|
width = gdk_texture_get_width (texture);
|
|
|
|
|
height = gdk_texture_get_height (texture);
|
2001-03-05 15:09:02 +00:00
|
|
|
|
|
2005-11-08 18:26:37 +00:00
|
|
|
|
/* silently ignore overlarge icons */
|
|
|
|
|
if (size + 2 + width * height > GDK_SELECTION_MAX_SIZE(display))
|
2017-10-23 11:43:50 +00:00
|
|
|
|
break;
|
|
|
|
|
|
2005-11-08 18:26:37 +00:00
|
|
|
|
n++;
|
2001-03-05 15:09:02 +00:00
|
|
|
|
size += 2 + width * height;
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-26 23:43:32 +00:00
|
|
|
|
data = g_malloc (size * sizeof (gulong));
|
2001-03-05 15:09:02 +00:00
|
|
|
|
|
|
|
|
|
p = data;
|
2017-11-04 19:23:33 +00:00
|
|
|
|
for (l = textures; l != NULL && n > 0; l = l->next)
|
2001-03-05 15:09:02 +00:00
|
|
|
|
{
|
2017-11-04 19:23:33 +00:00
|
|
|
|
texture = l->data;
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2017-11-04 19:23:33 +00:00
|
|
|
|
width = gdk_texture_get_width (texture);
|
|
|
|
|
height = gdk_texture_get_height (texture);
|
2017-10-23 11:43:50 +00:00
|
|
|
|
|
2001-03-05 15:09:02 +00:00
|
|
|
|
*p++ = width;
|
|
|
|
|
*p++ = height;
|
|
|
|
|
|
2017-11-04 19:23:33 +00:00
|
|
|
|
gdk_texture_download (texture, (guchar *) p, width * 4);
|
2017-11-07 11:22:48 +00:00
|
|
|
|
if (sizeof (gulong) > 4)
|
|
|
|
|
{
|
|
|
|
|
i = width * height;
|
|
|
|
|
while (i-- > 0)
|
|
|
|
|
p[i] = ((guint32 *) p)[i];
|
|
|
|
|
}
|
2001-03-05 15:09:02 +00:00
|
|
|
|
|
2017-11-04 19:23:33 +00:00
|
|
|
|
p += width * height;
|
2005-11-08 18:26:37 +00:00
|
|
|
|
n--;
|
2001-03-05 15:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-08-29 02:20:02 +00:00
|
|
|
|
if (size > 0)
|
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON"),
|
2001-08-29 02:20:02 +00:00
|
|
|
|
XA_CARDINAL, 32,
|
|
|
|
|
PropModeReplace,
|
|
|
|
|
(guchar*) data, size);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
XDeleteProperty (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_ICON"));
|
2001-08-29 02:20:02 +00:00
|
|
|
|
}
|
2001-11-25 22:19:22 +00:00
|
|
|
|
|
|
|
|
|
g_free (data);
|
2010-08-12 02:21:49 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_update_icon (surface, textures);
|
2001-03-05 15:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-10-04 16:51:42 +00:00
|
|
|
|
static gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_icon_name_set (GdkSurface *surface)
|
2000-10-04 16:51:42 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
return GPOINTER_TO_UINT (g_object_get_qdata (G_OBJECT (surface),
|
2000-10-04 16:51:42 +00:00
|
|
|
|
g_quark_from_static_string ("gdk-icon-name-set")));
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2019-11-16 19:50:57 +00:00
|
|
|
|
gdk_x11_surface_minimize (GdkSurface *surface)
|
2000-10-04 16:51:42 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-02-27 20:40:15 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XIconifyWindow (GDK_SURFACE_XDISPLAY (surface),
|
|
|
|
|
GDK_SURFACE_XID (surface),
|
|
|
|
|
gdk_x11_screen_get_screen_number (GDK_SURFACE_SCREEN (surface)));
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Flip our client side flag, the real work happens on map. */
|
2019-11-16 19:50:57 +00:00
|
|
|
|
gdk_synthesize_surface_state (surface, 0, GDK_SURFACE_STATE_MINIMIZED);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_wmspec_change_state (TRUE, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_HIDDEN",
|
2017-11-15 17:13:31 +00:00
|
|
|
|
NULL);
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2019-11-16 19:50:57 +00:00
|
|
|
|
gdk_x11_surface_unminimize (GdkSurface *surface)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2000-10-04 16:51:42 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2020-03-09 17:20:13 +00:00
|
|
|
|
gdk_x11_surface_show (surface, TRUE);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_wmspec_change_state (FALSE, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_HIDDEN",
|
2017-11-15 17:13:31 +00:00
|
|
|
|
NULL);
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Flip our client side flag, the real work happens on map. */
|
2019-11-16 19:50:57 +00:00
|
|
|
|
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_MINIMIZED, 0);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_wmspec_change_state (FALSE, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_HIDDEN",
|
2017-11-15 17:13:31 +00:00
|
|
|
|
NULL);
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_maximize (GdkSurface *surface)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-02-27 20:40:15 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
gdk_wmspec_change_state (TRUE, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_MAXIMIZED_VERT",
|
|
|
|
|
"_NET_WM_STATE_MAXIMIZED_HORZ");
|
2001-02-27 20:40:15 +00:00
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_synthesize_surface_state (surface,
|
2001-03-05 15:09:02 +00:00
|
|
|
|
0,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GDK_SURFACE_STATE_MAXIMIZED);
|
2001-02-27 20:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_unmaximize (GdkSurface *surface)
|
2001-02-27 20:40:15 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-02-27 20:40:15 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
gdk_wmspec_change_state (FALSE, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_MAXIMIZED_VERT",
|
|
|
|
|
"_NET_WM_STATE_MAXIMIZED_HORZ");
|
2001-02-27 20:40:15 +00:00
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_synthesize_surface_state (surface,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GDK_SURFACE_STATE_MAXIMIZED,
|
2001-03-05 15:09:02 +00:00
|
|
|
|
0);
|
1998-02-27 03:55:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_apply_fullscreen_mode (GdkSurface *surface)
|
2002-09-25 19:16:46 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2002-09-25 19:16:46 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2013-01-21 10:52:32 +00:00
|
|
|
|
/* _NET_WM_FULLSCREEN_MONITORS gives an indication to the window manager as
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* to which monitors so span across when the surface is fullscreen, but it's
|
|
|
|
|
* not a state in itself so this would have no effect if the surface is not
|
2013-01-21 10:52:32 +00:00
|
|
|
|
* mapped.
|
|
|
|
|
*/
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
2013-01-21 10:52:32 +00:00
|
|
|
|
{
|
|
|
|
|
XClientMessageEvent xclient;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int monitors[4];
|
|
|
|
|
int i;
|
2013-01-21 10:52:32 +00:00
|
|
|
|
|
|
|
|
|
memset (&xclient, 0, sizeof (xclient));
|
|
|
|
|
xclient.type = ClientMessage;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xclient.window = GDK_SURFACE_XID (surface);
|
|
|
|
|
xclient.display = GDK_SURFACE_XDISPLAY (surface);
|
2013-01-21 10:52:32 +00:00
|
|
|
|
xclient.format = 32;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
switch (surface->fullscreen_mode)
|
2013-01-21 10:52:32 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_FULLSCREEN_ON_CURRENT_MONITOR:
|
|
|
|
|
|
|
|
|
|
/* FIXME: This is not part of the EWMH spec!
|
|
|
|
|
*
|
|
|
|
|
* There is no documented mechanism to remove the property
|
2020-05-28 08:00:03 +00:00
|
|
|
|
* _NET_WM_FULLSCREEN_MONITORS once set, so we use a set of
|
2013-01-21 10:52:32 +00:00
|
|
|
|
* invalid, largest possible value.
|
|
|
|
|
*
|
|
|
|
|
* When given values larger than actual possible monitor values, most
|
|
|
|
|
* window managers who support the _NET_WM_FULLSCREEN_MONITORS spec
|
|
|
|
|
* will simply unset _NET_WM_FULLSCREEN_MONITORS and revert to their
|
|
|
|
|
* default behavior.
|
|
|
|
|
*
|
|
|
|
|
* Successfully tested on mutter/metacity, kwin, compiz and xfwm4.
|
|
|
|
|
*
|
|
|
|
|
* Note, this (non documented) mechanism is unlikely to be an issue
|
|
|
|
|
* as it's used only for transitionning back from "all monitors" to
|
|
|
|
|
* "current monitor" mode.
|
|
|
|
|
*
|
|
|
|
|
* Applications who don't change the default mode won't trigger this
|
|
|
|
|
* mechanism.
|
|
|
|
|
*/
|
|
|
|
|
for (i = 0; i < 4; ++i)
|
|
|
|
|
xclient.data.l[i] = G_MAXLONG;
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case GDK_FULLSCREEN_ON_ALL_MONITORS:
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_gdk_x11_screen_get_edge_monitors (GDK_SURFACE_SCREEN (surface),
|
2016-04-28 03:08:25 +00:00
|
|
|
|
&monitors[0],
|
|
|
|
|
&monitors[1],
|
|
|
|
|
&monitors[2],
|
|
|
|
|
&monitors[3]);
|
2013-01-21 10:52:32 +00:00
|
|
|
|
/* Translate all 4 monitors from the GDK set into XINERAMA indices */
|
|
|
|
|
for (i = 0; i < 4; ++i)
|
|
|
|
|
{
|
2016-04-28 03:08:25 +00:00
|
|
|
|
xclient.data.l[i] = monitors[i];
|
2013-01-21 10:52:32 +00:00
|
|
|
|
/* Sanity check, if XINERAMA is not available, we could have invalid
|
|
|
|
|
* negative values for the XINERAMA indices.
|
|
|
|
|
*/
|
|
|
|
|
if (xclient.data.l[i] < 0)
|
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
g_warning ("gdk_x11_surface_apply_fullscreen_mode: Invalid XINERAMA monitor index");
|
2013-01-21 10:52:32 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
2018-03-20 10:40:08 +00:00
|
|
|
|
g_warning ("gdk_x11_surface_apply_fullscreen_mode: Unhandled fullscreen mode %d",
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface->fullscreen_mode);
|
2013-01-21 10:52:32 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Send fullscreen monitors client message */
|
|
|
|
|
xclient.data.l[4] = 1; /* source indication */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface),
|
2013-01-21 10:52:32 +00:00
|
|
|
|
"_NET_WM_FULLSCREEN_MONITORS");
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSendEvent (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XROOTWIN (surface), False,
|
2013-01-21 10:52:32 +00:00
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
|
|
|
|
(XEvent *)&xclient);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_fullscreen (GdkSurface *surface)
|
2013-01-21 10:52:32 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2013-01-21 10:52:32 +00:00
|
|
|
|
return;
|
2002-09-25 19:16:46 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
2013-01-21 10:52:32 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_wmspec_change_state (TRUE, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_FULLSCREEN",
|
2017-11-15 17:13:31 +00:00
|
|
|
|
NULL);
|
2013-01-21 10:52:32 +00:00
|
|
|
|
/* Actual XRandR layout may have change since we computed the fullscreen
|
|
|
|
|
* monitors in GDK_FULLSCREEN_ON_ALL_MONITORS mode.
|
|
|
|
|
*/
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (surface->fullscreen_mode == GDK_FULLSCREEN_ON_ALL_MONITORS)
|
|
|
|
|
gdk_x11_surface_apply_fullscreen_mode (surface);
|
2013-01-21 10:52:32 +00:00
|
|
|
|
}
|
2002-09-25 19:16:46 +00:00
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_synthesize_surface_state (surface,
|
2002-09-25 19:16:46 +00:00
|
|
|
|
0,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GDK_SURFACE_STATE_FULLSCREEN);
|
2002-09-25 19:16:46 +00:00
|
|
|
|
}
|
|
|
|
|
|
2016-11-02 18:00:34 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_fullscreen_on_monitor (GdkSurface *surface,
|
2017-11-01 15:52:56 +00:00
|
|
|
|
GdkMonitor *monitor)
|
2016-11-02 18:00:34 +00:00
|
|
|
|
{
|
2017-11-01 15:52:56 +00:00
|
|
|
|
GdkRectangle geom;
|
2016-11-02 18:00:34 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2016-11-02 18:00:34 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2017-11-01 15:52:56 +00:00
|
|
|
|
gdk_monitor_get_geometry (monitor, &geom);
|
2019-07-15 09:32:35 +00:00
|
|
|
|
gdk_x11_surface_move (surface, geom.x, geom.y);
|
2016-11-02 18:00:34 +00:00
|
|
|
|
|
2020-03-09 18:49:59 +00:00
|
|
|
|
surface->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
|
|
|
|
|
g_object_notify (G_OBJECT (surface), "fullscreen-mode");
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_fullscreen (surface);
|
2016-11-02 18:00:34 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_unfullscreen (GdkSurface *surface)
|
2002-09-25 19:16:46 +00:00
|
|
|
|
{
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2002-09-25 19:16:46 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_IS_MAPPED (surface))
|
|
|
|
|
gdk_wmspec_change_state (FALSE, surface,
|
2020-02-23 00:33:56 +00:00
|
|
|
|
"_NET_WM_STATE_FULLSCREEN",
|
2017-11-15 17:13:31 +00:00
|
|
|
|
NULL);
|
2002-09-25 19:16:46 +00:00
|
|
|
|
|
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_synthesize_surface_state (surface,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GDK_SURFACE_STATE_FULLSCREEN,
|
2002-09-25 19:16:46 +00:00
|
|
|
|
0);
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-30 15:05:02 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_x11_surface_get_group:
|
2020-07-31 17:11:23 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): The #GdkSurface
|
2019-05-30 15:05:02 +00:00
|
|
|
|
*
|
|
|
|
|
* Returns the group this surface belongs to.
|
|
|
|
|
*
|
|
|
|
|
* Returns: (transfer none): The group of this surface;
|
|
|
|
|
*/
|
2019-04-20 01:38:12 +00:00
|
|
|
|
GdkSurface *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_get_group (GdkSurface *surface)
|
2003-12-09 23:12:53 +00:00
|
|
|
|
{
|
|
|
|
|
GdkToplevelX11 *toplevel;
|
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2003-12-09 23:12:53 +00:00
|
|
|
|
return NULL;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2003-12-09 23:12:53 +00:00
|
|
|
|
|
|
|
|
|
return toplevel->group_leader;
|
|
|
|
|
}
|
|
|
|
|
|
2019-05-01 13:03:16 +00:00
|
|
|
|
/**
|
|
|
|
|
* gdk_x11_surface_set_group:
|
|
|
|
|
* @surface: (type GdkX11Surface): a native #GdkSurface
|
|
|
|
|
* @leader: a #GdkSurface
|
2019-05-02 02:39:36 +00:00
|
|
|
|
*
|
|
|
|
|
* Sets the group leader of @surface to be @leader.
|
|
|
|
|
* See the ICCCM for details.
|
2019-05-01 13:03:16 +00:00
|
|
|
|
*/
|
2019-04-20 01:38:12 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_group (GdkSurface *surface,
|
2019-04-20 01:38:12 +00:00
|
|
|
|
GdkSurface *leader)
|
1998-02-27 03:55:33 +00:00
|
|
|
|
{
|
2003-07-05 02:34:52 +00:00
|
|
|
|
GdkToplevelX11 *toplevel;
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2018-03-20 10:40:08 +00:00
|
|
|
|
g_return_if_fail (leader == NULL || GDK_IS_SURFACE (leader));
|
2003-12-09 23:12:53 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface) ||
|
2019-04-22 13:16:55 +00:00
|
|
|
|
(leader != NULL && GDK_SURFACE_DESTROYED (leader)))
|
2003-12-09 23:12:53 +00:00
|
|
|
|
return;
|
1999-10-03 22:12:41 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
toplevel = _gdk_x11_surface_get_toplevel (surface);
|
2003-07-05 02:34:52 +00:00
|
|
|
|
|
2009-08-07 16:00:10 +00:00
|
|
|
|
if (leader == NULL)
|
2020-07-30 02:55:19 +00:00
|
|
|
|
leader = gdk_x11_display_get_default_group (gdk_surface_get_display (surface));
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2003-07-05 02:34:52 +00:00
|
|
|
|
if (toplevel->group_leader != leader)
|
2003-07-05 01:54:05 +00:00
|
|
|
|
{
|
2003-07-05 02:34:52 +00:00
|
|
|
|
if (toplevel->group_leader)
|
|
|
|
|
g_object_unref (toplevel->group_leader);
|
2003-10-23 18:50:40 +00:00
|
|
|
|
toplevel->group_leader = g_object_ref (leader);
|
2018-03-20 10:40:08 +00:00
|
|
|
|
(_gdk_x11_surface_get_toplevel (leader))->is_leader = TRUE;
|
2003-07-05 01:54:05 +00:00
|
|
|
|
}
|
1999-02-10 15:45:19 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
update_wm_hints (surface, FALSE);
|
1998-02-27 03:55:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-01-08 16:42:08 +00:00
|
|
|
|
static MotifWmHints *
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_mwm_hints (GdkSurface *surface)
|
2001-01-08 16:42:08 +00:00
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
Atom hints_atom = None;
|
2004-11-17 00:55:10 +00:00
|
|
|
|
guchar *data;
|
2001-01-08 16:42:08 +00:00
|
|
|
|
Atom type;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int format;
|
2001-01-08 16:42:08 +00:00
|
|
|
|
gulong nitems;
|
|
|
|
|
gulong bytes_after;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-01-08 16:42:08 +00:00
|
|
|
|
return NULL;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2001-01-08 16:42:08 +00:00
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XID (surface),
|
2001-01-08 16:42:08 +00:00
|
|
|
|
hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
|
|
|
|
|
False, AnyPropertyType, &type, &format, &nitems,
|
2004-11-17 00:55:10 +00:00
|
|
|
|
&bytes_after, &data);
|
2001-01-08 16:42:08 +00:00
|
|
|
|
|
|
|
|
|
if (type == None)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
2004-11-17 00:55:10 +00:00
|
|
|
|
return (MotifWmHints *)data;
|
2001-01-08 16:42:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
1998-02-27 03:55:33 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_mwm_hints (GdkSurface *surface,
|
1998-02-27 03:55:33 +00:00
|
|
|
|
MotifWmHints *new_hints)
|
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
Atom hints_atom = None;
|
2004-11-17 00:55:10 +00:00
|
|
|
|
guchar *data;
|
1998-02-27 03:55:33 +00:00
|
|
|
|
MotifWmHints *hints;
|
|
|
|
|
Atom type;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int format;
|
1998-02-27 03:55:33 +00:00
|
|
|
|
gulong nitems;
|
|
|
|
|
gulong bytes_after;
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
1998-02-27 03:55:33 +00:00
|
|
|
|
return;
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
1998-02-27 03:55:33 +00:00
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
hints_atom = gdk_x11_get_xatom_by_name_for_display (display, _XA_MOTIF_WM_HINTS);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XGetWindowProperty (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface),
|
1999-02-21 20:55:04 +00:00
|
|
|
|
hints_atom, 0, sizeof (MotifWmHints)/sizeof (long),
|
1998-02-27 03:55:33 +00:00
|
|
|
|
False, AnyPropertyType, &type, &format, &nitems,
|
2004-11-17 00:55:10 +00:00
|
|
|
|
&bytes_after, &data);
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
1998-02-27 03:55:33 +00:00
|
|
|
|
if (type == None)
|
|
|
|
|
hints = new_hints;
|
|
|
|
|
else
|
|
|
|
|
{
|
2004-11-17 00:55:10 +00:00
|
|
|
|
hints = (MotifWmHints *)data;
|
|
|
|
|
|
1998-02-27 03:55:33 +00:00
|
|
|
|
if (new_hints->flags & MWM_HINTS_FUNCTIONS)
|
|
|
|
|
{
|
|
|
|
|
hints->flags |= MWM_HINTS_FUNCTIONS;
|
|
|
|
|
hints->functions = new_hints->functions;
|
|
|
|
|
}
|
|
|
|
|
if (new_hints->flags & MWM_HINTS_DECORATIONS)
|
|
|
|
|
{
|
|
|
|
|
hints->flags |= MWM_HINTS_DECORATIONS;
|
|
|
|
|
hints->decorations = new_hints->decorations;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XChangeProperty (GDK_SURFACE_XDISPLAY (surface), GDK_SURFACE_XID (surface),
|
1998-02-27 03:55:33 +00:00
|
|
|
|
hints_atom, hints_atom, 32, PropModeReplace,
|
1999-02-21 20:55:04 +00:00
|
|
|
|
(guchar *)hints, sizeof (MotifWmHints)/sizeof (long));
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
1998-02-27 03:55:33 +00:00
|
|
|
|
if (hints != new_hints)
|
|
|
|
|
XFree (hints);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-09 19:03:48 +00:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
GDK_DECOR_ALL = 1 << 0,
|
|
|
|
|
GDK_DECOR_BORDER = 1 << 1,
|
|
|
|
|
GDK_DECOR_RESIZEH = 1 << 2,
|
|
|
|
|
GDK_DECOR_TITLE = 1 << 3,
|
|
|
|
|
GDK_DECOR_MENU = 1 << 4,
|
|
|
|
|
GDK_DECOR_MINIMIZE = 1 << 5,
|
|
|
|
|
GDK_DECOR_MAXIMIZE = 1 << 6
|
|
|
|
|
} GdkWMDecoration;
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_decorations (GdkSurface *surface,
|
2010-12-05 20:58:23 +00:00
|
|
|
|
GdkWMDecoration decorations)
|
1998-02-27 03:55:33 +00:00
|
|
|
|
{
|
|
|
|
|
MotifWmHints hints;
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2008-07-18 13:03:42 +00:00
|
|
|
|
return;
|
1999-10-03 22:12:41 +00:00
|
|
|
|
|
2006-08-15 05:46:08 +00:00
|
|
|
|
/* initialize to zero to avoid writing uninitialized data to socket */
|
|
|
|
|
memset(&hints, 0, sizeof(hints));
|
1998-02-27 03:55:33 +00:00
|
|
|
|
hints.flags = MWM_HINTS_DECORATIONS;
|
|
|
|
|
hints.decorations = decorations;
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_mwm_hints (surface, &hints);
|
1998-02-27 03:55:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_get_decorations(GdkSurface *surface,
|
2010-12-05 20:58:23 +00:00
|
|
|
|
GdkWMDecoration *decorations)
|
2001-01-08 16:42:08 +00:00
|
|
|
|
{
|
|
|
|
|
MotifWmHints *hints;
|
|
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2008-07-18 13:03:42 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
hints = gdk_surface_get_mwm_hints (surface);
|
2001-01-08 16:42:08 +00:00
|
|
|
|
|
|
|
|
|
if (hints)
|
|
|
|
|
{
|
|
|
|
|
if (hints->flags & MWM_HINTS_DECORATIONS)
|
|
|
|
|
{
|
Start implementing display/screen closing scheme; keep a flag for whether
Thu Aug 1 11:26:03 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkdisplay.[ch] gdk/gdkscreen.[ch] gdkinternals.h:
Start implementing display/screen closing scheme; keep a
flag for whether displays and screens are closed,
call g_object_run_dispose(). Remove public gdk_screen_close().
* gdk/x11/gdkdisplay-x11.c gdk/x11/gdkscreen-x11.c: Add
dispose() methods; move appropriate parts of the finalize
there.
* gdk/x11/gdkcolor-x11.c gdk/x11/gdkimage-x11.c
gdk/x11/gdkmain-x11.c gdk/x11/gdkpango-x11.c
gdk/x11/gdkpixmap-x11.c gdk/x11/gdkproperty-x11.c
gdk/x11/gdkselection-x11.c gdk/x11/gdkwindow-x11.c:
Start of making everything correctly ignore operations
when a display has been closed.
* gdk/x11/gdkwindow-x11.c (gdk_window_get_decorations):
Handle decorations == NULL.
* gdk/x11/gdkcolor-x11.c (gdk_colormap_remove):
Remove unnecessary hash table creation.
* gdk/x11/gdkinput.c gdk/x11/gdkinput-x11.c gdk/win32/gdkinput.c
Fix up gdk_device_get_history - handle events, n_events == NULL,
etc.
* gdk/x11/gdkproperty-x11.c (gdk_property_get):
Handle failure better.
* gdk/x11/gdkselection-x11.c (gdk_selection_property_get):
Handle failure better, handle data == NULL, move docs
here, remove an excess round trip by asking for
all selection data at once.
* gdk/gdkselection.c gdk/win32/{x11,win32}/gdkselection-{x11,win32}.c
gdk/{x11,win32}/gdkmain-{x11,win32}.c gdk/gdkdisplay.c: Move
gdk_text_property_to_text_list(), gdk_string_to_compound_text(),
gdk_display_set_sm_client_id() to display-independent part of GDK.
* gdk/Makefile.am (gdk_c_sources): Sort gdkdisplay/screen.[ch]
into the right place.
2002-08-01 15:28:40 +00:00
|
|
|
|
if (decorations)
|
|
|
|
|
*decorations = hints->decorations;
|
2001-01-08 16:42:08 +00:00
|
|
|
|
result = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XFree (hints);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-09 19:03:48 +00:00
|
|
|
|
typedef enum
|
|
|
|
|
{
|
|
|
|
|
GDK_FUNC_ALL = 1 << 0,
|
|
|
|
|
GDK_FUNC_RESIZE = 1 << 1,
|
|
|
|
|
GDK_FUNC_MOVE = 1 << 2,
|
|
|
|
|
GDK_FUNC_MINIMIZE = 1 << 3,
|
|
|
|
|
GDK_FUNC_MAXIMIZE = 1 << 4,
|
|
|
|
|
GDK_FUNC_CLOSE = 1 << 5
|
|
|
|
|
} GdkWMFunction;
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_functions (GdkSurface *surface,
|
2016-03-20 04:30:03 +00:00
|
|
|
|
GdkWMFunction functions)
|
1998-02-27 03:55:33 +00:00
|
|
|
|
{
|
|
|
|
|
MotifWmHints hints;
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2008-07-18 13:03:42 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2008-07-18 13:03:42 +00:00
|
|
|
|
return;
|
1999-10-03 22:12:41 +00:00
|
|
|
|
|
2006-08-15 05:46:08 +00:00
|
|
|
|
/* initialize to zero to avoid writing uninitialized data to socket */
|
|
|
|
|
memset(&hints, 0, sizeof(hints));
|
1998-02-27 03:55:33 +00:00
|
|
|
|
hints.flags = MWM_HINTS_FUNCTIONS;
|
|
|
|
|
hints.functions = functions;
|
1999-02-10 08:06:30 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_set_mwm_hints (surface, &hints);
|
1998-02-27 03:55:33 +00:00
|
|
|
|
}
|
1998-05-01 16:15:39 +00:00
|
|
|
|
|
2020-03-07 21:59:24 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_surface_get_functions (GdkSurface *surface,
|
|
|
|
|
GdkWMFunction *functions)
|
|
|
|
|
{
|
|
|
|
|
MotifWmHints *hints;
|
|
|
|
|
gboolean result = FALSE;
|
|
|
|
|
|
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
hints = gdk_surface_get_mwm_hints (surface);
|
|
|
|
|
|
|
|
|
|
if (hints)
|
|
|
|
|
{
|
|
|
|
|
if (hints->flags & MWM_HINTS_DECORATIONS)
|
|
|
|
|
{
|
|
|
|
|
if (functions)
|
|
|
|
|
*functions = hints->functions;
|
|
|
|
|
result = TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
XFree (hints);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
2010-06-28 12:54:37 +00:00
|
|
|
|
cairo_region_t *
|
2010-12-15 19:49:23 +00:00
|
|
|
|
_gdk_x11_xwindow_get_shape (Display *xdisplay,
|
|
|
|
|
Window window,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int scale,
|
|
|
|
|
int shape_type)
|
2008-12-16 13:38:10 +00:00
|
|
|
|
{
|
2010-06-28 12:54:37 +00:00
|
|
|
|
cairo_region_t *shape;
|
2008-12-16 19:09:20 +00:00
|
|
|
|
GdkRectangle *rl;
|
|
|
|
|
XRectangle *xrl;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int rn, ord, i;
|
2008-12-16 13:38:10 +00:00
|
|
|
|
|
|
|
|
|
shape = NULL;
|
2010-03-16 16:35:13 +00:00
|
|
|
|
rn = 0;
|
|
|
|
|
|
2012-01-03 15:51:13 +00:00
|
|
|
|
/* Note that XShapeGetRectangles returns NULL in two situations:
|
|
|
|
|
* - the server doesn't support the SHAPE extension
|
|
|
|
|
* - the shape is empty
|
|
|
|
|
*
|
|
|
|
|
* Since we can't discriminate these here, we always return
|
|
|
|
|
* an empty shape. It is the callers responsibility to check
|
|
|
|
|
* whether the server supports the SHAPE extensions beforehand.
|
|
|
|
|
*/
|
|
|
|
|
xrl = XShapeGetRectangles (xdisplay, window, shape_type, &rn, &ord);
|
2010-03-16 16:35:13 +00:00
|
|
|
|
|
2012-01-03 15:51:13 +00:00
|
|
|
|
if (rn == 0)
|
2010-06-28 12:44:12 +00:00
|
|
|
|
return cairo_region_create (); /* Empty */
|
2010-03-16 16:35:13 +00:00
|
|
|
|
|
2008-12-16 19:09:20 +00:00
|
|
|
|
if (ord != YXBanded)
|
2008-12-16 13:38:10 +00:00
|
|
|
|
{
|
2008-12-16 19:09:20 +00:00
|
|
|
|
/* This really shouldn't happen with any xserver, as they
|
2012-01-03 15:51:13 +00:00
|
|
|
|
* generally convert regions to YXBanded internally
|
|
|
|
|
*/
|
2008-12-16 19:09:20 +00:00
|
|
|
|
g_warning ("non YXBanded shape masks not supported");
|
|
|
|
|
XFree (xrl);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
2008-12-16 13:38:10 +00:00
|
|
|
|
|
2013-06-20 09:40:07 +00:00
|
|
|
|
/* NOTE: The scale divisions here may lose some precision if someone
|
|
|
|
|
else set the shape to be non-scale precision */
|
2008-12-16 19:09:20 +00:00
|
|
|
|
rl = g_new (GdkRectangle, rn);
|
|
|
|
|
for (i = 0; i < rn; i++)
|
|
|
|
|
{
|
2013-06-20 09:40:07 +00:00
|
|
|
|
rl[i].x = xrl[i].x / scale;
|
|
|
|
|
rl[i].y = xrl[i].y / scale;
|
|
|
|
|
rl[i].width = xrl[i].width / scale;
|
|
|
|
|
rl[i].height = xrl[i].height / scale;
|
2008-12-16 13:38:10 +00:00
|
|
|
|
}
|
2008-12-16 19:09:20 +00:00
|
|
|
|
XFree (xrl);
|
2012-01-03 15:51:13 +00:00
|
|
|
|
|
2010-06-28 12:31:10 +00:00
|
|
|
|
shape = cairo_region_create_rectangles (rl, rn);
|
2008-12-16 19:09:20 +00:00
|
|
|
|
g_free (rl);
|
2012-01-03 15:51:13 +00:00
|
|
|
|
|
2008-12-16 19:09:20 +00:00
|
|
|
|
return shape;
|
|
|
|
|
}
|
|
|
|
|
|
2012-02-01 17:59:23 +00:00
|
|
|
|
/* From the WM spec */
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_TOP 1
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_RIGHT 3
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_LEFT 7
|
|
|
|
|
#define _NET_WM_MOVERESIZE_MOVE 8 /* movement only */
|
|
|
|
|
#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */
|
|
|
|
|
#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 /* move via keyboard */
|
|
|
|
|
#define _NET_WM_MOVERESIZE_CANCEL 11 /* cancel operation */
|
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
static void
|
2012-02-01 17:59:23 +00:00
|
|
|
|
wmspec_send_message (GdkDisplay *display,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int root_x,
|
|
|
|
|
int root_y,
|
|
|
|
|
int action,
|
|
|
|
|
int button)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2007-01-04 01:28:07 +00:00
|
|
|
|
XClientMessageEvent xclient;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2007-01-04 01:28:07 +00:00
|
|
|
|
memset (&xclient, 0, sizeof (xclient));
|
|
|
|
|
xclient.type = ClientMessage;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xclient.window = GDK_SURFACE_XID (surface);
|
2007-01-04 01:28:07 +00:00
|
|
|
|
xclient.message_type =
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_MOVERESIZE");
|
2007-01-04 01:28:07 +00:00
|
|
|
|
xclient.format = 32;
|
2018-03-20 11:05:26 +00:00
|
|
|
|
xclient.data.l[0] = root_x * impl->surface_scale;
|
|
|
|
|
xclient.data.l[1] = root_y * impl->surface_scale;
|
2012-02-01 17:59:23 +00:00
|
|
|
|
xclient.data.l[2] = action;
|
2011-12-28 16:16:54 +00:00
|
|
|
|
xclient.data.l[3] = button;
|
|
|
|
|
xclient.data.l[4] = 1; /* source indication */
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XROOTWIN (surface), False,
|
2012-02-01 17:59:23 +00:00
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
|
|
|
|
(XEvent *)&xclient);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-04-04 13:54:32 +00:00
|
|
|
|
static void
|
2017-12-12 23:39:32 +00:00
|
|
|
|
handle_wmspec_button_release (GdkDisplay *display,
|
|
|
|
|
const XEvent *xevent)
|
2012-02-01 17:59:23 +00:00
|
|
|
|
{
|
|
|
|
|
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2012-02-01 17:59:23 +00:00
|
|
|
|
XIEvent *xiev = (XIEvent *) xevent->xcookie.data;
|
|
|
|
|
XIDeviceEvent *xidev = (XIDeviceEvent *) xiev;
|
|
|
|
|
|
|
|
|
|
if (xevent->xany.type == GenericEvent)
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface = gdk_x11_surface_lookup_for_display (display, xidev->event);
|
2012-02-01 17:59:23 +00:00
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface = gdk_x11_surface_lookup_for_display (display, xevent->xany.window);
|
2012-02-01 17:59:23 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (display_x11->wm_moveresize_button != 0 && surface != NULL)
|
2012-02-01 17:59:23 +00:00
|
|
|
|
{
|
|
|
|
|
if ((xevent->xany.type == ButtonRelease &&
|
2019-05-14 21:48:58 +00:00
|
|
|
|
xevent->xbutton.button == display_x11->wm_moveresize_button) ||
|
2012-02-01 17:59:23 +00:00
|
|
|
|
(xevent->xany.type == GenericEvent &&
|
|
|
|
|
xiev->evtype == XI_ButtonRelease &&
|
2019-05-14 21:48:58 +00:00
|
|
|
|
xidev->detail == display_x11->wm_moveresize_button))
|
2012-02-01 17:59:23 +00:00
|
|
|
|
{
|
|
|
|
|
display_x11->wm_moveresize_button = 0;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
wmspec_send_message (display, surface, 0, 0, _NET_WM_MOVERESIZE_CANCEL, 0);
|
2012-02-01 17:59:23 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
wmspec_moveresize (GdkSurface *surface,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int direction,
|
2012-02-01 17:59:23 +00:00
|
|
|
|
GdkDevice *device,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int button,
|
|
|
|
|
int root_x,
|
|
|
|
|
int root_y,
|
2012-02-01 17:59:23 +00:00
|
|
|
|
guint32 timestamp)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkDisplay *display = GDK_SURFACE_DISPLAY (surface);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2014-01-13 03:06:59 +00:00
|
|
|
|
if (button != 0)
|
2015-12-16 18:21:33 +00:00
|
|
|
|
gdk_seat_ungrab (gdk_device_get_seat (device)); /* Release passive grab */
|
2012-02-01 17:59:23 +00:00
|
|
|
|
GDK_X11_DISPLAY (display)->wm_moveresize_button = button;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
wmspec_send_message (display, surface, root_x, root_y, direction, button);
|
2012-02-01 17:59:23 +00:00
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
wmspec_resize_drag (GdkSurface *surface,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceEdge edge,
|
2011-11-05 05:10:16 +00:00
|
|
|
|
GdkDevice *device,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int button,
|
|
|
|
|
int root_x,
|
|
|
|
|
int root_y,
|
2001-03-29 21:17:45 +00:00
|
|
|
|
guint32 timestamp)
|
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int direction;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2014-01-13 03:06:59 +00:00
|
|
|
|
if (button == 0)
|
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_KEYBOARD;
|
|
|
|
|
else
|
|
|
|
|
switch (edge)
|
|
|
|
|
{
|
|
|
|
|
/* Let the compiler turn a switch into a table, instead
|
|
|
|
|
* of doing the table manually, this way is easier to verify.
|
|
|
|
|
*/
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_NORTH_WEST:
|
2014-01-13 03:06:59 +00:00
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_TOPLEFT;
|
|
|
|
|
break;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_NORTH:
|
2014-01-13 03:06:59 +00:00
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_TOP;
|
|
|
|
|
break;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_NORTH_EAST:
|
2014-01-13 03:06:59 +00:00
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_TOPRIGHT;
|
|
|
|
|
break;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_WEST:
|
2014-01-13 03:06:59 +00:00
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_LEFT;
|
|
|
|
|
break;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_EAST:
|
2014-01-13 03:06:59 +00:00
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_RIGHT;
|
|
|
|
|
break;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_SOUTH_WEST:
|
2014-01-13 03:06:59 +00:00
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT;
|
|
|
|
|
break;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_SOUTH:
|
2014-01-13 03:06:59 +00:00
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOM;
|
|
|
|
|
break;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_SOUTH_EAST:
|
2014-01-13 03:06:59 +00:00
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT;
|
|
|
|
|
break;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2014-01-13 03:06:59 +00:00
|
|
|
|
default:
|
2020-05-17 16:35:45 +00:00
|
|
|
|
g_warning ("gdk_toplevel_begin_resize: bad resize edge %d!",
|
2014-01-13 03:06:59 +00:00
|
|
|
|
edge);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
wmspec_moveresize (surface, direction, device, button, root_x, root_y, timestamp);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-01 17:59:23 +00:00
|
|
|
|
typedef struct _MoveResizeData MoveResizeData;
|
|
|
|
|
|
|
|
|
|
struct _MoveResizeData
|
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *moveresize_surface;
|
|
|
|
|
GdkSurface *moveresize_emulation_surface;
|
2012-02-01 17:59:23 +00:00
|
|
|
|
gboolean is_resize;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceEdge resize_edge;
|
2012-02-01 17:59:23 +00:00
|
|
|
|
GdkDevice *device;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int moveresize_button;
|
|
|
|
|
int moveresize_x;
|
|
|
|
|
int moveresize_y;
|
|
|
|
|
int moveresize_orig_x;
|
|
|
|
|
int moveresize_orig_y;
|
|
|
|
|
int moveresize_orig_width;
|
|
|
|
|
int moveresize_orig_height;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceHints moveresize_geom_mask;
|
2012-02-01 17:59:23 +00:00
|
|
|
|
GdkGeometry moveresize_geometry;
|
|
|
|
|
Time moveresize_process_time;
|
|
|
|
|
XEvent *moveresize_pending_event;
|
|
|
|
|
};
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
static MoveResizeData *
|
2002-06-18 15:45:05 +00:00
|
|
|
|
get_move_resize_data (GdkDisplay *display,
|
|
|
|
|
gboolean create)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
{
|
|
|
|
|
MoveResizeData *mv_resize;
|
|
|
|
|
static GQuark move_resize_quark = 0;
|
|
|
|
|
|
|
|
|
|
if (!move_resize_quark)
|
2018-03-21 10:49:14 +00:00
|
|
|
|
move_resize_quark = g_quark_from_static_string ("gdk-surface-moveresize");
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
|
|
|
|
mv_resize = g_object_get_qdata (G_OBJECT (display), move_resize_quark);
|
|
|
|
|
|
2002-06-18 15:45:05 +00:00
|
|
|
|
if (!mv_resize && create)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
{
|
|
|
|
|
mv_resize = g_new0 (MoveResizeData, 1);
|
|
|
|
|
mv_resize->display = display;
|
|
|
|
|
|
|
|
|
|
g_object_set_qdata (G_OBJECT (display), move_resize_quark, mv_resize);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mv_resize;
|
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2014-03-13 20:12:55 +00:00
|
|
|
|
static void
|
|
|
|
|
check_maximize (MoveResizeData *mv_resize,
|
2020-07-24 20:32:16 +00:00
|
|
|
|
double x_root,
|
|
|
|
|
double y_root)
|
2014-03-13 20:12:55 +00:00
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceState state;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int y;
|
2014-03-13 20:12:55 +00:00
|
|
|
|
|
|
|
|
|
if (mv_resize->is_resize)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-03-01 01:43:34 +00:00
|
|
|
|
state = gdk_toplevel_get_state (GDK_TOPLEVEL (mv_resize->moveresize_surface));
|
2014-03-13 20:12:55 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
if (state & GDK_SURFACE_STATE_MAXIMIZED)
|
2014-03-13 20:12:55 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
y = mv_resize->moveresize_orig_y + (y_root - mv_resize->moveresize_y);
|
|
|
|
|
|
|
|
|
|
if (y < 10)
|
2020-02-29 18:11:53 +00:00
|
|
|
|
gdk_x11_surface_maximize (mv_resize->moveresize_surface);
|
2014-03-13 20:12:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
check_unmaximize (MoveResizeData *mv_resize,
|
2020-07-24 20:32:16 +00:00
|
|
|
|
double x_root,
|
|
|
|
|
double y_root)
|
2014-03-13 20:12:55 +00:00
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceState state;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int dx, dy;
|
2014-03-13 20:12:55 +00:00
|
|
|
|
|
|
|
|
|
if (mv_resize->is_resize)
|
|
|
|
|
return;
|
|
|
|
|
|
2020-03-01 01:43:34 +00:00
|
|
|
|
state = gdk_toplevel_get_state (GDK_TOPLEVEL (mv_resize->moveresize_surface));
|
2014-03-13 20:12:55 +00:00
|
|
|
|
|
2018-03-20 10:40:08 +00:00
|
|
|
|
if ((state & (GDK_SURFACE_STATE_MAXIMIZED | GDK_SURFACE_STATE_TILED)) == 0)
|
2014-03-13 20:12:55 +00:00
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dx = x_root - mv_resize->moveresize_x;
|
|
|
|
|
dy = y_root - mv_resize->moveresize_y;
|
|
|
|
|
|
|
|
|
|
if (ABS (dx) > 20 || ABS (dy) > 20)
|
2020-02-29 18:11:53 +00:00
|
|
|
|
gdk_x11_surface_unmaximize (mv_resize->moveresize_surface);
|
2014-03-13 20:12:55 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
static void
|
2002-04-25 22:29:14 +00:00
|
|
|
|
update_pos (MoveResizeData *mv_resize,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int new_root_x,
|
|
|
|
|
int new_root_y)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int dx, dy;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2014-03-13 20:12:55 +00:00
|
|
|
|
check_unmaximize (mv_resize, new_root_x, new_root_y);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
dx = new_root_x - mv_resize->moveresize_x;
|
|
|
|
|
dy = new_root_y - mv_resize->moveresize_y;
|
|
|
|
|
|
|
|
|
|
if (mv_resize->is_resize)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x, y, w, h;
|
2002-12-03 21:57:13 +00:00
|
|
|
|
|
|
|
|
|
x = mv_resize->moveresize_orig_x;
|
|
|
|
|
y = mv_resize->moveresize_orig_y;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
w = mv_resize->moveresize_orig_width;
|
|
|
|
|
h = mv_resize->moveresize_orig_height;
|
|
|
|
|
|
|
|
|
|
switch (mv_resize->resize_edge)
|
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_NORTH_WEST:
|
2002-12-03 21:57:13 +00:00
|
|
|
|
x += dx;
|
|
|
|
|
y += dy;
|
|
|
|
|
w -= dx;
|
|
|
|
|
h -= dy;
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_NORTH:
|
2002-12-03 21:57:13 +00:00
|
|
|
|
y += dy;
|
|
|
|
|
h -= dy;
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_NORTH_EAST:
|
2002-12-03 21:57:13 +00:00
|
|
|
|
y += dy;
|
|
|
|
|
h -= dy;
|
|
|
|
|
w += dx;
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_SOUTH_WEST:
|
2002-12-03 21:57:13 +00:00
|
|
|
|
h += dy;
|
|
|
|
|
x += dx;
|
|
|
|
|
w -= dx;
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_SOUTH_EAST:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
w += dx;
|
|
|
|
|
h += dy;
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_SOUTH:
|
2002-12-03 21:57:13 +00:00
|
|
|
|
h += dy;
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_EAST:
|
2002-12-03 21:57:13 +00:00
|
|
|
|
w += dx;
|
|
|
|
|
break;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
case GDK_SURFACE_EDGE_WEST:
|
2002-12-03 21:57:13 +00:00
|
|
|
|
x += dx;
|
|
|
|
|
w -= dx;
|
|
|
|
|
break;
|
2017-10-06 19:19:42 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2002-12-03 21:57:13 +00:00
|
|
|
|
x = MAX (x, 0);
|
|
|
|
|
y = MAX (y, 0);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
w = MAX (w, 1);
|
|
|
|
|
h = MAX (h, 1);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
|
|
|
|
if (mv_resize->moveresize_geom_mask)
|
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
gdk_surface_constrain_size (&mv_resize->moveresize_geometry,
|
2002-04-25 22:29:14 +00:00
|
|
|
|
mv_resize->moveresize_geom_mask,
|
|
|
|
|
w, h, &w, &h);
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-15 13:47:12 +00:00
|
|
|
|
gdk_x11_surface_move_resize (mv_resize->moveresize_surface, TRUE,
|
|
|
|
|
x, y, w, h);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int x, y;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
x = mv_resize->moveresize_orig_x + dx;
|
|
|
|
|
y = mv_resize->moveresize_orig_y + dy;
|
|
|
|
|
|
2019-07-15 09:32:35 +00:00
|
|
|
|
gdk_x11_surface_move (mv_resize->moveresize_surface, x, y);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2002-04-25 22:29:14 +00:00
|
|
|
|
finish_drag (MoveResizeData *mv_resize)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_destroy (mv_resize->moveresize_emulation_surface);
|
|
|
|
|
mv_resize->moveresize_emulation_surface = NULL;
|
|
|
|
|
g_clear_object (&mv_resize->moveresize_surface);
|
2014-07-14 15:02:13 +00:00
|
|
|
|
g_clear_pointer (&mv_resize->moveresize_pending_event, g_free);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
2002-04-25 22:29:14 +00:00
|
|
|
|
lookahead_motion_predicate (Display *xdisplay,
|
2001-03-29 21:17:45 +00:00
|
|
|
|
XEvent *event,
|
|
|
|
|
XPointer arg)
|
|
|
|
|
{
|
|
|
|
|
gboolean *seen_release = (gboolean *)arg;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
GdkDisplay *display = gdk_x11_lookup_xdisplay (xdisplay);
|
2002-06-18 15:45:05 +00:00
|
|
|
|
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
if (*seen_release)
|
|
|
|
|
return False;
|
|
|
|
|
|
|
|
|
|
switch (event->xany.type)
|
|
|
|
|
{
|
|
|
|
|
case ButtonRelease:
|
|
|
|
|
*seen_release = TRUE;
|
|
|
|
|
break;
|
|
|
|
|
case MotionNotify:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
mv_resize->moveresize_process_time = event->xmotion.time;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return False;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
2002-04-25 22:29:14 +00:00
|
|
|
|
moveresize_lookahead (MoveResizeData *mv_resize,
|
2017-12-12 23:39:32 +00:00
|
|
|
|
const XEvent *event)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
|
|
|
|
XEvent tmp_event;
|
|
|
|
|
gboolean seen_release = FALSE;
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
if (mv_resize->moveresize_process_time)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
if (event->xmotion.time == mv_resize->moveresize_process_time)
|
2010-12-15 22:55:04 +00:00
|
|
|
|
{
|
|
|
|
|
mv_resize->moveresize_process_time = 0;
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
else
|
2010-12-15 22:55:04 +00:00
|
|
|
|
return FALSE;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
XCheckIfEvent (event->xany.display, &tmp_event,
|
2010-12-15 22:55:04 +00:00
|
|
|
|
lookahead_motion_predicate, (XPointer) & seen_release);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
return mv_resize->moveresize_process_time == 0;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
2010-12-15 22:55:04 +00:00
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
gboolean
|
2017-12-12 23:39:32 +00:00
|
|
|
|
_gdk_x11_moveresize_handle_event (const XEvent *event)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
|
|
|
|
guint button_mask = 0;
|
2002-12-03 21:57:13 +00:00
|
|
|
|
GdkDisplay *display = gdk_x11_lookup_xdisplay (event->xany.display);
|
2002-06-18 15:45:05 +00:00
|
|
|
|
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!mv_resize || !mv_resize->moveresize_surface)
|
2012-04-04 13:54:32 +00:00
|
|
|
|
{
|
|
|
|
|
handle_wmspec_button_release (display, event);
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl = GDK_X11_SURFACE (mv_resize->moveresize_surface);
|
2013-06-20 09:40:07 +00:00
|
|
|
|
|
2014-01-13 03:06:59 +00:00
|
|
|
|
if (mv_resize->moveresize_button != 0)
|
|
|
|
|
button_mask = GDK_BUTTON1_MASK << (mv_resize->moveresize_button - 1);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
switch (event->xany.type)
|
|
|
|
|
{
|
|
|
|
|
case MotionNotify:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (mv_resize->moveresize_surface->resize_count > 0)
|
2010-12-15 22:55:04 +00:00
|
|
|
|
{
|
|
|
|
|
if (mv_resize->moveresize_pending_event)
|
|
|
|
|
*mv_resize->moveresize_pending_event = *event;
|
|
|
|
|
else
|
|
|
|
|
mv_resize->moveresize_pending_event =
|
|
|
|
|
g_memdup (event, sizeof (XEvent));
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2010-12-15 22:55:04 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
2002-04-25 22:29:14 +00:00
|
|
|
|
if (!moveresize_lookahead (mv_resize, event))
|
2010-12-15 22:55:04 +00:00
|
|
|
|
break;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
|
|
|
|
update_pos (mv_resize,
|
2018-03-20 11:05:26 +00:00
|
|
|
|
event->xmotion.x_root / impl->surface_scale,
|
|
|
|
|
event->xmotion.y_root / impl->surface_scale);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
/* This should never be triggered in normal cases, but in the
|
|
|
|
|
* case where the drag started without an implicit grab being
|
|
|
|
|
* in effect, we could miss the release if it occurs before
|
|
|
|
|
* we grab the pointer; this ensures that we will never
|
|
|
|
|
* get a permanently stuck grab.
|
|
|
|
|
*/
|
|
|
|
|
if ((event->xmotion.state & button_mask) == 0)
|
2014-03-13 20:12:55 +00:00
|
|
|
|
{
|
|
|
|
|
check_maximize (mv_resize,
|
2018-03-20 11:05:26 +00:00
|
|
|
|
event->xmotion.x_root / impl->surface_scale,
|
|
|
|
|
event->xmotion.y_root / impl->surface_scale);
|
2014-03-13 20:12:55 +00:00
|
|
|
|
finish_drag (mv_resize);
|
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ButtonRelease:
|
2002-04-25 22:29:14 +00:00
|
|
|
|
update_pos (mv_resize,
|
2018-03-20 11:05:26 +00:00
|
|
|
|
event->xbutton.x_root / impl->surface_scale,
|
|
|
|
|
event->xbutton.y_root / impl->surface_scale);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
|
|
|
|
if (event->xbutton.button == mv_resize->moveresize_button)
|
2014-03-13 20:12:55 +00:00
|
|
|
|
{
|
|
|
|
|
check_maximize (mv_resize,
|
2018-03-20 11:05:26 +00:00
|
|
|
|
event->xmotion.x_root / impl->surface_scale,
|
|
|
|
|
event->xmotion.y_root / impl->surface_scale);
|
2014-03-13 20:12:55 +00:00
|
|
|
|
finish_drag (mv_resize);
|
|
|
|
|
}
|
2001-03-29 21:17:45 +00:00
|
|
|
|
break;
|
2011-12-10 02:21:09 +00:00
|
|
|
|
|
|
|
|
|
case GenericEvent:
|
|
|
|
|
{
|
|
|
|
|
/* we just assume this is an XI2 event */
|
|
|
|
|
XIEvent *ev = (XIEvent *) event->xcookie.data;
|
|
|
|
|
XIDeviceEvent *xev = (XIDeviceEvent *)ev;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int state;
|
2011-12-10 02:21:09 +00:00
|
|
|
|
switch (ev->evtype)
|
|
|
|
|
{
|
|
|
|
|
case XI_Motion:
|
2018-03-20 11:05:26 +00:00
|
|
|
|
update_pos (mv_resize, xev->root_x / impl->surface_scale, xev->root_y / impl->surface_scale);
|
2011-12-10 02:21:09 +00:00
|
|
|
|
state = _gdk_x11_device_xi2_translate_state (&xev->mods, &xev->buttons, &xev->group);
|
|
|
|
|
if ((state & button_mask) == 0)
|
2014-03-13 20:12:55 +00:00
|
|
|
|
{
|
|
|
|
|
check_maximize (mv_resize,
|
2018-03-20 11:05:26 +00:00
|
|
|
|
xev->root_x / impl->surface_scale,
|
|
|
|
|
xev->root_y / impl->surface_scale);
|
2014-03-13 20:12:55 +00:00
|
|
|
|
finish_drag (mv_resize);
|
|
|
|
|
}
|
2011-12-10 02:21:09 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case XI_ButtonRelease:
|
2018-03-20 11:05:26 +00:00
|
|
|
|
update_pos (mv_resize, xev->root_x / impl->surface_scale, xev->root_y / impl->surface_scale);
|
2011-12-10 02:21:09 +00:00
|
|
|
|
if (xev->detail == mv_resize->moveresize_button)
|
2014-03-13 20:12:55 +00:00
|
|
|
|
{
|
|
|
|
|
check_maximize (mv_resize,
|
2018-03-20 11:05:26 +00:00
|
|
|
|
xev->root_x / impl->surface_scale,
|
|
|
|
|
xev->root_y / impl->surface_scale);
|
2014-03-13 20:12:55 +00:00
|
|
|
|
finish_drag (mv_resize);
|
|
|
|
|
}
|
2011-12-10 02:21:09 +00:00
|
|
|
|
break;
|
2017-10-06 19:19:42 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
2011-12-10 02:21:09 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2017-10-06 19:19:42 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
2002-04-25 22:29:14 +00:00
|
|
|
|
return TRUE;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-15 22:55:04 +00:00
|
|
|
|
gboolean
|
|
|
|
|
_gdk_x11_moveresize_configure_done (GdkDisplay *display,
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkSurface *surface)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
|
|
|
|
XEvent *tmp_event;
|
2002-06-18 15:45:05 +00:00
|
|
|
|
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
|
2010-12-15 22:55:04 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!mv_resize || surface != mv_resize->moveresize_surface)
|
2002-04-25 22:29:14 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (mv_resize->moveresize_pending_event)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2002-04-25 22:29:14 +00:00
|
|
|
|
tmp_event = mv_resize->moveresize_pending_event;
|
|
|
|
|
mv_resize->moveresize_pending_event = NULL;
|
2010-12-15 22:55:04 +00:00
|
|
|
|
_gdk_x11_moveresize_handle_event (tmp_event);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
g_free (tmp_event);
|
|
|
|
|
}
|
2010-12-15 22:55:04 +00:00
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
return TRUE;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
create_moveresize_surface (MoveResizeData *mv_resize,
|
2010-12-15 22:55:04 +00:00
|
|
|
|
guint32 timestamp)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
|
|
|
|
GdkGrabStatus status;
|
2019-04-20 04:31:27 +00:00
|
|
|
|
GdkRectangle rect = { -100, -100, 1, 1 };
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_assert (mv_resize->moveresize_emulation_surface == NULL);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2019-04-21 16:51:10 +00:00
|
|
|
|
mv_resize->moveresize_emulation_surface = gdk_surface_new_temp (mv_resize->display, &rect);
|
2020-03-09 17:20:13 +00:00
|
|
|
|
gdk_x11_surface_show (mv_resize->moveresize_emulation_surface, FALSE);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2015-12-16 18:21:33 +00:00
|
|
|
|
status = gdk_seat_grab (gdk_device_get_seat (mv_resize->device),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
mv_resize->moveresize_emulation_surface,
|
2015-12-16 18:21:33 +00:00
|
|
|
|
GDK_SEAT_CAPABILITY_POINTER, FALSE,
|
|
|
|
|
NULL, NULL, NULL, NULL);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
|
|
|
|
if (status != GDK_GRAB_SUCCESS)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
/* If this fails, some other client has grabbed the surface
|
2001-03-29 21:17:45 +00:00
|
|
|
|
* already.
|
|
|
|
|
*/
|
2006-01-11 14:54:05 +00:00
|
|
|
|
finish_drag (mv_resize);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
mv_resize->moveresize_process_time = 0;
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-12-03 21:57:13 +00:00
|
|
|
|
/*
|
|
|
|
|
Calculate mv_resize->moveresize_orig_x and mv_resize->moveresize_orig_y
|
|
|
|
|
so that calling XMoveWindow with these coordinates will not move the
|
2018-03-20 14:14:10 +00:00
|
|
|
|
surface.
|
2002-12-03 21:57:13 +00:00
|
|
|
|
Note that this depends on the WM to implement ICCCM-compliant reference
|
|
|
|
|
point handling.
|
|
|
|
|
*/
|
|
|
|
|
static void
|
|
|
|
|
calculate_unmoving_origin (MoveResizeData *mv_resize)
|
|
|
|
|
{
|
|
|
|
|
GdkRectangle rect;
|
|
|
|
|
|
2020-07-30 03:02:30 +00:00
|
|
|
|
gdk_x11_surface_get_frame_extents (mv_resize->moveresize_surface, &rect);
|
|
|
|
|
mv_resize->moveresize_orig_x = rect.x;
|
|
|
|
|
mv_resize->moveresize_orig_y = rect.y;
|
2002-12-03 21:57:13 +00:00
|
|
|
|
}
|
|
|
|
|
|
2001-03-29 21:17:45 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
emulate_resize_drag (GdkSurface *surface,
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkSurfaceEdge edge,
|
2011-11-05 05:10:16 +00:00
|
|
|
|
GdkDevice *device,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int button,
|
|
|
|
|
int root_x,
|
|
|
|
|
int root_y,
|
2001-03-29 21:17:45 +00:00
|
|
|
|
guint32 timestamp)
|
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
MoveResizeData *mv_resize = get_move_resize_data (GDK_SURFACE_DISPLAY (surface), TRUE);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (mv_resize->moveresize_surface != NULL)
|
2017-12-15 21:17:27 +00:00
|
|
|
|
return; /* already a drag operation in progress */
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
mv_resize->is_resize = TRUE;
|
|
|
|
|
mv_resize->moveresize_button = button;
|
|
|
|
|
mv_resize->resize_edge = edge;
|
2011-11-05 05:10:16 +00:00
|
|
|
|
mv_resize->device = device;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
mv_resize->moveresize_x = root_x;
|
|
|
|
|
mv_resize->moveresize_y = root_y;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
mv_resize->moveresize_surface = g_object_ref (surface);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
mv_resize->moveresize_orig_width = gdk_surface_get_width (surface);
|
|
|
|
|
mv_resize->moveresize_orig_height = gdk_surface_get_height (surface);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
|
|
|
|
mv_resize->moveresize_geom_mask = 0;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_surface_get_geometry_hints (surface,
|
2002-04-25 22:29:14 +00:00
|
|
|
|
&mv_resize->moveresize_geometry,
|
|
|
|
|
&mv_resize->moveresize_geom_mask);
|
|
|
|
|
|
2002-12-03 21:57:13 +00:00
|
|
|
|
calculate_unmoving_origin (mv_resize);
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
create_moveresize_surface (mv_resize, timestamp);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2019-03-23 18:56:21 +00:00
|
|
|
|
emulate_move_drag (GdkSurface *surface,
|
|
|
|
|
GdkDevice *device,
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int button,
|
|
|
|
|
int root_x,
|
|
|
|
|
int root_y,
|
2019-03-23 18:56:21 +00:00
|
|
|
|
guint32 timestamp)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2018-03-20 14:14:10 +00:00
|
|
|
|
MoveResizeData *mv_resize = get_move_resize_data (GDK_SURFACE_DISPLAY (surface), TRUE);
|
2017-12-15 21:17:27 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (mv_resize->moveresize_surface != NULL)
|
2017-12-15 21:17:27 +00:00
|
|
|
|
return; /* already a drag operation in progress */
|
|
|
|
|
|
2002-04-25 22:29:14 +00:00
|
|
|
|
mv_resize->is_resize = FALSE;
|
2011-11-05 05:10:16 +00:00
|
|
|
|
mv_resize->device = device;
|
2002-04-25 22:29:14 +00:00
|
|
|
|
mv_resize->moveresize_button = button;
|
|
|
|
|
mv_resize->moveresize_x = root_x;
|
|
|
|
|
mv_resize->moveresize_y = root_y;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
mv_resize->moveresize_surface = g_object_ref (surface);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2002-12-03 21:57:13 +00:00
|
|
|
|
calculate_unmoving_origin (mv_resize);
|
2002-04-25 22:29:14 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
create_moveresize_surface (mv_resize, timestamp);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-13 19:19:26 +00:00
|
|
|
|
static gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
_should_perform_ewmh_drag (GdkSurface *surface,
|
2014-03-13 19:19:26 +00:00
|
|
|
|
GdkDevice *device)
|
|
|
|
|
{
|
2018-03-20 10:40:08 +00:00
|
|
|
|
GdkPointerSurfaceInfo *info;
|
2014-03-13 19:19:26 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2014-03-13 19:19:26 +00:00
|
|
|
|
info = _gdk_display_get_pointer_info (display, device);
|
|
|
|
|
|
2020-06-18 18:22:20 +00:00
|
|
|
|
if ((info->last_physical_device == NULL ||
|
|
|
|
|
gdk_device_get_source (info->last_physical_device) != GDK_SOURCE_TOUCHSCREEN) &&
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
2017-12-14 04:39:03 +00:00
|
|
|
|
g_intern_static_string ("_NET_WM_MOVERESIZE")))
|
2014-03-13 19:19:26 +00:00
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2020-05-17 16:35:45 +00:00
|
|
|
|
gdk_x11_toplevel_begin_resize (GdkToplevel *toplevel,
|
|
|
|
|
GdkSurfaceEdge edge,
|
|
|
|
|
GdkDevice *device,
|
|
|
|
|
int button,
|
|
|
|
|
double x,
|
|
|
|
|
double y,
|
|
|
|
|
guint32 timestamp)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2020-05-17 16:35:45 +00:00
|
|
|
|
GdkSurface *surface = GDK_SURFACE (toplevel);
|
2019-03-23 18:56:21 +00:00
|
|
|
|
int root_x, root_y;
|
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-03-29 21:17:45 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_get_root_coords (surface, x, y, &root_x, &root_y);
|
2019-03-23 18:56:21 +00:00
|
|
|
|
|
2014-03-13 19:19:26 +00:00
|
|
|
|
/* Avoid EWMH for touch devices */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (_should_perform_ewmh_drag (surface, device))
|
|
|
|
|
wmspec_resize_drag (surface, edge, device, button, root_x, root_y, timestamp);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
emulate_resize_drag (surface, edge, device, button, root_x, root_y, timestamp);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-12-05 20:58:23 +00:00
|
|
|
|
static void
|
2020-05-17 16:35:45 +00:00
|
|
|
|
gdk_x11_toplevel_begin_move (GdkToplevel *toplevel,
|
|
|
|
|
GdkDevice *device,
|
|
|
|
|
int button,
|
|
|
|
|
double x,
|
|
|
|
|
double y,
|
|
|
|
|
guint32 timestamp)
|
2001-03-29 21:17:45 +00:00
|
|
|
|
{
|
2020-05-17 16:35:45 +00:00
|
|
|
|
GdkSurface *surface = GDK_SURFACE (toplevel);
|
2019-03-23 18:56:21 +00:00
|
|
|
|
int root_x, root_y;
|
2020-07-24 13:54:49 +00:00
|
|
|
|
int direction;
|
2014-01-13 03:06:59 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2001-03-29 21:17:45 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2014-01-13 03:06:59 +00:00
|
|
|
|
if (button == 0)
|
|
|
|
|
direction = _NET_WM_MOVERESIZE_MOVE_KEYBOARD;
|
|
|
|
|
else
|
|
|
|
|
direction = _NET_WM_MOVERESIZE_MOVE;
|
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_get_root_coords (surface, x, y, &root_x, &root_y);
|
2019-03-23 18:56:21 +00:00
|
|
|
|
|
2014-03-13 19:19:26 +00:00
|
|
|
|
/* Avoid EWMH for touch devices */
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (_should_perform_ewmh_drag (surface, device))
|
|
|
|
|
wmspec_moveresize (surface, direction, device, button, root_x, root_y, timestamp);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
else
|
2018-03-20 14:14:10 +00:00
|
|
|
|
emulate_move_drag (surface, device, button, root_x, root_y, timestamp);
|
2001-03-29 21:17:45 +00:00
|
|
|
|
}
|
2004-07-11 13:26:57 +00:00
|
|
|
|
|
2010-11-25 11:28:08 +00:00
|
|
|
|
static gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_beep (GdkSurface *surface)
|
2006-08-30 03:30:43 +00:00
|
|
|
|
{
|
2006-08-30 16:02:41 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = GDK_SURFACE_DISPLAY (surface);
|
2006-08-30 16:02:41 +00:00
|
|
|
|
|
2006-08-30 03:30:43 +00:00
|
|
|
|
#ifdef HAVE_XKB
|
2010-12-20 18:20:10 +00:00
|
|
|
|
if (GDK_X11_DISPLAY (display)->use_xkb)
|
2010-11-25 11:28:08 +00:00
|
|
|
|
{
|
|
|
|
|
XkbBell (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2010-11-25 11:28:08 +00:00
|
|
|
|
0,
|
|
|
|
|
None);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
2006-08-30 03:30:43 +00:00
|
|
|
|
#endif
|
2010-11-25 11:28:08 +00:00
|
|
|
|
|
|
|
|
|
return FALSE;
|
2006-08-30 03:30:43 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-03-04 17:38:27 +00:00
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_opacity (GdkSurface *surface,
|
2020-03-04 17:38:27 +00:00
|
|
|
|
double opacity)
|
2007-04-30 07:27:22 +00:00
|
|
|
|
{
|
|
|
|
|
GdkDisplay *display;
|
2014-07-14 03:33:26 +00:00
|
|
|
|
gulong cardinal;
|
2007-04-30 07:27:22 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_if_fail (GDK_IS_SURFACE (surface));
|
2007-04-30 07:27:22 +00:00
|
|
|
|
|
2019-04-22 13:16:55 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2007-04-30 07:27:22 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2007-04-30 07:27:22 +00:00
|
|
|
|
|
|
|
|
|
if (opacity < 0)
|
|
|
|
|
opacity = 0;
|
|
|
|
|
else if (opacity > 1)
|
|
|
|
|
opacity = 1;
|
|
|
|
|
|
|
|
|
|
cardinal = opacity * 0xffffffff;
|
|
|
|
|
|
|
|
|
|
if (cardinal == 0xffffffff)
|
|
|
|
|
XDeleteProperty (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2007-04-30 07:27:22 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_OPACITY"));
|
|
|
|
|
else
|
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2007-04-30 07:27:22 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_WINDOW_OPACITY"),
|
|
|
|
|
XA_CARDINAL, 32,
|
|
|
|
|
PropModeReplace,
|
2007-06-06 00:03:25 +00:00
|
|
|
|
(guchar *) &cardinal, 1);
|
2007-04-30 07:27:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
2010-05-25 22:38:44 +00:00
|
|
|
|
static Bool
|
|
|
|
|
timestamp_predicate (Display *display,
|
|
|
|
|
XEvent *xevent,
|
|
|
|
|
XPointer arg)
|
|
|
|
|
{
|
|
|
|
|
Window xwindow = GPOINTER_TO_UINT (arg);
|
|
|
|
|
GdkDisplay *gdk_display = gdk_x11_lookup_xdisplay (display);
|
|
|
|
|
|
|
|
|
|
if (xevent->type == PropertyNotify &&
|
|
|
|
|
xevent->xproperty.window == xwindow &&
|
|
|
|
|
xevent->xproperty.atom == gdk_x11_get_xatom_by_name_for_display (gdk_display,
|
|
|
|
|
"GDK_TIMESTAMP_PROP"))
|
|
|
|
|
return True;
|
|
|
|
|
|
|
|
|
|
return False;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* gdk_x11_get_server_time:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a #GdkSurface, used for communication
|
|
|
|
|
* with the server. The surface must have
|
2011-07-28 11:27:23 +00:00
|
|
|
|
* GDK_PROPERTY_CHANGE_MASK in its events mask or a hang will
|
|
|
|
|
* result.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
*
|
|
|
|
|
* Routine to get the current X server time stamp.
|
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the time stamp.
|
2010-05-25 22:38:44 +00:00
|
|
|
|
**/
|
|
|
|
|
guint32
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_get_server_time (GdkSurface *surface)
|
2010-05-25 22:38:44 +00:00
|
|
|
|
{
|
|
|
|
|
Display *xdisplay;
|
|
|
|
|
Window xwindow;
|
|
|
|
|
guchar c = 'a';
|
|
|
|
|
XEvent xevent;
|
|
|
|
|
Atom timestamp_prop_atom;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
g_return_val_if_fail (GDK_IS_SURFACE (surface), 0);
|
|
|
|
|
g_return_val_if_fail (!GDK_SURFACE_DESTROYED (surface), 0);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xdisplay = GDK_SURFACE_XDISPLAY (surface);
|
|
|
|
|
xwindow = GDK_SURFACE_XID (surface);
|
2010-05-25 22:38:44 +00:00
|
|
|
|
timestamp_prop_atom =
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (GDK_SURFACE_DISPLAY (surface),
|
2010-05-25 22:38:44 +00:00
|
|
|
|
"GDK_TIMESTAMP_PROP");
|
|
|
|
|
|
|
|
|
|
XChangeProperty (xdisplay, xwindow, timestamp_prop_atom,
|
|
|
|
|
timestamp_prop_atom,
|
|
|
|
|
8, PropModeReplace, &c, 1);
|
|
|
|
|
|
|
|
|
|
XIfEvent (xdisplay, &xevent,
|
|
|
|
|
timestamp_predicate, GUINT_TO_POINTER(xwindow));
|
|
|
|
|
|
|
|
|
|
return xevent.xproperty.time;
|
|
|
|
|
}
|
2010-10-05 22:08:25 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_x11_surface_get_xid:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a native #GdkSurface.
|
2010-10-05 22:08:25 +00:00
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* Returns the X resource (surface) belonging to a #GdkSurface.
|
2010-10-05 22:08:25 +00:00
|
|
|
|
*
|
2014-02-19 23:49:43 +00:00
|
|
|
|
* Returns: the ID of @drawable’s X resource.
|
2010-10-05 22:08:25 +00:00
|
|
|
|
**/
|
|
|
|
|
XID
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_get_xid (GdkSurface *surface)
|
2010-10-05 22:08:25 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
return GDK_X11_SURFACE (surface)->xid;
|
2010-10-05 22:08:25 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-24 13:54:49 +00:00
|
|
|
|
static int
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_get_scale_factor (GdkSurface *surface)
|
2013-06-20 09:40:07 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2013-06-20 09:40:07 +00:00
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2013-06-20 09:40:07 +00:00
|
|
|
|
return 1;
|
|
|
|
|
|
2018-03-20 11:05:26 +00:00
|
|
|
|
return impl->surface_scale;
|
2013-06-20 09:40:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-26 14:05:38 +00:00
|
|
|
|
/**
|
2018-03-20 10:40:08 +00:00
|
|
|
|
* gdk_x11_surface_set_frame_sync_enabled:
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* @surface: (type GdkX11Surface): a native #GdkSurface
|
2013-06-26 14:05:38 +00:00
|
|
|
|
* @frame_sync_enabled: whether frame-synchronization should be enabled
|
|
|
|
|
*
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* This function can be used to disable frame synchronization for a surface.
|
2013-06-26 14:05:38 +00:00
|
|
|
|
* Normally frame synchronziation will be enabled or disabled based on whether
|
|
|
|
|
* the system has a compositor that supports frame synchronization, but if
|
2018-03-20 14:14:10 +00:00
|
|
|
|
* the surface is not directly managed by the window manager, then frame
|
|
|
|
|
* synchronziation may need to be disabled. This is the case for a surface
|
2013-06-26 14:05:38 +00:00
|
|
|
|
* embedded via the XEMBED protocol.
|
|
|
|
|
*/
|
|
|
|
|
void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_frame_sync_enabled (GdkSurface *surface,
|
2013-06-26 14:05:38 +00:00
|
|
|
|
gboolean frame_sync_enabled)
|
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GDK_X11_SURFACE (surface)->frame_sync_enabled = FALSE;
|
2013-06-26 14:05:38 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-14 20:23:33 +00:00
|
|
|
|
static void
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_set_opaque_region (GdkSurface *surface,
|
2013-05-14 20:23:33 +00:00
|
|
|
|
cairo_region_t *region)
|
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2013-05-14 20:23:33 +00:00
|
|
|
|
GdkDisplay *display;
|
|
|
|
|
int nitems;
|
|
|
|
|
gulong *data;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (GDK_SURFACE_DESTROYED (surface))
|
2013-09-04 18:45:01 +00:00
|
|
|
|
return;
|
|
|
|
|
|
2013-05-14 20:23:33 +00:00
|
|
|
|
if (region != NULL)
|
|
|
|
|
{
|
|
|
|
|
int i, nrects;
|
|
|
|
|
|
|
|
|
|
nrects = cairo_region_num_rectangles (region);
|
|
|
|
|
nitems = nrects * 4;
|
|
|
|
|
data = g_new (gulong, nitems);
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < nrects; i++)
|
|
|
|
|
{
|
|
|
|
|
cairo_rectangle_int_t rect;
|
|
|
|
|
cairo_region_get_rectangle (region, i, &rect);
|
2018-03-20 11:05:26 +00:00
|
|
|
|
data[i*4+0] = rect.x * impl->surface_scale;
|
|
|
|
|
data[i*4+1] = rect.y * impl->surface_scale;
|
|
|
|
|
data[i*4+2] = rect.width * impl->surface_scale;
|
|
|
|
|
data[i*4+3] = rect.height * impl->surface_scale;
|
2013-05-14 20:23:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
nitems = 0;
|
|
|
|
|
data = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
display = gdk_surface_get_display (surface);
|
2013-05-14 20:23:33 +00:00
|
|
|
|
|
|
|
|
|
XChangeProperty (GDK_DISPLAY_XDISPLAY (display),
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GDK_SURFACE_XID (surface),
|
2013-05-14 20:23:33 +00:00
|
|
|
|
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_OPAQUE_REGION"),
|
|
|
|
|
XA_CARDINAL, 32, PropModeReplace,
|
|
|
|
|
(guchar *) data, nitems);
|
|
|
|
|
|
2014-07-14 15:02:13 +00:00
|
|
|
|
g_free (data);
|
2013-05-14 20:23:33 +00:00
|
|
|
|
}
|
|
|
|
|
|
2014-03-13 21:28:01 +00:00
|
|
|
|
static gboolean
|
2018-03-20 14:14:10 +00:00
|
|
|
|
gdk_x11_surface_show_window_menu (GdkSurface *surface,
|
2019-03-25 04:26:42 +00:00
|
|
|
|
GdkEvent *event)
|
2014-03-13 21:28:01 +00:00
|
|
|
|
{
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkX11Surface *impl = GDK_X11_SURFACE (surface);
|
2018-03-20 14:14:10 +00:00
|
|
|
|
GdkDisplay *display = GDK_SURFACE_DISPLAY (surface);
|
2014-03-13 21:28:01 +00:00
|
|
|
|
GdkDevice *device;
|
|
|
|
|
int device_id;
|
2019-03-25 04:26:42 +00:00
|
|
|
|
double x, y;
|
|
|
|
|
int x_root, y_root;
|
2014-03-13 21:28:01 +00:00
|
|
|
|
XClientMessageEvent xclient = { 0 };
|
|
|
|
|
|
Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.
The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.
The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 16:23:36 +00:00
|
|
|
|
GdkEventType event_type = gdk_event_get_event_type (event);
|
|
|
|
|
|
|
|
|
|
switch ((guint) event_type)
|
2014-03-13 21:28:01 +00:00
|
|
|
|
{
|
|
|
|
|
case GDK_BUTTON_PRESS:
|
|
|
|
|
case GDK_BUTTON_RELEASE:
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
if (!gdk_x11_screen_supports_net_wm_hint (GDK_SURFACE_SCREEN (surface),
|
2017-12-14 04:39:03 +00:00
|
|
|
|
g_intern_static_string ("_GTK_SHOW_WINDOW_MENU")))
|
2014-03-13 21:28:01 +00:00
|
|
|
|
return FALSE;
|
|
|
|
|
|
2020-02-18 03:11:56 +00:00
|
|
|
|
gdk_event_get_position (event, &x, &y);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_get_root_coords (surface, x, y, &x_root, &y_root);
|
2014-03-13 21:28:01 +00:00
|
|
|
|
device = gdk_event_get_device (event);
|
|
|
|
|
g_object_get (G_OBJECT (device),
|
|
|
|
|
"device-id", &device_id,
|
|
|
|
|
NULL);
|
|
|
|
|
|
2014-05-22 19:01:36 +00:00
|
|
|
|
/* Ungrab the implicit grab */
|
2015-12-16 18:21:33 +00:00
|
|
|
|
gdk_seat_ungrab (gdk_device_get_seat (device));
|
2014-05-22 19:01:36 +00:00
|
|
|
|
|
2014-03-13 21:28:01 +00:00
|
|
|
|
xclient.type = ClientMessage;
|
2018-03-20 14:14:10 +00:00
|
|
|
|
xclient.window = GDK_SURFACE_XID (surface);
|
2014-03-13 21:28:01 +00:00
|
|
|
|
xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display, "_GTK_SHOW_WINDOW_MENU");
|
|
|
|
|
xclient.data.l[0] = device_id;
|
2018-03-20 11:05:26 +00:00
|
|
|
|
xclient.data.l[1] = x_root * impl->surface_scale;
|
|
|
|
|
xclient.data.l[2] = y_root * impl->surface_scale;
|
2014-03-13 21:28:01 +00:00
|
|
|
|
xclient.format = 32;
|
|
|
|
|
|
2018-03-20 14:14:10 +00:00
|
|
|
|
XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_SURFACE_XROOTWIN (surface), False,
|
2014-03-13 21:28:01 +00:00
|
|
|
|
SubstructureRedirectMask | SubstructureNotifyMask,
|
|
|
|
|
(XEvent *)&xclient);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-22 19:42:00 +00:00
|
|
|
|
static void
|
2019-04-22 01:14:46 +00:00
|
|
|
|
gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
|
2010-11-22 19:42:00 +00:00
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
2019-04-22 01:14:46 +00:00
|
|
|
|
GdkSurfaceClass *impl_class = GDK_SURFACE_CLASS (klass);
|
2010-11-22 19:42:00 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
object_class->finalize = gdk_x11_surface_finalize;
|
2010-11-22 19:42:00 +00:00
|
|
|
|
|
2019-04-22 01:14:46 +00:00
|
|
|
|
impl_class->hide = gdk_x11_surface_hide;
|
|
|
|
|
impl_class->get_geometry = gdk_x11_surface_get_geometry;
|
|
|
|
|
impl_class->get_root_coords = gdk_x11_surface_get_root_coords;
|
|
|
|
|
impl_class->get_device_state = gdk_x11_surface_get_device_state;
|
2020-03-01 19:29:06 +00:00
|
|
|
|
impl_class->set_input_region = gdk_x11_surface_set_input_region;
|
2018-03-20 10:40:08 +00:00
|
|
|
|
impl_class->destroy = gdk_x11_surface_destroy;
|
|
|
|
|
impl_class->beep = gdk_x11_surface_beep;
|
|
|
|
|
|
|
|
|
|
impl_class->destroy_notify = gdk_x11_surface_destroy_notify;
|
|
|
|
|
impl_class->drag_begin = _gdk_x11_surface_drag_begin;
|
|
|
|
|
impl_class->get_scale_factor = gdk_x11_surface_get_scale_factor;
|
|
|
|
|
impl_class->set_opaque_region = gdk_x11_surface_set_opaque_region;
|
|
|
|
|
impl_class->set_shadow_width = gdk_x11_surface_set_shadow_width;
|
|
|
|
|
impl_class->create_gl_context = gdk_x11_surface_create_gl_context;
|
|
|
|
|
impl_class->get_unscaled_size = gdk_x11_surface_get_unscaled_size;
|
2010-11-22 19:42:00 +00:00
|
|
|
|
}
|
2020-03-07 21:59:24 +00:00
|
|
|
|
|
|
|
|
|
#define LAST_PROP 1
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GdkX11Surface parent_instance;
|
|
|
|
|
} GdkX11Popup;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GdkX11SurfaceClass parent_class;
|
|
|
|
|
} GdkX11PopupClass;
|
|
|
|
|
|
|
|
|
|
static void gdk_x11_popup_iface_init (GdkPopupInterface *iface);
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GdkX11Popup, gdk_x11_popup, GDK_TYPE_X11_SURFACE,
|
|
|
|
|
G_IMPLEMENT_INTERFACE (GDK_TYPE_POPUP,
|
|
|
|
|
gdk_x11_popup_iface_init))
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_popup_init (GdkX11Popup *popup)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2020-03-27 15:54:25 +00:00
|
|
|
|
gdk_x11_popup_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2020-03-07 21:59:24 +00:00
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface = GDK_SURFACE (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case LAST_PROP + GDK_POPUP_PROP_PARENT:
|
|
|
|
|
g_value_set_object (value, surface->parent);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_POPUP_PROP_AUTOHIDE:
|
|
|
|
|
g_value_set_boolean (value, surface->autohide);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2020-03-27 15:54:25 +00:00
|
|
|
|
gdk_x11_popup_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2020-03-07 21:59:24 +00:00
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface = GDK_SURFACE (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case LAST_PROP + GDK_POPUP_PROP_PARENT:
|
|
|
|
|
surface->parent = g_value_dup_object (value);
|
|
|
|
|
if (surface->parent != NULL)
|
|
|
|
|
surface->parent->children = g_list_prepend (surface->parent->children, surface);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_POPUP_PROP_AUTOHIDE:
|
|
|
|
|
surface->autohide = g_value_get_boolean (value);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_popup_class_init (GdkX11PopupClass *class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
|
|
|
|
|
2020-03-27 15:54:25 +00:00
|
|
|
|
object_class->get_property = gdk_x11_popup_get_property;
|
|
|
|
|
object_class->set_property = gdk_x11_popup_set_property;
|
2020-03-07 21:59:24 +00:00
|
|
|
|
|
|
|
|
|
gdk_popup_install_properties (object_class, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_popup_present (GdkPopup *popup,
|
|
|
|
|
int width,
|
|
|
|
|
int height,
|
|
|
|
|
GdkPopupLayout *layout)
|
|
|
|
|
{
|
|
|
|
|
return gdk_x11_surface_present_popup (GDK_SURFACE (popup), width, height, layout);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GdkGravity
|
|
|
|
|
gdk_x11_popup_get_surface_anchor (GdkPopup *popup)
|
|
|
|
|
{
|
|
|
|
|
return GDK_SURFACE (popup)->popup.surface_anchor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static GdkGravity
|
|
|
|
|
gdk_x11_popup_get_rect_anchor (GdkPopup *popup)
|
|
|
|
|
{
|
|
|
|
|
return GDK_SURFACE (popup)->popup.rect_anchor;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
gdk_x11_popup_get_position_x (GdkPopup *popup)
|
|
|
|
|
{
|
|
|
|
|
return GDK_SURFACE (popup)->x;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
gdk_x11_popup_get_position_y (GdkPopup *popup)
|
|
|
|
|
{
|
|
|
|
|
return GDK_SURFACE (popup)->y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_popup_iface_init (GdkPopupInterface *iface)
|
|
|
|
|
{
|
|
|
|
|
iface->present = gdk_x11_popup_present;
|
|
|
|
|
iface->get_surface_anchor = gdk_x11_popup_get_surface_anchor;
|
|
|
|
|
iface->get_rect_anchor = gdk_x11_popup_get_rect_anchor;
|
|
|
|
|
iface->get_position_x = gdk_x11_popup_get_position_x;
|
|
|
|
|
iface->get_position_y = gdk_x11_popup_get_position_y;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GdkX11Surface parent_instance;
|
|
|
|
|
} GdkX11Toplevel;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GdkX11SurfaceClass parent_class;
|
|
|
|
|
} GdkX11ToplevelClass;
|
|
|
|
|
|
|
|
|
|
static void gdk_x11_toplevel_iface_init (GdkToplevelInterface *iface);
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GdkX11Toplevel, gdk_x11_toplevel, GDK_TYPE_X11_SURFACE,
|
|
|
|
|
G_IMPLEMENT_INTERFACE (GDK_TYPE_TOPLEVEL,
|
|
|
|
|
gdk_x11_toplevel_iface_init))
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_toplevel_init (GdkX11Toplevel *toplevel)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
static void
|
2020-03-27 15:54:25 +00:00
|
|
|
|
gdk_x11_toplevel_set_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
const GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2020-03-07 21:59:24 +00:00
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface = GDK_SURFACE (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_TITLE:
|
|
|
|
|
gdk_x11_surface_set_title (surface, g_value_get_string (value));
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_STARTUP_ID:
|
|
|
|
|
gdk_x11_surface_set_startup_id (surface, g_value_get_string (value));
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_TRANSIENT_FOR:
|
|
|
|
|
gdk_x11_surface_set_transient_for (surface, g_value_get_object (value));
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_MODAL:
|
|
|
|
|
gdk_x11_surface_set_modal_hint (surface, g_value_get_boolean (value));
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
|
|
|
|
|
gdk_x11_surface_set_icon_list (surface, g_value_get_pointer (value));
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
|
|
|
|
|
gdk_x11_surface_set_decorations (surface, g_value_get_boolean (value) ? GDK_DECOR_ALL : 0);
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
|
|
|
|
|
gdk_x11_surface_set_functions (surface, g_value_get_boolean (value) ? GDK_FUNC_ALL : GDK_FUNC_ALL | GDK_FUNC_CLOSE);
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-03-09 18:49:59 +00:00
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE:
|
|
|
|
|
surface->fullscreen_mode = g_value_get_enum (value);
|
|
|
|
|
gdk_x11_surface_apply_fullscreen_mode (surface);
|
|
|
|
|
g_object_notify_by_pspec (G_OBJECT (surface), pspec);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-03-20 14:24:06 +00:00
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED:
|
|
|
|
|
break;
|
|
|
|
|
|
2020-03-07 21:59:24 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
2020-03-27 15:54:25 +00:00
|
|
|
|
gdk_x11_toplevel_get_property (GObject *object,
|
|
|
|
|
guint prop_id,
|
|
|
|
|
GValue *value,
|
|
|
|
|
GParamSpec *pspec)
|
2020-03-07 21:59:24 +00:00
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface = GDK_SURFACE (object);
|
|
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
|
{
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_STATE:
|
|
|
|
|
g_value_set_flags (value, surface->state);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_TITLE:
|
|
|
|
|
g_value_set_string (value, "");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_STARTUP_ID:
|
|
|
|
|
g_value_set_string (value, "");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_TRANSIENT_FOR:
|
|
|
|
|
g_value_set_object (value, surface->transient_for);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_MODAL:
|
|
|
|
|
g_value_set_boolean (value, surface->modal_hint);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_ICON_LIST:
|
|
|
|
|
g_value_set_pointer (value, NULL);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_DECORATED:
|
|
|
|
|
{
|
|
|
|
|
GdkWMDecoration decorations = GDK_DECOR_ALL;
|
|
|
|
|
gdk_x11_surface_get_decorations (surface, &decorations);
|
|
|
|
|
g_value_set_boolean (value, decorations != 0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_DELETABLE:
|
|
|
|
|
{
|
|
|
|
|
GdkWMFunction functions = GDK_FUNC_ALL;
|
|
|
|
|
gdk_x11_surface_get_functions (surface, &functions);
|
|
|
|
|
g_value_set_boolean (value, functions == GDK_FUNC_ALL);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
|
2020-03-09 18:49:59 +00:00
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_FULLSCREEN_MODE:
|
|
|
|
|
g_value_set_enum (value, surface->fullscreen_mode);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-03-20 14:24:06 +00:00
|
|
|
|
case LAST_PROP + GDK_TOPLEVEL_PROP_SHORTCUTS_INHIBITED:
|
|
|
|
|
g_value_set_boolean (value, surface->shortcuts_inhibited);
|
|
|
|
|
break;
|
|
|
|
|
|
2020-03-07 21:59:24 +00:00
|
|
|
|
default:
|
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_toplevel_class_init (GdkX11ToplevelClass *class)
|
|
|
|
|
{
|
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
|
|
|
|
|
2020-03-27 15:54:25 +00:00
|
|
|
|
object_class->get_property = gdk_x11_toplevel_get_property;
|
|
|
|
|
object_class->set_property = gdk_x11_toplevel_set_property;
|
2020-03-07 21:59:24 +00:00
|
|
|
|
|
2020-03-14 19:24:48 +00:00
|
|
|
|
gdk_toplevel_install_properties (object_class, LAST_PROP);
|
2020-03-07 21:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_toplevel_present (GdkToplevel *toplevel,
|
|
|
|
|
GdkToplevelLayout *layout)
|
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface = GDK_SURFACE (toplevel);
|
2020-07-30 21:06:59 +00:00
|
|
|
|
GdkDisplay *display = gdk_surface_get_display (surface);
|
|
|
|
|
GdkMonitor *monitor;
|
|
|
|
|
GdkToplevelSize size;
|
|
|
|
|
int bounds_width, bounds_height;
|
|
|
|
|
int width, height;
|
2020-03-07 21:59:24 +00:00
|
|
|
|
GdkGeometry geometry;
|
|
|
|
|
GdkSurfaceHints mask;
|
2020-05-16 22:41:44 +00:00
|
|
|
|
gboolean was_mapped;
|
2020-03-07 21:59:24 +00:00
|
|
|
|
|
|
|
|
|
gdk_x11_surface_unminimize (surface);
|
|
|
|
|
|
2020-07-30 21:06:59 +00:00
|
|
|
|
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
|
|
|
|
if (monitor)
|
|
|
|
|
{
|
|
|
|
|
GdkRectangle workarea;
|
|
|
|
|
|
|
|
|
|
gdk_x11_monitor_get_workarea (monitor, &workarea);
|
|
|
|
|
bounds_width = workarea.width;
|
|
|
|
|
bounds_height = workarea.height;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
bounds_width = G_MAXINT;
|
|
|
|
|
bounds_height = G_MAXINT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
|
|
|
|
gdk_toplevel_notify_compute_size (toplevel, &size);
|
|
|
|
|
g_warn_if_fail (size.width > 0);
|
|
|
|
|
g_warn_if_fail (size.height > 0);
|
|
|
|
|
width = size.width;
|
|
|
|
|
height = size.height;
|
|
|
|
|
|
2020-03-07 21:59:24 +00:00
|
|
|
|
if (gdk_toplevel_layout_get_resizable (layout))
|
|
|
|
|
{
|
2020-07-30 21:06:59 +00:00
|
|
|
|
geometry.min_width = size.min_width;
|
|
|
|
|
geometry.min_height = size.min_height;
|
2020-03-07 21:59:24 +00:00
|
|
|
|
mask = GDK_HINT_MIN_SIZE;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
geometry.max_width = geometry.min_width = width;
|
|
|
|
|
geometry.max_height = geometry.min_height = height;
|
|
|
|
|
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
|
|
|
|
}
|
|
|
|
|
gdk_x11_surface_set_geometry_hints (surface, &geometry, mask);
|
|
|
|
|
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
|
|
|
|
|
gdk_x11_surface_toplevel_resize (surface, width, height);
|
|
|
|
|
|
|
|
|
|
if (gdk_toplevel_layout_get_maximized (layout))
|
|
|
|
|
gdk_x11_surface_maximize (surface);
|
|
|
|
|
else
|
|
|
|
|
gdk_x11_surface_unmaximize (surface);
|
|
|
|
|
|
|
|
|
|
if (gdk_toplevel_layout_get_fullscreen (layout))
|
|
|
|
|
{
|
2020-07-30 21:06:59 +00:00
|
|
|
|
GdkMonitor *fullscreen_monitor =
|
|
|
|
|
gdk_toplevel_layout_get_fullscreen_monitor (layout);
|
|
|
|
|
|
|
|
|
|
if (fullscreen_monitor)
|
|
|
|
|
gdk_x11_surface_fullscreen_on_monitor (surface, fullscreen_monitor);
|
2020-03-07 21:59:24 +00:00
|
|
|
|
else
|
|
|
|
|
gdk_x11_surface_fullscreen (surface);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
gdk_x11_surface_unfullscreen (surface);
|
|
|
|
|
|
|
|
|
|
if (surface->destroyed)
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
|
|
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
|
|
|
|
|
|
|
|
|
|
if (!was_mapped)
|
|
|
|
|
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
|
|
|
|
|
2020-05-16 22:41:44 +00:00
|
|
|
|
gdk_x11_surface_show (surface, was_mapped);
|
2020-03-07 21:59:24 +00:00
|
|
|
|
|
|
|
|
|
if (!was_mapped)
|
2020-05-16 22:41:44 +00:00
|
|
|
|
gdk_surface_invalidate_rect (surface, NULL);
|
2020-03-07 21:59:24 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_toplevel_minimize (GdkToplevel *toplevel)
|
|
|
|
|
{
|
|
|
|
|
gdk_x11_surface_minimize (GDK_SURFACE (toplevel));
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_toplevel_lower (GdkToplevel *toplevel)
|
|
|
|
|
{
|
|
|
|
|
gdk_x11_surface_lower (GDK_SURFACE (toplevel));
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_toplevel_focus (GdkToplevel *toplevel,
|
|
|
|
|
guint32 timestamp)
|
|
|
|
|
{
|
|
|
|
|
gdk_x11_surface_focus (GDK_SURFACE (toplevel), timestamp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_toplevel_show_window_menu (GdkToplevel *toplevel,
|
|
|
|
|
GdkEvent *event)
|
|
|
|
|
{
|
|
|
|
|
return gdk_x11_surface_show_window_menu (GDK_SURFACE (toplevel), event);
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-09 18:38:08 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_toplevel_supports_edge_constraints (GdkToplevel *toplevel)
|
|
|
|
|
{
|
|
|
|
|
return gdk_x11_surface_supports_edge_constraints (GDK_SURFACE (toplevel));
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-20 14:24:06 +00:00
|
|
|
|
static void
|
|
|
|
|
gdk_x11_toplevel_inhibit_system_shortcuts (GdkToplevel *toplevel,
|
|
|
|
|
GdkEvent *gdk_event)
|
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface = GDK_SURFACE (toplevel);
|
|
|
|
|
GdkSeat *gdk_seat;
|
|
|
|
|
GdkGrabStatus status;
|
|
|
|
|
|
|
|
|
|
if (surface->shortcuts_inhibited)
|
|
|
|
|
return; /* Already inhibited */
|
|
|
|
|
|
|
|
|
|
if (!(surface->state & GDK_SURFACE_STATE_FOCUSED))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
gdk_seat = gdk_surface_get_seat_from_event (surface, gdk_event);
|
|
|
|
|
|
|
|
|
|
if (!(gdk_seat_get_capabilities (gdk_seat) & GDK_SEAT_CAPABILITY_KEYBOARD))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
status = gdk_seat_grab (gdk_seat, surface, GDK_SEAT_CAPABILITY_KEYBOARD,
|
|
|
|
|
TRUE, NULL, gdk_event, NULL, NULL);
|
|
|
|
|
|
|
|
|
|
if (status != GDK_GRAB_SUCCESS)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
surface->shortcuts_inhibited = TRUE;
|
|
|
|
|
surface->current_shortcuts_inhibited_seat = gdk_seat;
|
|
|
|
|
g_object_notify (G_OBJECT (toplevel), "shortcuts-inhibited");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_toplevel_restore_system_shortcuts (GdkToplevel *toplevel)
|
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface = GDK_SURFACE (toplevel);
|
|
|
|
|
GdkSeat *gdk_seat;
|
|
|
|
|
|
|
|
|
|
if (!surface->shortcuts_inhibited)
|
|
|
|
|
return; /* Not inhibited */
|
|
|
|
|
|
|
|
|
|
gdk_seat = surface->current_shortcuts_inhibited_seat;
|
|
|
|
|
gdk_seat_ungrab (gdk_seat);
|
|
|
|
|
surface->current_shortcuts_inhibited_seat = NULL;
|
|
|
|
|
|
|
|
|
|
surface->shortcuts_inhibited = FALSE;
|
|
|
|
|
g_object_notify (G_OBJECT (toplevel), "shortcuts-inhibited");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_toplevel_state_callback (GdkSurface *surface)
|
|
|
|
|
{
|
|
|
|
|
if (surface->state & GDK_SURFACE_STATE_FOCUSED)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (surface->shortcuts_inhibited)
|
|
|
|
|
gdk_x11_toplevel_restore_system_shortcuts (GDK_TOPLEVEL (surface));
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-31 12:38:08 +00:00
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_toplevel_event_callback (GdkSurface *surface,
|
|
|
|
|
GdkEvent *gdk_event)
|
|
|
|
|
{
|
|
|
|
|
GdkSeat *gdk_seat;
|
|
|
|
|
|
|
|
|
|
if (!surface->shortcuts_inhibited)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
if (gdk_event_get_event_type (gdk_event) != GDK_GRAB_BROKEN)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
gdk_seat = gdk_surface_get_seat_from_event (surface, gdk_event);
|
|
|
|
|
if (gdk_seat != surface->current_shortcuts_inhibited_seat)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
surface->current_shortcuts_inhibited_seat = NULL;
|
|
|
|
|
surface->shortcuts_inhibited = FALSE;
|
|
|
|
|
g_object_notify (G_OBJECT (surface), "shortcuts-inhibited");
|
|
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
2020-03-07 21:59:24 +00:00
|
|
|
|
static void
|
|
|
|
|
gdk_x11_toplevel_iface_init (GdkToplevelInterface *iface)
|
|
|
|
|
{
|
|
|
|
|
iface->present = gdk_x11_toplevel_present;
|
|
|
|
|
iface->minimize = gdk_x11_toplevel_minimize;
|
|
|
|
|
iface->lower = gdk_x11_toplevel_lower;
|
|
|
|
|
iface->focus = gdk_x11_toplevel_focus;
|
|
|
|
|
iface->show_window_menu = gdk_x11_toplevel_show_window_menu;
|
2020-03-09 18:38:08 +00:00
|
|
|
|
iface->supports_edge_constraints = gdk_x11_toplevel_supports_edge_constraints;
|
2020-03-20 14:24:06 +00:00
|
|
|
|
iface->inhibit_system_shortcuts = gdk_x11_toplevel_inhibit_system_shortcuts;
|
|
|
|
|
iface->restore_system_shortcuts = gdk_x11_toplevel_restore_system_shortcuts;
|
2020-05-17 16:35:45 +00:00
|
|
|
|
iface->begin_resize = gdk_x11_toplevel_begin_resize;
|
|
|
|
|
iface->begin_move = gdk_x11_toplevel_begin_move;
|
2020-03-07 21:59:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GdkX11Surface parent_instance;
|
|
|
|
|
} GdkX11DragSurface;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
GdkX11SurfaceClass parent_class;
|
|
|
|
|
} GdkX11DragSurfaceClass;
|
|
|
|
|
|
|
|
|
|
static void gdk_x11_drag_surface_iface_init (GdkDragSurfaceInterface *iface);
|
|
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GdkX11DragSurface, gdk_x11_drag_surface, GDK_TYPE_X11_SURFACE,
|
|
|
|
|
G_IMPLEMENT_INTERFACE (GDK_TYPE_DRAG_SURFACE,
|
|
|
|
|
gdk_x11_drag_surface_iface_init))
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_drag_surface_init (GdkX11DragSurface *surface)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_drag_surface_class_init (GdkX11DragSurfaceClass *class)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
|
gdk_x11_drag_surface_present (GdkDragSurface *drag_surface,
|
|
|
|
|
int width,
|
|
|
|
|
int height)
|
|
|
|
|
{
|
|
|
|
|
GdkSurface *surface = GDK_SURFACE (drag_surface);
|
|
|
|
|
|
|
|
|
|
gdk_x11_surface_toplevel_resize (surface, width, height);
|
2020-05-14 12:33:57 +00:00
|
|
|
|
gdk_synthesize_surface_state (surface, GDK_SURFACE_STATE_WITHDRAWN, 0);
|
2020-03-07 21:59:24 +00:00
|
|
|
|
gdk_x11_surface_show (surface, FALSE);
|
2020-05-14 12:33:57 +00:00
|
|
|
|
gdk_surface_invalidate_rect (surface, NULL);
|
2020-03-07 21:59:24 +00:00
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
gdk_x11_drag_surface_iface_init (GdkDragSurfaceInterface *iface)
|
|
|
|
|
{
|
|
|
|
|
iface->present = gdk_x11_drag_surface_present;
|
|
|
|
|
}
|