<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://maemo.octonezd.me/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=70.242.115.107</id>
	<title>Maemo Wiki Mirror - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://maemo.octonezd.me/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=70.242.115.107"/>
	<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php/Special:Contributions/70.242.115.107"/>
	<updated>2026-04-22T09:08:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=Game_development&amp;diff=12240</id>
		<title>Game development</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=Game_development&amp;diff=12240"/>
		<updated>2008-06-11T16:42:49Z</updated>

		<summary type="html">&lt;p&gt;70.242.115.107: /* External Links */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains tips on game development and SDL library usage for internet tablets.&lt;br /&gt;
&lt;br /&gt;
=Useful Tips=&lt;br /&gt;
&lt;br /&gt;
==Hardware notes==&lt;br /&gt;
&lt;br /&gt;
* Internet tablets use a touchscreen, which enables new ways to implement game-features, such as on-screen buttons, in-game drawing, moving * character by tapping screen. etc.&lt;br /&gt;
* Since the device does not have any buttons on right side, implement those in software!&lt;br /&gt;
* Avoid using the 4 way rocker for fast and complex movements. It&#039;s not well suited for gaming.&lt;br /&gt;
* When using screen&#039;s vertical orientation (as in tetris) think other use for esc button than exiting game. It&#039;s so close to the rocker that accidental presses will happen.&lt;br /&gt;
&lt;br /&gt;
==SDL specific notes==&lt;br /&gt;
&lt;br /&gt;
Things to remember:&lt;br /&gt;
* The screen is natively 800x480. No resolution changes are supported. Maybe in the future we might have support for 400x240 res for faster graphics but this is quite unlikely. If trying to set fullscreen window smaller than the native screen size, you will just have black borders.&lt;br /&gt;
* In windowed mode matchbox will force the window to certain size (you should look at the UI specifications to see the actual window size). If your requested window is smaller than this, your window will be aligned to the upper-left and have black borders on the lower-right.&lt;br /&gt;
Generally SDL windows (not fullscreen) look quite bad with the theme if nothing for the theme is done inside the SDL window, but it&#039;s up to you to decide.&lt;br /&gt;
* Avoid full 800x480 screen updates. Memory bandwidth is limited. If you still have to do these for some reason, you should make the area smaller (eg having some statusbar or any GUI elements which doesn&#039;t need to be updated each time). Also do not use SDL_Flip(), since it will update whole screen. Use rect updating functions instead. Thank you.&lt;br /&gt;
* 32 bit mode doesn&#039;t work. The reason was that there was a bug that caused SDL to segfault when you had 32 bit window and you recreated the window. Since the display is only 16 bit, there is no reason to support 32 bit mode, which would just give extra round of pixel conversion and therefore slow things down. Convert your images on loading to native 16-bit with SDL.&lt;br /&gt;
* Mouse events. There is touchscreen, and you can&#039;t assume average end user Billy-Bob would hack the device to USB host mode and use the USB mouse. So use absolute coordinates as much as possible. One example where relative coordinates are used is scummvm. If you use keypad to move the cursor, and then use the touchscreen, the actuall cursor will be at offset from original touchpadpress. Think absolutely, not relatively ;)&lt;br /&gt;
&lt;br /&gt;
===Utilizing pixel doubling inside SDL===&lt;br /&gt;
&lt;br /&gt;
As there is support for pixel-doubled drawing to the screen inside the HW, there is implementations to utilize that up to X. So if you want to use it you have to do some xlib code, therefore it might be a good idea to put this small piece of code to switch pixel doubling mode to a separate file.&lt;br /&gt;
&lt;br /&gt;
====What is pixel doubling?====&lt;br /&gt;
&lt;br /&gt;
Pixel doubling is a feature of the Xsp extension of the tablet&#039;s X server. When enabled, all draws to the display are doubled in size with a smoothing filter. This reduces required bandwidth for screen updates by a factor of 4, making full-motion fullscreen animation possible. This also allows lower-quality graphics to be drawn to portions of the screen (for example a low-res game area and a high-res status bar).&lt;br /&gt;
&lt;br /&gt;
====Pixel doubling problems and workarounds====&lt;br /&gt;
&lt;br /&gt;
* Be aware that Xsp pixel doubling feature was designed for scaling video-player videos (drawn by dsp, not X) and is not officially supported.&lt;br /&gt;
* Don&#039;t update areas which would exceed doubled coordinates 400x240.&lt;br /&gt;
* If possible, disable doubling when not drawing, because if another process draws to screen (like infoprints) while the Xsp doubling is active, results can be quite &amp;quot;artistic&amp;quot;.&lt;br /&gt;
* If mouse pointer is enabled, it will break pixel doubling. Disable it before turning on doubling with SDL_ShowCursor(0);.&lt;br /&gt;
* Many SDL games that draw several small updaterects will break Xsp pixel doubling, causing flicker. This has been discussed at length on the maemo-developer list without a resolution. If pixel doubling is causing areas to flicker, change the code from individual updated rectangles for sprites to one updaterect for your entire game screen, for example region (0,0,320,240).&lt;br /&gt;
* If your game crashes or exits before disabling pixel doubling, it will be left on until some application switches it off. This means that you will have &#039;artistic desktop&#039; or a white screen or reboot. This can be avoided by reacting to SDL active events, if somebody else gets active status, immediately switch doubling off.&lt;br /&gt;
&lt;br /&gt;
====Howto use it====&lt;br /&gt;
&lt;br /&gt;
There exists one X extension (Xsp), which can be used for that. Sample piece of code with SDL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;X11/Xlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;X11/extensions/Xsp.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;SDL/SDL.h&amp;gt;&lt;br /&gt;
#include &amp;lt;SDL/SDL_syswm.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void set_doubling(unsigned char enable)&lt;br /&gt;
{&lt;br /&gt;
  SDL_SysWMinfo wminfo;&lt;br /&gt;
  SDL_VERSION(&amp;amp;wminfo.version);&lt;br /&gt;
  SDL_GetWMInfo(&amp;amp;wminfo);&lt;br /&gt;
  XSPSetPixelDoubling(wminfo.info.x11.display, 0, enable);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when you compile it you have to include X include path and link this with libXsp (-lXsp).&lt;br /&gt;
&lt;br /&gt;
===Application name (for the Task Navigator)===&lt;br /&gt;
&lt;br /&gt;
Set the window title using&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SDL_WM_SetCaption(&amp;quot;title&amp;quot;, NULL);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maemo Task Navigator (list of open programs) identifies non-Maemo programs (like pure SDL apps) by matching StartupWMClass-variable in .desktop-file and the application &amp;quot;window manager class&amp;quot; name. By default all SDL apps have the name &amp;quot;SDL_App&amp;quot;. This can be changed with environment variable SDL_VIDEO_X11_WMCLASS.&lt;br /&gt;
&lt;br /&gt;
* Alternative 1: Here&#039;s an example: app.bin is the binary executable. app is the startup script, printed here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
BASENAME=`basename $0`&lt;br /&gt;
export SDL_VIDEO_X11_WMCLASS=${BASENAME}&lt;br /&gt;
exec ${0}.bin &amp;quot;$@&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
app.desktop is the desktop file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Encoding=UTF-8&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Name=The Application&lt;br /&gt;
Exec=/var/lib/install/usr/bin/app&lt;br /&gt;
Icon=app&lt;br /&gt;
X-Window-Icon=tn-bookmarks-link&lt;br /&gt;
X-Osso-Type=application/x-executable&lt;br /&gt;
StartupWMClass=app&lt;br /&gt;
Terminal=false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that StartupWMClass == SDL_VIDEO_X11_WMCLASS, and that Exec points to the script, not binary.&lt;br /&gt;
&lt;br /&gt;
* Alternative 2: An other possibility that doesn&#039;t need a script is the following. Put the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
putenv(&amp;quot;SDL_VIDEO_X11_WMCLASS=appexename&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in your code. A good position is directly after the main() function. In this case your control file should directly point to the application name. So there&#039;s no need for a helper script.&lt;br /&gt;
&lt;br /&gt;
=External Links=&lt;br /&gt;
&lt;br /&gt;
[http://www.libsdl.org/ Simple DirectMedia Layer Homepage]&lt;br /&gt;
&lt;br /&gt;
[http://www.gamedev.net/ Game Development Resources]&lt;/div&gt;</summary>
		<author><name>70.242.115.107</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=Game_development&amp;diff=12242</id>
		<title>Game development</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=Game_development&amp;diff=12242"/>
		<updated>2008-06-11T16:36:01Z</updated>

		<summary type="html">&lt;p&gt;70.242.115.107: New page: This page contains tips on game development and SDL library usage for internet tablets.  ==Useful Tips==  ===Hardware notes===  * Internet tablets use a touchscreen, which enables new ways...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page contains tips on game development and SDL library usage for internet tablets.&lt;br /&gt;
&lt;br /&gt;
==Useful Tips==&lt;br /&gt;
&lt;br /&gt;
===Hardware notes===&lt;br /&gt;
&lt;br /&gt;
* Internet tablets use a touchscreen, which enables new ways to implement game-features, such as on-screen buttons, in-game drawing, moving * character by tapping screen. etc.&lt;br /&gt;
* Since the device does not have any buttons on right side, implement those in software!&lt;br /&gt;
* Avoid using the 4 way rocker for fast and complex movements. It&#039;s not well suited for gaming.&lt;br /&gt;
* When using screen&#039;s vertical orientation (as in tetris) think other use for esc button than exiting game. It&#039;s so close to the rocker that accidental presses will happen.&lt;br /&gt;
&lt;br /&gt;
===SDL specific notes===&lt;br /&gt;
&lt;br /&gt;
Things to remember:&lt;br /&gt;
* The screen is natively 800x480. No resolution changes are supported. Maybe in the future we might have support for 400x240 res for faster graphics but this is quite unlikely. If trying to set fullscreen window smaller than the native screen size, you will just have black borders.&lt;br /&gt;
* In windowed mode matchbox will force the window to certain size (you should look at the UI specifications to see the actual window size). If your requested window is smaller than this, your window will be aligned to the upper-left and have black borders on the lower-right.&lt;br /&gt;
Generally SDL windows (not fullscreen) look quite bad with the theme if nothing for the theme is done inside the SDL window, but it&#039;s up to you to decide.&lt;br /&gt;
* Avoid full 800x480 screen updates. Memory bandwidth is limited. If you still have to do these for some reason, you should make the area smaller (eg having some statusbar or any GUI elements which doesn&#039;t need to be updated each time). Also do not use SDL_Flip(), since it will update whole screen. Use rect updating functions instead. Thank you.&lt;br /&gt;
* 32 bit mode doesn&#039;t work. The reason was that there was a bug that caused SDL to segfault when you had 32 bit window and you recreated the window. Since the display is only 16 bit, there is no reason to support 32 bit mode, which would just give extra round of pixel conversion and therefore slow things down. Convert your images on loading to native 16-bit with SDL.&lt;br /&gt;
* Mouse events. There is touchscreen, and you can&#039;t assume average end user Billy-Bob would hack the device to USB host mode and use the USB mouse. So use absolute coordinates as much as possible. One example where relative coordinates are used is scummvm. If you use keypad to move the cursor, and then use the touchscreen, the actuall cursor will be at offset from original touchpadpress. Think absolutely, not relatively ;)&lt;br /&gt;
&lt;br /&gt;
====Utilizing pixel doubling inside SDL====&lt;br /&gt;
&lt;br /&gt;
As there is support for pixel-doubled drawing to the screen inside the HW, there is implementations to utilize that up to X. So if you want to use it you have to do some xlib code, therefore it might be a good idea to put this small piece of code to switch pixel doubling mode to a separate file.&lt;br /&gt;
&lt;br /&gt;
=====What is pixel doubling?=====&lt;br /&gt;
&lt;br /&gt;
Pixel doubling is a feature of the Xsp extension of the tablet&#039;s X server. When enabled, all draws to the display are doubled in size with a smoothing filter. This reduces required bandwidth for screen updates by a factor of 4, making full-motion fullscreen animation possible. This also allows lower-quality graphics to be drawn to portions of the screen (for example a low-res game area and a high-res status bar).&lt;br /&gt;
&lt;br /&gt;
=====Pixel doubling problems and workarounds=====&lt;br /&gt;
&lt;br /&gt;
* Be aware that Xsp pixel doubling feature was designed for scaling video-player videos (drawn by dsp, not X) and is not officially supported.&lt;br /&gt;
* Don&#039;t update areas which would exceed doubled coordinates 400x240.&lt;br /&gt;
* If possible, disable doubling when not drawing, because if another process draws to screen (like infoprints) while the Xsp doubling is active, results can be quite &amp;quot;artistic&amp;quot;.&lt;br /&gt;
* If mouse pointer is enabled, it will break pixel doubling. Disable it before turning on doubling with SDL_ShowCursor(0);.&lt;br /&gt;
* Many SDL games that draw several small updaterects will break Xsp pixel doubling, causing flicker. This has been discussed at length on the maemo-developer list without a resolution. If pixel doubling is causing areas to flicker, change the code from individual updated rectangles for sprites to one updaterect for your entire game screen, for example region (0,0,320,240).&lt;br /&gt;
* If your game crashes or exits before disabling pixel doubling, it will be left on until some application switches it off. This means that you will have &#039;artistic desktop&#039; or a white screen or reboot. This can be avoided by reacting to SDL active events, if somebody else gets active status, immediately switch doubling off.&lt;br /&gt;
&lt;br /&gt;
=====Howto use it=====&lt;br /&gt;
&lt;br /&gt;
There exists one X extension (Xsp), which can be used for that. Sample piece of code with SDL:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;lt;X11/Xlib.h&amp;gt;&lt;br /&gt;
#include &amp;lt;X11/extensions/Xsp.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;SDL/SDL.h&amp;gt;&lt;br /&gt;
#include &amp;lt;SDL/SDL_syswm.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void set_doubling(unsigned char enable)&lt;br /&gt;
{&lt;br /&gt;
  SDL_SysWMinfo wminfo;&lt;br /&gt;
  SDL_VERSION(&amp;amp;wminfo.version);&lt;br /&gt;
  SDL_GetWMInfo(&amp;amp;wminfo);&lt;br /&gt;
  XSPSetPixelDoubling(wminfo.info.x11.display, 0, enable);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note that when you compile it you have to include X include path and link this with libXsp (-lXsp).&lt;br /&gt;
&lt;br /&gt;
====Application name (for the Task Navigator)====&lt;br /&gt;
&lt;br /&gt;
Set the window title using&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SDL_WM_SetCaption(&amp;quot;title&amp;quot;, NULL);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Maemo Task Navigator (list of open programs) identifies non-Maemo programs (like pure SDL apps) by matching StartupWMClass-variable in .desktop-file and the application &amp;quot;window manager class&amp;quot; name. By default all SDL apps have the name &amp;quot;SDL_App&amp;quot;. This can be changed with environment variable SDL_VIDEO_X11_WMCLASS.&lt;br /&gt;
&lt;br /&gt;
* Alternative 1: Here&#039;s an example: app.bin is the binary executable. app is the startup script, printed here:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
BASENAME=`basename $0`&lt;br /&gt;
export SDL_VIDEO_X11_WMCLASS=${BASENAME}&lt;br /&gt;
exec ${0}.bin &amp;quot;$@&amp;quot; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
app.desktop is the desktop file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[Desktop Entry]&lt;br /&gt;
Encoding=UTF-8&lt;br /&gt;
Version=1.0&lt;br /&gt;
Type=Application&lt;br /&gt;
Name=The Application&lt;br /&gt;
Exec=/var/lib/install/usr/bin/app&lt;br /&gt;
Icon=app&lt;br /&gt;
X-Window-Icon=tn-bookmarks-link&lt;br /&gt;
X-Osso-Type=application/x-executable&lt;br /&gt;
StartupWMClass=app&lt;br /&gt;
Terminal=false&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that StartupWMClass == SDL_VIDEO_X11_WMCLASS, and that Exec points to the script, not binary.&lt;br /&gt;
&lt;br /&gt;
* Alternative 2: An other possibility that doesn&#039;t need a script is the following. Put the line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
putenv(&amp;quot;SDL_VIDEO_X11_WMCLASS=appexename&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
in your code. A good position is directly after the main() function. In this case your control file should directly point to the application name. So there&#039;s no need for a helper script.&lt;br /&gt;
&lt;br /&gt;
==Internet Tablet game projects==&lt;br /&gt;
&lt;br /&gt;
===platform game engine===&lt;br /&gt;
&lt;br /&gt;
Simple 2D platform game engine containing tilemap and sprite-handling, bounding-box collision detection + other stuff. (Will have some simple light effects, which can be preblitted on top of tilemap/background picture.)&lt;br /&gt;
&lt;br /&gt;
==INDT Game Ports &amp;amp; development Screenshots==&lt;br /&gt;
&lt;br /&gt;
Those are small ports &amp;amp; developments made for maemo. All of them will be available for download to serve as reference for game development. Dbus integration, SDL or GTK games, Multiplayer features using wifi and bluetooth, optimization techs and some documentation will be also available.&lt;br /&gt;
&lt;br /&gt;
===Doom Port(SDL BASED)===&lt;br /&gt;
&lt;br /&gt;
After fixing some bugs related to texture loading ( on Arm it fails ) and creating a custom GUI for pen based gaming it&#039;s ready. Playing it full screen is FAST! REALLY FAST. Sounds effects are fine, better with headphone. &lt;br /&gt;
&amp;lt;!-- http://www.marceloeduardo.com/blog/up/maemo_doom_final_small.jpg --&amp;gt;&lt;br /&gt;
===Battle Gweled===&lt;br /&gt;
&lt;br /&gt;
Wifi multiplayer gweled game ( base on bejeweled classic ) User must do 3 or more stone sequences to increase powerbar, after some seconds idle a strike is done on the enemy.&lt;br /&gt;
&amp;lt;!-- http://www.marceloeduardo.com/blog/up/battlegweled.jpg splash screen --&amp;gt; &amp;lt;!-- http://www.marceloeduardo.com/blog/up/battlegweled2.jpg single Player screen --&amp;gt;&lt;br /&gt;
===Crazy Parking===&lt;br /&gt;
&lt;br /&gt;
Based on the famous rushour game, you must move cars away to make the way out clear for you machine! &lt;br /&gt;
&amp;lt;!-- http://www.marceloeduardo.com/blog/up/crazyparking.jpg --&amp;gt;&lt;br /&gt;
===Maemo Blocks===&lt;br /&gt;
&lt;br /&gt;
Classic blocks game, no explanations needed =). A must have for any platform.&lt;br /&gt;
&amp;lt;!-- http://www.marceloeduardo.com/blog/up/maemoblocks.jpg --&amp;gt;&lt;br /&gt;
you can play with the 4-way rocker or grabbing the pieces with the stylus &lt;br /&gt;
&lt;br /&gt;
===Maemo Sweeper===&lt;br /&gt;
&lt;br /&gt;
Ported from SDLMINE http://www.libsdl.org. another Classic! &lt;br /&gt;
&amp;lt;!-- http://www.marceloeduardo.com/blog/up/maemosweeper.jpg --&amp;gt;&amp;lt;!-- http://www.marceloeduardo.com/blog/up/maemosweeper_startup.jpg --&amp;gt;&lt;br /&gt;
===Ice Breaker===&lt;br /&gt;
&lt;br /&gt;
Ported to maemo! http://www.libsdl.org. really fun to play with the stylus. &amp;lt;!-- http://www.marceloeduardo.com/blog/up/icebreaker.jpg --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Pupnik&#039;s SDL game ports for ITOS==&lt;br /&gt;
&lt;br /&gt;
A large collection of SDL games and emulators in various stages of development [http://www.pupnik.de/software.html].&lt;br /&gt;
&lt;br /&gt;
A SDL demo game illustrating Xsp pixel doubling workarounds.&lt;br /&gt;
&lt;br /&gt;
http://www.pupnik.de/aliens-1.0.2_Nokia.tgz&lt;br /&gt;
&lt;br /&gt;
==External Links==&lt;br /&gt;
&lt;br /&gt;
[http://www.libsdl.org/ Simple DirectMedia Layer Homepage]&lt;br /&gt;
&lt;br /&gt;
[http://www.gamedev.net/ Game Development Resources]&lt;/div&gt;</summary>
		<author><name>70.242.115.107</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=X11_Extension_tutorial&amp;diff=43538</id>
		<title>X11 Extension tutorial</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=X11_Extension_tutorial&amp;diff=43538"/>
		<updated>2008-06-11T15:47:33Z</updated>

		<summary type="html">&lt;p&gt;70.242.115.107: /* Function wrapping */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial briefly explains what is X11 extension and how to implement one. Extensibility is one of the requirements for a windowing system. X extension interface can be used to add new functionality to X server, it also requires additional functionality from the DDX (driver) itself.&lt;br /&gt;
&lt;br /&gt;
==Programming extensions==&lt;br /&gt;
&lt;br /&gt;
X extension code can be logically divided in 3 parts :&lt;br /&gt;
* protocol definition&lt;br /&gt;
* server side functional implementation&lt;br /&gt;
* library offering API for client programs&lt;br /&gt;
&lt;br /&gt;
(+ additions to driver code to use extension)&lt;br /&gt;
&lt;br /&gt;
===Extension file structure in Kdrive===&lt;br /&gt;
&lt;br /&gt;
Directory &#039;mi&#039; contains the machine-independent library which is a set of common DDX routines. Initialization of server extensions is made by &#039;InitExtensions()&#039; function found at &#039;xserver_root/mi/miinitext.c&#039;. This file has to be changed in order to initialize extension on server startup. Other files that have to be changed in order to build and link the extension with X server are &#039;xserver_root/Makefile.am&#039; and &#039;xserver_root/configure.ac&#039;.&lt;br /&gt;
&lt;br /&gt;
Extension itself should be located in a directory of it&#039;s own, for example &#039;xserver_root/sample&#039;. This directory should be added to &#039;xserver_root/Makefile.am&#039; SUBDIRS section. Figure below shows an example of extension directory structure. The client interface can be compiled anywhere else. Client interface is usually put in it&#039;s own directory under libs directory, which contains all other libraries X uses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;xlibs_root&amp;gt;&lt;br /&gt;
         |&lt;br /&gt;
         |_ Sampleext (protocol header)&lt;br /&gt;
         |&lt;br /&gt;
         |_ Xsample (client interface)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;xserver_root&amp;gt; (Makefile.am, configure.ac)&lt;br /&gt;
           |&lt;br /&gt;
           |_ mi (miinitext.c)&lt;br /&gt;
           |&lt;br /&gt;
           |_ sample (extension files)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Protocol===&lt;br /&gt;
&lt;br /&gt;
Protocol consists of requests, events, replies and error messages. These are sent between client and server. Example : client sends a request for server using the library provided by extension, extension-code on serverside processes this request and performs required action + sends a reply to client.&lt;br /&gt;
&lt;br /&gt;
The basic structure of request packet is predefined and every request must contain this 4-byte header information. After the header data, request can contain any amount of optional data limited only by the max packet size of the transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef struct _xReq {&lt;br /&gt;
  CARD8 reqType;            /* major opcode of request, allocated by server on extension initialization          */&lt;br /&gt;
  CARD8 data;               /* undefined, usually used as &#039;minor opcode&#039; by the extension to differiate requests */&lt;br /&gt;
  CARD16 length;            /* total length of request (including header) in 4 byte quantities                   */&lt;br /&gt;
  ...&lt;br /&gt;
} xReq;&lt;br /&gt;
&lt;br /&gt;
The structure skeleton of a request packet. All request structures must be multiple of 4 bytes long.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef struct _xRep {&lt;br /&gt;
  CARD8 type;                  /* X_Reply                                */&lt;br /&gt;
  CARD8 pad1;                  /* can be anything, used for padding here */&lt;br /&gt;
  CARD16 sequenceNumber B16;   /* last sequence number                   */&lt;br /&gt;
  CARD32 length B32;           /* length of the reply                    */&lt;br /&gt;
&lt;br /&gt;
  /* now the actual content ... */&lt;br /&gt;
&lt;br /&gt;
  CARD16 data B16;             /* data                                   */&lt;br /&gt;
  CARD16 moredata B16;         /* some more data                         */&lt;br /&gt;
&lt;br /&gt;
  CARD32 pad2 B32;             /* padding just to have 32B               */&lt;br /&gt;
  CARD32 pad3 B32;&lt;br /&gt;
  CARD32 pad4 B32;&lt;br /&gt;
  CARD32 pad5 B32;&lt;br /&gt;
  CARD32 pad6 B32;&lt;br /&gt;
&lt;br /&gt;
} sample_data_reply;&lt;br /&gt;
#define sz_sample_data_reply 32&lt;br /&gt;
&lt;br /&gt;
An example structure for reply packet returning data in form of 2 CARD16 variables.&lt;br /&gt;
All reply packages must be at least 32 bytes.&lt;br /&gt;
You also have to define a macro for returning size of the structure as &#039;sz_&amp;lt;struct_name&amp;gt;&#039;.&lt;br /&gt;
Server will use this macro to check package sizes (using macro REQUEST_SIZE_MATCH).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every X extension has a Dispatch() function, which works as a request-handler. When X-server receives a request package, it will check the major opcode. If major opcode belongs to some extension it calls extension&#039;s Dispatch routine. Dispatch checks the minor opcode of request and returns a pointer to appropriate function to call or BadRequest in error situation. If protocol requires a reply packet, function will send a reply packet.&lt;br /&gt;
&lt;br /&gt;
===Function wrapping===&lt;br /&gt;
&lt;br /&gt;
When adding and modifying functionality of normal DDX functions, extension has to wrap those functions. This means that extension will replace existing function with it&#039;s own version containing needed new functionality. X server calls all DDX functions through a function pointer and wrapping means switching of these pointers. Different extensions can wrap same functions, and depending on the order of extension initialization, they wrap each others functions. This will create a function chain. Wrapper function can call down to this function chain (it is recommended way, so that other extensions can do their work as well &#039;&#039;unless&#039;&#039; you plan to replace larger part of the functionality but in this case you really have to know what you are doing).&lt;br /&gt;
&lt;br /&gt;
to be continued ... will contain more examples etc. (please send comments to [mailto:tapani.palli@nokia.com Tapani Palli] )&lt;/div&gt;</summary>
		<author><name>70.242.115.107</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=X11_Extension_tutorial&amp;diff=43539</id>
		<title>X11 Extension tutorial</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=X11_Extension_tutorial&amp;diff=43539"/>
		<updated>2008-06-11T15:45:58Z</updated>

		<summary type="html">&lt;p&gt;70.242.115.107: /* Function wrapping */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial briefly explains what is X11 extension and how to implement one. Extensibility is one of the requirements for a windowing system. X extension interface can be used to add new functionality to X server, it also requires additional functionality from the DDX (driver) itself.&lt;br /&gt;
&lt;br /&gt;
==Programming extensions==&lt;br /&gt;
&lt;br /&gt;
X extension code can be logically divided in 3 parts :&lt;br /&gt;
* protocol definition&lt;br /&gt;
* server side functional implementation&lt;br /&gt;
* library offering API for client programs&lt;br /&gt;
&lt;br /&gt;
(+ additions to driver code to use extension)&lt;br /&gt;
&lt;br /&gt;
===Extension file structure in Kdrive===&lt;br /&gt;
&lt;br /&gt;
Directory &#039;mi&#039; contains the machine-independent library which is a set of common DDX routines. Initialization of server extensions is made by &#039;InitExtensions()&#039; function found at &#039;xserver_root/mi/miinitext.c&#039;. This file has to be changed in order to initialize extension on server startup. Other files that have to be changed in order to build and link the extension with X server are &#039;xserver_root/Makefile.am&#039; and &#039;xserver_root/configure.ac&#039;.&lt;br /&gt;
&lt;br /&gt;
Extension itself should be located in a directory of it&#039;s own, for example &#039;xserver_root/sample&#039;. This directory should be added to &#039;xserver_root/Makefile.am&#039; SUBDIRS section. Figure below shows an example of extension directory structure. The client interface can be compiled anywhere else. Client interface is usually put in it&#039;s own directory under libs directory, which contains all other libraries X uses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;xlibs_root&amp;gt;&lt;br /&gt;
         |&lt;br /&gt;
         |_ Sampleext (protocol header)&lt;br /&gt;
         |&lt;br /&gt;
         |_ Xsample (client interface)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;xserver_root&amp;gt; (Makefile.am, configure.ac)&lt;br /&gt;
           |&lt;br /&gt;
           |_ mi (miinitext.c)&lt;br /&gt;
           |&lt;br /&gt;
           |_ sample (extension files)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Protocol===&lt;br /&gt;
&lt;br /&gt;
Protocol consists of requests, events, replies and error messages. These are sent between client and server. Example : client sends a request for server using the library provided by extension, extension-code on serverside processes this request and performs required action + sends a reply to client.&lt;br /&gt;
&lt;br /&gt;
The basic structure of request packet is predefined and every request must contain this 4-byte header information. After the header data, request can contain any amount of optional data limited only by the max packet size of the transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef struct _xReq {&lt;br /&gt;
  CARD8 reqType;            /* major opcode of request, allocated by server on extension initialization          */&lt;br /&gt;
  CARD8 data;               /* undefined, usually used as &#039;minor opcode&#039; by the extension to differiate requests */&lt;br /&gt;
  CARD16 length;            /* total length of request (including header) in 4 byte quantities                   */&lt;br /&gt;
  ...&lt;br /&gt;
} xReq;&lt;br /&gt;
&lt;br /&gt;
The structure skeleton of a request packet. All request structures must be multiple of 4 bytes long.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef struct _xRep {&lt;br /&gt;
  CARD8 type;                  /* X_Reply                                */&lt;br /&gt;
  CARD8 pad1;                  /* can be anything, used for padding here */&lt;br /&gt;
  CARD16 sequenceNumber B16;   /* last sequence number                   */&lt;br /&gt;
  CARD32 length B32;           /* length of the reply                    */&lt;br /&gt;
&lt;br /&gt;
  /* now the actual content ... */&lt;br /&gt;
&lt;br /&gt;
  CARD16 data B16;             /* data                                   */&lt;br /&gt;
  CARD16 moredata B16;         /* some more data                         */&lt;br /&gt;
&lt;br /&gt;
  CARD32 pad2 B32;             /* padding just to have 32B               */&lt;br /&gt;
  CARD32 pad3 B32;&lt;br /&gt;
  CARD32 pad4 B32;&lt;br /&gt;
  CARD32 pad5 B32;&lt;br /&gt;
  CARD32 pad6 B32;&lt;br /&gt;
&lt;br /&gt;
} sample_data_reply;&lt;br /&gt;
#define sz_sample_data_reply 32&lt;br /&gt;
&lt;br /&gt;
An example structure for reply packet returning data in form of 2 CARD16 variables.&lt;br /&gt;
All reply packages must be at least 32 bytes.&lt;br /&gt;
You also have to define a macro for returning size of the structure as &#039;sz_&amp;lt;struct_name&amp;gt;&#039;.&lt;br /&gt;
Server will use this macro to check package sizes (using macro REQUEST_SIZE_MATCH).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every X extension has a Dispatch() function, which works as a request-handler. When X-server receives a request package, it will check the major opcode. If major opcode belongs to some extension it calls extension&#039;s Dispatch routine. Dispatch checks the minor opcode of request and returns a pointer to appropriate function to call or BadRequest in error situation. If protocol requires a reply packet, function will send a reply packet.&lt;br /&gt;
&lt;br /&gt;
===Function wrapping===&lt;br /&gt;
&lt;br /&gt;
When adding and modifying functionality of normal DDX functions, extension has to wrap those functions. This means that extension will replace existing function with it&#039;s own version containing needed new functionality. X server calls all DDX functions through a function pointer and wrapping means switching of these pointers. Different extensions can wrap same functions, and depending on the order of extension initialization, they wrap each others functions. This will create a function chain. Wrapper function can call down to this function chain (it is recommended way, so that other extensions can do their work aswell unless you plan to replace larger part of the functionality but in this case you really have to know what you are doing).&lt;br /&gt;
&lt;br /&gt;
to be continued ... will contain more examples etc. (please send comments to [mailto:tapani.palli@nokia.com Tapani Palli] )&lt;/div&gt;</summary>
		<author><name>70.242.115.107</name></author>
	</entry>
	<entry>
		<id>https://maemo.octonezd.me/index.php?title=X11_Extension_tutorial&amp;diff=43540</id>
		<title>X11 Extension tutorial</title>
		<link rel="alternate" type="text/html" href="https://maemo.octonezd.me/index.php?title=X11_Extension_tutorial&amp;diff=43540"/>
		<updated>2008-06-11T15:44:52Z</updated>

		<summary type="html">&lt;p&gt;70.242.115.107: New page: This tutorial briefly explains what is X11 extension and how to implement one. Extensibility is one of the requirements for a windowing system. X extension interface can be used to add new...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This tutorial briefly explains what is X11 extension and how to implement one. Extensibility is one of the requirements for a windowing system. X extension interface can be used to add new functionality to X server, it also requires additional functionality from the DDX (driver) itself.&lt;br /&gt;
&lt;br /&gt;
==Programming extensions==&lt;br /&gt;
&lt;br /&gt;
X extension code can be logically divided in 3 parts :&lt;br /&gt;
* protocol definition&lt;br /&gt;
* server side functional implementation&lt;br /&gt;
* library offering API for client programs&lt;br /&gt;
&lt;br /&gt;
(+ additions to driver code to use extension)&lt;br /&gt;
&lt;br /&gt;
===Extension file structure in Kdrive===&lt;br /&gt;
&lt;br /&gt;
Directory &#039;mi&#039; contains the machine-independent library which is a set of common DDX routines. Initialization of server extensions is made by &#039;InitExtensions()&#039; function found at &#039;xserver_root/mi/miinitext.c&#039;. This file has to be changed in order to initialize extension on server startup. Other files that have to be changed in order to build and link the extension with X server are &#039;xserver_root/Makefile.am&#039; and &#039;xserver_root/configure.ac&#039;.&lt;br /&gt;
&lt;br /&gt;
Extension itself should be located in a directory of it&#039;s own, for example &#039;xserver_root/sample&#039;. This directory should be added to &#039;xserver_root/Makefile.am&#039; SUBDIRS section. Figure below shows an example of extension directory structure. The client interface can be compiled anywhere else. Client interface is usually put in it&#039;s own directory under libs directory, which contains all other libraries X uses.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;xlibs_root&amp;gt;&lt;br /&gt;
         |&lt;br /&gt;
         |_ Sampleext (protocol header)&lt;br /&gt;
         |&lt;br /&gt;
         |_ Xsample (client interface)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;xserver_root&amp;gt; (Makefile.am, configure.ac)&lt;br /&gt;
           |&lt;br /&gt;
           |_ mi (miinitext.c)&lt;br /&gt;
           |&lt;br /&gt;
           |_ sample (extension files)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Protocol===&lt;br /&gt;
&lt;br /&gt;
Protocol consists of requests, events, replies and error messages. These are sent between client and server. Example : client sends a request for server using the library provided by extension, extension-code on serverside processes this request and performs required action + sends a reply to client.&lt;br /&gt;
&lt;br /&gt;
The basic structure of request packet is predefined and every request must contain this 4-byte header information. After the header data, request can contain any amount of optional data limited only by the max packet size of the transport protocol.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef struct _xReq {&lt;br /&gt;
  CARD8 reqType;            /* major opcode of request, allocated by server on extension initialization          */&lt;br /&gt;
  CARD8 data;               /* undefined, usually used as &#039;minor opcode&#039; by the extension to differiate requests */&lt;br /&gt;
  CARD16 length;            /* total length of request (including header) in 4 byte quantities                   */&lt;br /&gt;
  ...&lt;br /&gt;
} xReq;&lt;br /&gt;
&lt;br /&gt;
The structure skeleton of a request packet. All request structures must be multiple of 4 bytes long.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
typedef struct _xRep {&lt;br /&gt;
  CARD8 type;                  /* X_Reply                                */&lt;br /&gt;
  CARD8 pad1;                  /* can be anything, used for padding here */&lt;br /&gt;
  CARD16 sequenceNumber B16;   /* last sequence number                   */&lt;br /&gt;
  CARD32 length B32;           /* length of the reply                    */&lt;br /&gt;
&lt;br /&gt;
  /* now the actual content ... */&lt;br /&gt;
&lt;br /&gt;
  CARD16 data B16;             /* data                                   */&lt;br /&gt;
  CARD16 moredata B16;         /* some more data                         */&lt;br /&gt;
&lt;br /&gt;
  CARD32 pad2 B32;             /* padding just to have 32B               */&lt;br /&gt;
  CARD32 pad3 B32;&lt;br /&gt;
  CARD32 pad4 B32;&lt;br /&gt;
  CARD32 pad5 B32;&lt;br /&gt;
  CARD32 pad6 B32;&lt;br /&gt;
&lt;br /&gt;
} sample_data_reply;&lt;br /&gt;
#define sz_sample_data_reply 32&lt;br /&gt;
&lt;br /&gt;
An example structure for reply packet returning data in form of 2 CARD16 variables.&lt;br /&gt;
All reply packages must be at least 32 bytes.&lt;br /&gt;
You also have to define a macro for returning size of the structure as &#039;sz_&amp;lt;struct_name&amp;gt;&#039;.&lt;br /&gt;
Server will use this macro to check package sizes (using macro REQUEST_SIZE_MATCH).&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every X extension has a Dispatch() function, which works as a request-handler. When X-server receives a request package, it will check the major opcode. If major opcode belongs to some extension it calls extension&#039;s Dispatch routine. Dispatch checks the minor opcode of request and returns a pointer to appropriate function to call or BadRequest in error situation. If protocol requires a reply packet, function will send a reply packet.&lt;br /&gt;
&lt;br /&gt;
===Function wrapping===&lt;br /&gt;
&lt;br /&gt;
When adding and modifying functionality of normal DDX functions, extension has to wrap those functions. This means that extension will replace existing function with it&#039;s own version containing needed new functionality. X server calls all DDX functions through a function pointer and wrapping means switching of these pointers. Different extensions can wrap same functions, and depending on the order of extension initialization, they wrap each others functions. This will create a function chain. Wrapper function can call down to this function chain (it is recommended way, so that other extensions can do their work aswell unless you plan to replace larger part of the functionality but in this case you really have to know what you are doing).&lt;br /&gt;
&lt;br /&gt;
to be continued ... will contain more examples etc. (please send comments to [mailto:tapani.palli@nokia.com] Tapani Palli)&lt;/div&gt;</summary>
		<author><name>70.242.115.107</name></author>
	</entry>
</feed>