From 288efe84da6dc93db88c0a89f6be66e0ef4545f3 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Thu, 28 Mar 2002 21:42:35 +0000 Subject: [PATCH] In bitmap.cpp, CreateFromImage, took GetWidth and GetHeight out of loop. Fixed wxWindowX11::FindFocus so text selections work again. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/x11/bitmap.cpp | 12 ++++++++---- src/x11/window.cpp | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/x11/bitmap.cpp b/src/x11/bitmap.cpp index 214d4554f7..31fd1858f0 100644 --- a/src/x11/bitmap.cpp +++ b/src/x11/bitmap.cpp @@ -150,11 +150,13 @@ bool wxMask::Create( const wxBitmap& bitmap, XSetForeground( xdisplay, gc, BlackPixel(xdisplay,xscreen) ); - for (int j = 0; j < image.GetHeight(); j++) + int width = image.GetWidth(); + int height = image.GetHeight(); + for (int j = 0; j < height; j++) { int start_x = -1; int i; - for (i = 0; i < image.GetWidth(); i++) + for (i = 0; i < width; i++) { if ((data[index] == red) && (data[index+1] == green) && @@ -906,10 +908,12 @@ wxImage wxBitmap::ConvertToImage() const // GdkColormap *cmap = gtk_widget_get_default_colormap(); + int width = GetWidth(); + int height = GetHeight(); long pos = 0; - for (int j = 0; j < GetHeight(); j++) + for (int j = 0; j < height; j++) { - for (int i = 0; i < GetWidth(); i++) + for (int i = 0; i < width; i++) { unsigned long pixel = XGetPixel( x_image, i, j ); if (bpp == 1) diff --git a/src/x11/window.cpp b/src/x11/window.cpp index ecd6293088..18aad1d212 100644 --- a/src/x11/window.cpp +++ b/src/x11/window.cpp @@ -379,6 +379,10 @@ wxWindow *wxWindowBase::FindFocus() if (xfocus) { wxWindow *win = wxGetWindowFromTable( xfocus ); + if (!win) + { + win = wxGetClientWindowFromTable( xfocus ); + } return win; } @@ -901,7 +905,7 @@ void wxWindowX11::DoMoveWindow(int x, int y, int width, int height) width -= size.x; } - XMoveResizeWindow( wxGlobalDisplay(), xwindow, x, y, width, height ); + XMoveResizeWindow( wxGlobalDisplay(), xwindow, x, y, wxMax(1, width), wxMax(1, height) ); } #else -- 2.45.2