resize changes/fixes/whatever_you_want_to_call_them_part_2

This commit is contained in:
pavlov%pavlov.net 1999-07-07 05:31:01 +00:00
Родитель 342cc9dcf7
Коммит 0f2ac3ddee
2 изменённых файлов: 30 добавлений и 5 удалений

Просмотреть файл

@ -150,6 +150,9 @@ NS_IMETHODIMP nsDeviceContextGTK::CreateRenderingContext(nsIRenderingContext *&a
nsIRenderingContext *pContext;
nsresult rv;
nsDrawingSurfaceGTK *surf;
GtkWidget *w;
w = (GtkWidget*)mWidget;
// to call init for this, we need to have a valid nsDrawingSurfaceGTK created
pContext = new nsRenderingContextGTK();
@ -161,14 +164,24 @@ NS_IMETHODIMP nsDeviceContextGTK::CreateRenderingContext(nsIRenderingContext *&a
// create the nsDrawingSurfaceGTK
surf = new nsDrawingSurfaceGTK();
if (nsnull != surf)
if (surf && w)
{
GdkDrawable *gwin = nsnull;
GdkDrawable *win = nsnull;
// FIXME
if (GTK_IS_LAYOUT((GtkWidget*)mWidget))
win = (GdkDrawable*)gdk_window_ref(GTK_LAYOUT((GtkWidget*)mWidget)->bin_window);
if (GTK_IS_LAYOUT(w))
gwin = (GdkDrawable*)GTK_LAYOUT(w)->bin_window;
else
win = (GdkDrawable*)gdk_window_ref(((GtkWidget*)mWidget)->window);
gwin = (GdkDrawable*)(w)->window;
// window might not be realized... ugh
if (gwin)
gdk_window_ref(gwin);
else
win = gdk_pixmap_new(nsnull,
w->allocation.width,
w->allocation.height,
gdk_rgb_get_visual()->depth);
GdkGC *gc = gdk_gc_new(win);

Просмотреть файл

@ -107,7 +107,19 @@ NS_IMETHODIMP nsRenderingContextGTK::Init(nsIDeviceContext* aContext,
// we want to ref the window here so that we can unref in the drawing surface.
// otherwise, we can not unref and that causes windows that are created in the
// drawing surface not to be freed.
GdkDrawable *win = (GdkDrawable*)gdk_window_ref((GdkWindow *)aWindow->GetNativeData(NS_NATIVE_WINDOW));
GdkDrawable *win = (GdkDrawable*)aWindow->GetNativeData(NS_NATIVE_WINDOW);
if (win)
gdk_window_ref((GdkWindow*)win);
else
{
GtkWidget *w = aWindow->GetNativeData(NS_NATIVE_WIDGET);
win = gdk_pixmap_new(nsnull,
w->allocation.width,
w->allocation.height,
gdk_rgb_get_visual()->depth);
}
#else
GdkDrawable *win = (GdkDrawable *)aWindow->GetNativeData(NS_NATIVE_WINDOW);
#endif