Re: Some questions regarding _gdk_window_impl_new() (csw, win32, patch)
- From: Hans Breuer <hans breuer org>
- To: Alexander Larsson <alexl redhat com>
- Cc: Gtk-Devel <gtk-devel-list gnome org>
- Subject: Re: Some questions regarding _gdk_window_impl_new() (csw, win32, patch)
- Date: Fri, 27 Aug 2010 22:41:31 +0200
At 24.08.2010 10:14, Alexander Larsson wrote:
On Sat, 2010-08-21 at 14:09 +0200, Hans Breuer wrote:
while trying to fix _gdk_window_impl_new() for win32 some more,
quite some questions arose around that (apparently undocumented;)) API:
- if the information given to _gdk_window_impl_new() is redundant,
as with GDK_WA_VISUAL set and visual given by parameter, which one
has precedence?
Use the visual parameter, it is based on GDK_WA_VISUAL if set already.
So I could assert on it ...
From attributes the only things used is: colormap, title, wmclass and
type_hint.
Will check. Again it might be usefult to assert on nothing else being set?
Or maybe not, because the canconical implementation also uses GDK_WA_NOREDIR ;)
After adding explict checks for remaining atrributes I wonder if
GDK_WA_CURSOR should explicitly note be used, although passed into
_gdk_window_impl_new()? It is set by e.g. testgtk::(color selection).
- when turning a csw into a native window, shouldn't the new window
position be calculated against the native parent? If so: should
the caller do it and give GDK_WA_(X|Y)?
Ignore the passed in position and size in attributes. The window
position is already calculated for the csw window, and all you need to
do is offset it to reach the nearest native window, so the position
should be:
private->x + private->parent->abs_x,
private->y + private->parent->abs_y
Thanks, doene and pushed.
To explain this, private->x/y is the offset from the parent GdkWindow to
this window, whereas private->abs_x/y is the offset from the "nearest"
native window to the window. We can't use private->abs_x/y here, because
it is zero for a native window.
And the size is always private->width x private->height.
None of this is very obvious, nor documented. Just look at how the x
backend does it, as that is the canonical implementation.
I usually do, but this time I was a bit lost before in all the xattributes
settings. Thanks for the explaination, it gives much simpler code than I
had in my patch.
- how to get back default OS/window-manager placment of toplevel
windows? (The old implementation used to place toplevel windows
with CW_USEDEFAULT, my new implementation is doing similar)
Not sure what you mean here. Can't you just pass CW_USEDEFAULT for toplevels?
Yes, this is what I meant and did in the patch. I just wanted to have it
confirmed.
- what's the (visual) depth of a GDK_INPUT_ONLY window?
( Dia(win32) with gtk>=2.18 is crashing on it's Navigation popup,
which can be fixed by setting the visual depth to something
reasonable, but it used to be 0 before csw. Maybe this is hiding
a bug elsewhere, e.g. returning the wrong window when forced to
be native? )
The visual for input-only windows is 0, but this is set by the common
code in gdk_window_new, so its not something the backend should have to
care about.
To rephrase my question: where should I start searching for the
incompatibility introduced with csw? For some reason Dia tries to create a
pixmap with the visual depth of the GDK_INPUT_ONLY window.
The fatal attempt to create a pixmap with depth=0 can be overcome by
setting depth=visual->depth for input-only windows.
It also can be avoided with the attached patch, but both approached look
quite wrong. Do you have a better idea?
Another question is regarding "GDK_NATIVE_WINDOWS". With my current
patch at least the drawing seems to work reasonable again, but the
(ENTER|LEAVE)_NOTIFY handling is not, so the mouse pointer is almost
useless. Is it necessary to ressurect most of the original code (pre-csw)
to make it work again, or should there be an easier way?
I'm not sure exactly how enter/leave notification works on win32, but
yeah, GDK_NATIVE_WINDOWS more or less passes on events as they arrived
from the windowing system,
Unfortunately not from my understanding. The (ENTER|LEAVE)_NOTIFY handling
had to be emulated on win32, with TrackMouseEvent. Some initial fix is
available in the gtk-2-22 branch.
But the "automatic grab" needed for menu highlighting is still not working
again (and I'm unsure if I should continue trying).
rather than doing the csw rewriting magic.
GDL_NATIVE_WINDOWS is really more of a hack for apps like eclipse and
lotus notes that need compatibility with old gdk behaviour when they do
really weird x stuff.
I don't think supporting it on win32 is very useful. I mean, what is the
expected behaviour? The natural thing would be to be backwards
compatible with the exact old pre-csw mouse pointer code, but are any
apps really depending on that exact behaviour?
Maybe not, but there are at least two bug reports regarding native windows
on win32. About positioning:
https://bugzilla.gnome.org/show_bug.cgi?id=625972
Also the drawing seemed to be mostly broken before my patch.
I hope the just pushed changes are also fixing
https://bugzilla.gnome.org/show_bug.cgi?id=628049
Thanks,
Hans
-------- Hans "at" Breuer "dot" Org -----------
Tell me what you need, and I'll tell you how to
get along without it. -- Dilbert
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 53e19d9..61cd9b9 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -39,6 +39,9 @@
static GdkColormap* gdk_window_impl_win32_get_colormap (GdkDrawable *drawable);
static void gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
GdkColormap *cmap);
+
+static GdkDrawable* gdk_window_impl_win32_get_source_drawable (GdkDrawable *drawable);
+
static void gdk_window_impl_win32_init (GdkWindowImplWin32 *window);
static void gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass);
static void gdk_window_impl_win32_finalize (GObject *object);
@@ -135,6 +138,9 @@ gdk_window_impl_win32_class_init (GdkWindowImplWin32Class *klass)
drawable_class->set_colormap = gdk_window_impl_win32_set_colormap;
drawable_class->get_colormap = gdk_window_impl_win32_get_colormap;
+
+ //FIXME: why do we need this and gdk-x11 does not?
+ drawable_class->get_source_drawable = gdk_window_impl_win32_get_source_drawable;
}
static void
@@ -232,6 +238,12 @@ gdk_window_impl_win32_set_colormap (GdkDrawable *drawable,
}
}
+static GdkDrawable*
+gdk_window_impl_win32_get_source_drawable (GdkDrawable *drawable)
+{
+ return _gdk_root;
+}
+
void
_gdk_root_window_size_init (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]