[Plib-devel] PATCH: (proper) fullscreen support for plib
Brought to you by:
sjbaker
From: Hans de G. <j.w...@hh...> - 2006-06-02 20:43:57
|
Hi, First a short intro. I'm a Linux enthousiast / programmer and a packager for Fedora Extras which is an online community that packages software in the native package format for Fedora Core a (well known) Linux distribution. I've send the mail below to sjbaker about 2 weeks ago, but got no response. Further investigation has learned that plib now a days seems to be maintained by other people, thus I now send this to the plib-devel list. I've been busy the last 2 days packaging tuxkart which uses plib. During this packaging I've found both a bug and a missing feature in plib, wich are both fixed by the attached patch: -The bug is that plib (pw) creates a resizable window, but that tuxkart expects the window to always be the size it has specified iow it expects a non resizable window. Now one could concider this a bug in tuxkart, but its not uncommon for games to be written to a hardcoded resolution and not written for a resizable window. Besides making the window non resizable is much easier then fixing tuxkart. To fix this I've added a new function: void pwSetResizable ( bool enable ) ; The default behaviour is still to create a resizable window because I didn't want to break the api and/or change any default behaviour. -The missing feature is the fact that plib doesn't have fullscreen support, atleast not really: * Its possible to create a fullscreen window by passing -1 for width and height and disabling the border. But I've tried this (6 months ago or so) and there were issues (If I remember correctly the gnome panel was on top of the window). * Besides the issues their is the problem that in that case your desktop size gets used and the application thus cannot specify the size it wants (see above). Also the desktop size usually is a rather high resoltution which peformance wise is not ideal for 3D games. * Last but not least with the current "fullscreen" code its not possible to switch between fullscreen <-> window easily. * The attached patch uses XF86VidMode to switch to the requested resolution instead of always using the desktopsize and it allows easy fullscreen <-> window switching: void pwSetFullscreen () ; void pwSetWindowed () ; void pwToggleFullscreen () ; * Notice that I've choosen not to reuse the border flag for the new fullscreen support, so that the behaviour of plib is 100% identical for apps who do not use these new functions. If an app wants to use the new fullscreen code it must call pwSetFullscreen () after pwInit. * Some apps don't want to show a cursor when fullscreen, whereas a hidden cursor in windowed mode is annoying. Thus I've added a new function which allows an app to specify seperate cursors for fullscreen and windowed mode: void pwSetCursorEx ( int wm, int fs ) ; Phew, long story. Well thats it I hope you like it! One problem though, I only implemented this for Unix, I hope / think it will be easy to implement for window, and maybe you can just add empty stubs for a start? Also I didn't add support for this to the configure script and makefiles (yet). I've tested it by using: ./configure CXXFLAGS="-O2 -DXF86VIDMODE" Regards, Hans |