Problems with window position, virtual desktops and fonts



Hi

I have a few problems:

1. Positioning of windows
2. Show / Hide a window on the same virtual desktop
3. Quick way to find the best font to fill an area


I have a problem with the window positioning

Here is the code from the first problem:

[schnipp]

void displayer_karaoke_window_finish(void)
{
	// get position
	gdk_window_get_position(displayer_karaoke_window_win->window, &posX, &posY);
	// save position
	singit_config_save_plugin_position("karaoke_window", posX, posY, -1, -1);
	gtk_widget_destroy(displayer_karaoke_window_win);
}

......

void displayer_karaoke_window_init(void)
{
	Buildup window....
	....
	gtk_widget_realize(displayer_karaoke_window_win);
	...

	// load position...

	if (singit_config_load_plugin_position("karaoke_window", &posX, &posY, NULL, NULL)) {
		gdk_window_move(displayer_karaoke_window_win->window, posX, posY);
	}
	else
		gtk_window_set_position
			(GTK_WINDOW(displayer_karaoke_window_win), GTK_WIN_POS_CENTER);
}

......

Later on in the program I call

  gtk_widget_show(displayer_karaoke_window_win);

[schnapp]

I checked the config file - position stored is ok (40 / 480)
I have checked the loaded position via printf - the position is correct (same as stored)

The window doesn't appear at the right position (about 60 / 60).

Any ideas ?



2. Problem

I need to show and hide a window on the same virtual desktop.
It's no problem to hide the window, because it's independent of the
virtual desktop.

The problem occures when I close the window and change to an other virtual
desktop.

When I call gtk_widget_show(...) / gdk_window_show(...) the window is
shown on my active desktop, not on the one where it has been closed.
I had a some ideas and implemented them (using map / unmap - signals) but
no one worked as expected.

Any ideas ?



3. Problem

I need to get the best font size to fit an area.
My current function is very slow.

First I check if there is a scaleable font from the same family
(XListFonts(...))

Then I construct Xfont - strings with different sizes, load the fonts
(gdk_font_load(...) and check the current string width
(gdk_string_width(...)) as long as the font width is smaller then
the area.width.

Is there any way to speed this up? Even on a PIII 733 it needs seconds for
about 50 fonts.



Thanks

Jan-Marek Glogowski





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]