gtk_window_set_decorated to false put GtkWindow in screen corner
- From: Flavio Alberto Lopes Soares <flavio maqplas com br>
- To: Lista GTK <gtk-list gnome org>
- Subject: gtk_window_set_decorated to false put GtkWindow in screen corner
- Date: Mon, 29 Sep 2003 15:57:36 -0300
Hello all,
I making an application that don't have any title bar in your
windows, I use the gtk_window_set_decorated to set this
to false, but when I do this the window move to left uper
corner when I want to show this in screen center.
Bellow is a fragment of my code where I use this.
How to solve this ?
Thanks for any help
void
on_window_programming_show             (GtkWidget       *widget,
                                        gpointer         user_data)
{
  ScreenStruct *Screen;
  GtkWidget *wid;
  Screen = Screen_prog;
  wid = (GtkWidget *) widget;
  Screen = g_malloc(sizeof(ScreenStruct));
  Screen->bt_posit.col_pos_active = 1;
  Screen->bt_posit.row_pos_active = 1;
  Screen->bt_posit.max_col = 1;
  Screen->bt_posit.max_row = 5;
  Screen->wid_father = wid;
  /* BUTTONS FUNCTIONS DEFINITIONS */
  
  (gboolean) Screen->button_func[0][0] = gtk_main_quit;
  (gboolean) Screen->button_func[0][1] = gtk_main_quit;
  (gboolean) Screen->button_func[0][2] = gtk_main_quit;
  (gboolean) Screen->button_func[0][3] = gtk_main_quit;
  (gboolean) Screen->button_func[0][4] = gtk_main_quit;
  hide_decoration(wid);  
  hide_cursor(wid);
  set_window_center(wid);
}
int
hide_cursor(gpointer user_data)
{
static unsigned char cursor1_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; 
static unsigned char cursor1mask_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  GdkCursor *cursor;
  GdkPixmap *source, *mask;
  GdkColor fg = { 0, 0, 0, 0 }; /* Transparent */
  GdkColor bg = { 0, 0, 0, 0 }; /* Transparent */
  gtk_widget_realize(GTK_WIDGET(user_data));
  source = gdk_bitmap_create_from_data (NULL, cursor1_bits, cursor1_width, cursor1_height);
  mask = gdk_bitmap_create_from_data (NULL, cursor1mask_bits, cursor1_width, cursor1_height);
  cursor = gdk_cursor_new_from_pixmap (source, mask, &fg, &bg, 8, 8);
  gdk_pixmap_unref (source);
  gdk_pixmap_unref (mask);   
  gdk_window_set_cursor (GTK_WIDGET(user_data)->window, cursor);
  return 0;
}
int
hide_decoration(gpointer user_data)
{
  gtk_widget_realize(GTK_WIDGET(user_data));
  
  if(gtk_window_get_decorated(GTK_WINDOW(user_data)))
    gtk_window_set_decorated(GTK_WINDOW(user_data), FALSE);
  return 0;
}
int
set_window_center(gpointer user_data)
{
  gtk_window_set_position(GTK_WINDOW(user_data), GTK_WIN_POS_CENTER_ALWAYS);
  return 0;
}
-- 
Flavio Alberto Lopes Soares
flavio maqplas com br
MAQPLAS Indústria e Comércio de Máquinas LTDA.
http://www.maqplas.com.br
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]