How to move window with SDL

Please can you help me with:
How to move window with SDL?

Regards,
Rohit Singh.

I can only speak from Windows experience, but there is no easy way to
move or position the window from within your code.

TankkoOn 6/13/05, Rohit Singh <rohit.singh at emuzed.com> wrote:

Please can you help me with:
How to move window with SDL?

Regards,
Rohit Singh.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

I tried this with no luck, but it was a quick test, so I might not
have filled everything out correctly for the struct/flags.

TankkoOn 6/13/05, Donny Viszneki wrote:

On Jun 13, 2005, at 12:55 PM, Tankko Omaskio wrote:

I can only speak from Windows experience, but there is no easy way to
move or position the window from within your code.

Tankko is not correct (I think.) It should be very easy to do on
windows. Observe:

#ifdef WIN32
/* Declare our “system window manager info” structure for retrieving
window manger system information, and a window handle */
HWND hwnd;
SDL_SysWMInfo info;

/* The info structure requires us to tell the runtime environment what
version of SDL we’re compiling with before we can SDL_GetWMInfo, so we
use a preprocessor macro, which will fill out info.version with
constants defined at build-time. I assume this is because the info
structure changes from version to version (can anyone back me up on
this?) */
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info))
{
hwnd = info->window;
SetWindowPos(hwnd, x, y, width, height, FLAGS);
}
#endif/WIN32/

Rohit, you may have to set some FLAGS. For more information on those,
read the MSDN documentation for this function:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/
winui/windowsuserinterface/windowing/windows/windowreference/
windowfunctions/setwindowpos.asp

There is a possibility that this function isn’t known to work, and that
Tankko is way ahead of me. I haven’t personally done this, but I’ve had
extensive experience with Windows API programming, and I just dredged
up the rest by taking a brief look at the SDL source code.

Let me know if it works Rohit.

I tried to do it on Linux with:

int x = 0, y = 0;

SDL_SysWMinfo info;
SDL_VERSION(&info.version);

if (SDL_GetWMInfo(&info) > 0 ) {
if (info.subsystem == SDL_SYSWM_X11) {
info.info.x11.lock_func();
XMoveWindow(info.info.x11.display, info.info.x11.window, x, y);
info.info.x11.unlock_func();
}
}

But it moved Widget within Windows instead of moving Windows.

I tried to get parent Windows, but was not able to find a suitable
function to do that.

Regards,
Rohit Singh.

Tankko Omaskio wrote:> I tried this with no luck, but it was a quick test, so I might not

have filled everything out correctly for the struct/flags.

Tankko

On 6/13/05, Donny Viszneki wrote:

On Jun 13, 2005, at 12:55 PM, Tankko Omaskio wrote:

I can only speak from Windows experience, but there is no easy way to
move or position the window from within your code.

Tankko is not correct (I think.) It should be very easy to do on
windows. Observe:

#ifdef WIN32
/* Declare our “system window manager info” structure for retrieving
window manger system information, and a window handle */
HWND hwnd;
SDL_SysWMInfo info;

/* The info structure requires us to tell the runtime environment what
version of SDL we’re compiling with before we can SDL_GetWMInfo, so we
use a preprocessor macro, which will fill out info.version with
constants defined at build-time. I assume this is because the info
structure changes from version to version (can anyone back me up on
this?) */
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info))
{
hwnd = info->window;
SetWindowPos(hwnd, x, y, width, height, FLAGS);
}
#endif/WIN32/

Rohit, you may have to set some FLAGS. For more information on those,
read the MSDN documentation for this function:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/
winui/windowsuserinterface/windowing/windows/windowreference/
windowfunctions/setwindowpos.asp

There is a possibility that this function isn’t known to work, and that
Tankko is way ahead of me. I haven’t personally done this, but I’ve had
extensive experience with Windows API programming, and I just dredged
up the rest by taking a brief look at the SDL source code.

Let me know if it works Rohit.

I tried to do it on Linux with:

int x = 0, y = 0;

SDL_SysWMinfo info;
SDL_VERSION(&info.version);

if (SDL_GetWMInfo(&info) > 0 ) {
if (info.subsystem == SDL_SYSWM_X11) {
info.info.x11.lock_func();
XMoveWindow(info.info.x11.display, info.info.x11.window, x, y);
info.info.x11.unlock_func();
}
}

But it moved Widget within Windows instead of moving Windows.

I tried to get parent Windows, but was not able to find a suitable
function to do that.

Try XQueryTree().

see: http://tronche.com/gui/x/xlib/window-information/XQueryTree.html
and your man pages.On 6/13/05, Rohit Singh <rohit.singh at emuzed.com> wrote:

Regards,
Rohit Singh.

Tankko Omaskio wrote:

I tried this with no luck, but it was a quick test, so I might not
have filled everything out correctly for the struct/flags.

Tankko

On 6/13/05, Donny Viszneki wrote:

On Jun 13, 2005, at 12:55 PM, Tankko Omaskio wrote:

I can only speak from Windows experience, but there is no easy way to
move or position the window from within your code.

Tankko is not correct (I think.) It should be very easy to do on
windows. Observe:

#ifdef WIN32
/* Declare our “system window manager info” structure for retrieving
window manger system information, and a window handle */
HWND hwnd;
SDL_SysWMInfo info;

/* The info structure requires us to tell the runtime environment what
version of SDL we’re compiling with before we can SDL_GetWMInfo, so we
use a preprocessor macro, which will fill out info.version with
constants defined at build-time. I assume this is because the info
structure changes from version to version (can anyone back me up on
this?) */
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info))
{
hwnd = info->window;
SetWindowPos(hwnd, x, y, width, height, FLAGS);
}
#endif/WIN32/

Rohit, you may have to set some FLAGS. For more information on those,
read the MSDN documentation for this function:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/
winui/windowsuserinterface/windowing/windows/windowreference/
windowfunctions/setwindowpos.asp

There is a possibility that this function isn’t known to work, and that
Tankko is way ahead of me. I haven’t personally done this, but I’ve had
extensive experience with Windows API programming, and I just dredged
up the rest by taking a brief look at the SDL source code.

Let me know if it works Rohit.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

Following works:

SDL_SysWMinfo info;
Window root;
Window parent;
Window *children;
unsigned int children_count;
SDL_VERSION(&info.version);

if (SDL_GetWMInfo(&info) > 0 ) {
	if (info.subsystem == SDL_SYSWM_X11) {
		XQueryTree(	info.info.x11.display,
				info.info.x11.window,
				&root,
				&parent,
				&children,
				&children_count);
		info.info.x11.lock_func();
		XMoveWindow(	info.info.x11.display,
				parent,
				x,
				y);
		info.info.x11.unlock_func();
		if( children ) XFree(children);
	}
}

David Sharp wrote:> On 6/13/05, Rohit Singh <@Rohit_Singh> wrote:

I tried to do it on Linux with:

int x = 0, y = 0;

SDL_SysWMinfo info;
SDL_VERSION(&info.version);

if (SDL_GetWMInfo(&info) > 0 ) {
if (info.subsystem == SDL_SYSWM_X11) {
info.info.x11.lock_func();
XMoveWindow(info.info.x11.display, info.info.x11.window, x, y);
info.info.x11.unlock_func();
}
}

But it moved Widget within Windows instead of moving Windows.

I tried to get parent Windows, but was not able to find a suitable
function to do that.

Try XQueryTree().

see: http://tronche.com/gui/x/xlib/window-information/XQueryTree.html
and your man pages.

Regards,
Rohit Singh.

Tankko Omaskio wrote:

I tried this with no luck, but it was a quick test, so I might not
have filled everything out correctly for the struct/flags.

Tankko

On 6/13/05, Donny Viszneki wrote:

On Jun 13, 2005, at 12:55 PM, Tankko Omaskio wrote:

I can only speak from Windows experience, but there is no easy way to
move or position the window from within your code.

Tankko is not correct (I think.) It should be very easy to do on
windows. Observe:

#ifdef WIN32
/* Declare our “system window manager info” structure for retrieving
window manger system information, and a window handle */
HWND hwnd;
SDL_SysWMInfo info;

/* The info structure requires us to tell the runtime environment what
version of SDL we’re compiling with before we can SDL_GetWMInfo, so we
use a preprocessor macro, which will fill out info.version with
constants defined at build-time. I assume this is because the info
structure changes from version to version (can anyone back me up on
this?) */
SDL_VERSION(&info.version);
if (SDL_GetWMInfo(&info))
{
hwnd = info->window;
SetWindowPos(hwnd, x, y, width, height, FLAGS);
}
#endif/WIN32/

Rohit, you may have to set some FLAGS. For more information on those,
read the MSDN documentation for this function:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/
winui/windowsuserinterface/windowing/windows/windowreference/
windowfunctions/setwindowpos.asp

There is a possibility that this function isn’t known to work, and that
Tankko is way ahead of me. I haven’t personally done this, but I’ve had
extensive experience with Windows API programming, and I just dredged
up the rest by taking a brief look at the SDL source code.

Let me know if it works Rohit.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl