From 2e5c594e36341ee6a1f000e7ccbd8537a3ec4643 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 4 Nov 1999 19:47:03 +0000 Subject: [PATCH 1/1] Window placement changes. Pure guessing. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4361 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/dnd/dnd.cpp | 2 +- src/gtk/dialog.cpp | 4 ++-- src/gtk/dnd.cpp | 2 +- src/gtk/frame.cpp | 12 +++++++++--- src/gtk1/dialog.cpp | 4 ++-- src/gtk1/dnd.cpp | 2 +- src/gtk1/frame.cpp | 12 +++++++++--- 7 files changed, 25 insertions(+), 13 deletions(-) diff --git a/samples/dnd/dnd.cpp b/samples/dnd/dnd.cpp index 97d9afb108..820f0c1beb 100644 --- a/samples/dnd/dnd.cpp +++ b/samples/dnd/dnd.cpp @@ -664,7 +664,7 @@ bool DnDApp::OnInit() // create the main frame window DnDFrame *frame = new DnDFrame((wxFrame *) NULL, "Drag-and-Drop/Clipboard wxWindows Sample", - 50, 50, 450, 340); + 10, 10, 450, 340); // activate it frame->Show(TRUE); diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index 0b7bc6e2df..a16a4003e6 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -121,7 +121,7 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win ) /* I haven't been able to set the position of the dialog before it is shown, so I set the position in "realize" */ - gtk_widget_set_uposition( widget, win->m_x, win->m_y ); + gtk_window_reposition( GTK_WINDOW(widget), win->m_x, win->m_y ); /* all this is for Motif Window Manager "hints" and is supposed to be recognized by other WM as well. not tested. */ @@ -497,7 +497,7 @@ void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { /* we set the position here and when showing the dialog for the first time in idle time */ - gtk_widget_set_uposition( m_widget, m_x, m_y ); + gtk_window_reposition( GTK_WINDOW(m_widget), m_x, m_y ); } } diff --git a/src/gtk/dnd.cpp b/src/gtk/dnd.cpp index b0f7ef082f..ad29403fb1 100644 --- a/src/gtk/dnd.cpp +++ b/src/gtk/dnd.cpp @@ -230,7 +230,7 @@ static gboolean target_drag_drop( GtkWidget *widget, if (!ret) { - wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") ); + wxLogDebug( wxT( "Drop target: OnDrop returned FALSE") ); /* cancel the whole thing */ gtk_drag_finish( context, diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index 0f1306462d..5a6412e426 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -202,11 +202,17 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev so we do this directly after realization */ static gint -gtk_frame_realized_callback( GtkWidget *WXUNUSED(widget), wxFrame *win ) +gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); + /* I haven't been able to set the position of + the dialog before it is shown, so I set the + position in "realize" */ + printf( "%d %d\n", win->m_x, win->m_y ); + gtk_window_reposition( GTK_WINDOW(widget), win->m_x, win->m_y ); + /* all this is for Motif Window Manager "hints" and is supposed to be recognized by other WM as well. not tested. */ long decor = (long) GDK_DECOR_BORDER; @@ -399,7 +405,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame; - GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; + GtkWindowType win_type = GTK_WINDOW_DIALOG; // this makes window placement work if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; m_widget = gtk_window_new( win_type ); @@ -564,7 +570,7 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { if ((m_x != old_x) || (m_y != old_y)) { - gtk_widget_set_uposition( m_widget, m_x, m_y ); + gtk_window_reposition( GTK_WINDOW(m_widget), m_x, m_y ); } } diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index 0b7bc6e2df..a16a4003e6 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -121,7 +121,7 @@ gtk_dialog_realized_callback( GtkWidget *widget, wxDialog *win ) /* I haven't been able to set the position of the dialog before it is shown, so I set the position in "realize" */ - gtk_widget_set_uposition( widget, win->m_x, win->m_y ); + gtk_window_reposition( GTK_WINDOW(widget), win->m_x, win->m_y ); /* all this is for Motif Window Manager "hints" and is supposed to be recognized by other WM as well. not tested. */ @@ -497,7 +497,7 @@ void wxDialog::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { /* we set the position here and when showing the dialog for the first time in idle time */ - gtk_widget_set_uposition( m_widget, m_x, m_y ); + gtk_window_reposition( GTK_WINDOW(m_widget), m_x, m_y ); } } diff --git a/src/gtk1/dnd.cpp b/src/gtk1/dnd.cpp index b0f7ef082f..ad29403fb1 100644 --- a/src/gtk1/dnd.cpp +++ b/src/gtk1/dnd.cpp @@ -230,7 +230,7 @@ static gboolean target_drag_drop( GtkWidget *widget, if (!ret) { - wxLogDebug( wxT( "Drop target: OnDrop returned TRUE") ); + wxLogDebug( wxT( "Drop target: OnDrop returned FALSE") ); /* cancel the whole thing */ gtk_drag_finish( context, diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index 0f1306462d..5a6412e426 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -202,11 +202,17 @@ gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *ev so we do this directly after realization */ static gint -gtk_frame_realized_callback( GtkWidget *WXUNUSED(widget), wxFrame *win ) +gtk_frame_realized_callback( GtkWidget *widget, wxFrame *win ) { if (g_isIdle) wxapp_install_idle_handler(); + /* I haven't been able to set the position of + the dialog before it is shown, so I set the + position in "realize" */ + printf( "%d %d\n", win->m_x, win->m_y ); + gtk_window_reposition( GTK_WINDOW(widget), win->m_x, win->m_y ); + /* all this is for Motif Window Manager "hints" and is supposed to be recognized by other WM as well. not tested. */ long decor = (long) GDK_DECOR_BORDER; @@ -399,7 +405,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, m_insertCallback = (wxInsertChildFunction) wxInsertChildInFrame; - GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; + GtkWindowType win_type = GTK_WINDOW_DIALOG; // this makes window placement work if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; m_widget = gtk_window_new( win_type ); @@ -564,7 +570,7 @@ void wxFrame::DoSetSize( int x, int y, int width, int height, int sizeFlags ) { if ((m_x != old_x) || (m_y != old_y)) { - gtk_widget_set_uposition( m_widget, m_x, m_y ); + gtk_window_reposition( GTK_WINDOW(m_widget), m_x, m_y ); } } -- 2.45.2