Check-in [57b8caef0b]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Genode 24.08 support: Adapt to changes in Genode, up to (for now) hog "layer 6": * new drivers paths, "driver/" instead of "drivers/" ; * new drivers naming, "ahci_drv" is renamed to just "ahci" (and vesa_fb, pc_platform etc) ; * new Nitpicker/view API ; * new Point, Rect, Area APIs ; * new Grub2 package ; Clean-up: * refactor the interface-kit <-> Nitpicker glue code a fair bit, to decrease tech debt and also for the next reason ; * try to remain compatible with c++17 : only apply c++20 in places where this does not clash with the old STL ("algorithm" header, "queue" class, etc), in other cases we shuffle code around to separate and prevent clashes. That's cleaner anyway ; * (when will I update my old toolchain ??) ; -- TESTS -- * worked on layers up to "jam hog-demos.emu6", looking good so far except for 2 regressions (due to my old c++17 toolchain ? gotta try in Linux host instead) ; * regression with FillRect(BGradient&) ; * regression with DrawString() ;
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk | new-genode-rev
Files: files | file ages | folders
SHA1: 57b8caef0b02356fdf2c23f9dfdbd90a72ebc1e2
User & Date: user 2024-09-11 13:32:06
Context
2024-09-18
08:06
fix-up Genode 24.08 support: Canvas: fix painting regression: * we now need to specify the alpha channel/opacity value for Color's passed to shaded Polygon and to Text_painter, otherwise they seem to bet set to 0, i.e. no painting ; * that fixes FillRect( BGradient& ) used for painting window tabs etc ; * that fixes DrawString() ; * rule BinCommand was seemingly staging the posix.lib.so file *after* it was needed, should be fixed ; Genode adapt: complete up to level 9 build: * more removals of _drv suffix (usb, usb_hid, intel_fb, intel_gpu, pci_audio) ; * didn't adapt "wifi_drv" yet, waiting for the next package in Genode 24.10 ; * also adapt USE_DRV_MANAGER builds (jam composition, driver_manager C++ code) ; * also prepare next commit that will fix the build when done on a Linux host ; -- TESTS -- * ran the full TTS distro, using Debian-built dde_linux drivers, looking good ; * tested USB-HID, canvas, nic with Ftp+, vfs with AK) ; * GeDepot packages don't work any more though (ABI change), will upgrade to newer packages when Genode/Sculpt 24.10 ships ; check-in: 60385a1069 user: user tags: new-genode-rev, trunk
2024-09-11
13:32
Genode 24.08 support: Adapt to changes in Genode, up to (for now) hog "layer 6": * new drivers paths, "driver/" instead of "drivers/" ; * new drivers naming, "ahci_drv" is renamed to just "ahci" (and vesa_fb, pc_platform etc) ; * new Nitpicker/view API ; * new Point, Rect, Area APIs ; * new Grub2 package ; Clean-up: * refactor the interface-kit <-> Nitpicker glue code a fair bit, to decrease tech debt and also for the next reason ; * try to remain compatible with c++17 : only apply c++20 in places where this does not clash with the old STL ("algorithm" header, "queue" class, etc), in other cases we shuffle code around to separate and prevent clashes. That's cleaner anyway ; * (when will I update my old toolchain ??) ; -- TESTS -- * worked on layers up to "jam hog-demos.emu6", looking good so far except for 2 regressions (due to my old c++17 toolchain ? gotta try in Linux host instead) ; * regression with FillRect(BGradient&) ; * regression with DrawString() ; check-in: 57b8caef0b user: user tags: new-genode-rev, trunk
2024-09-03
16:52
-- Fix nano3d deployer, Add bubble-universe deployer, clean up (before upgrading to Genode 24.08) -- Fix/Improve GeDepot: * recently changed nano3d deployer to show off the new 'override config' feature ; * realized after testing it no longer works ; * we have to make sure the invoke gets routed to InitPilot (not DeployPilot), with the exe path (instead of the runtime path) ; * also added "bubble universe" package deployer (see the discourse forum for background) ; Prepare for Jam refactor of IPC: * create rule AddStackBeIpc ; * will use it later in the rest of the repo to refactor compositions that involve broker and registrar ; Various C++ and Jam clean-ups: * jam: add CheckExternalFile rule, for verifying that a given file outside of the repo (non tracked) is patched as we require ; * jam: refactor rules, clean-up, silence Gcc -Wno-missing-field-initializers in app/ and interface/ ; * fuse-ntfs: fix-up sizeof(Dirent), clean-up logging ; * PartitionSetupGPT: refactor terminateChild() ; -- TESTS -- * tested GeDepot install/deploy, looking good (nano3d works again, and no regression to be seen in fuse/FS) ; * bubble-universe downloads/launches quick and looks great, thanks Norman! ; check-in: ff34427237 user: user tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to genode-haiku/README.md.

129
130
131
132
133
134
135
136

137
138
139

140
141

142
143
144
145
146
147
148
129
130
131
132
133
134
135

136
137
138

139
140

141
142
143
144
145
146
147
148







-
+


-
+

-
+







Hnetserv: box with .n at south of Hnet  "net_server"  fill $red

# ----------------------

HOG:  text same with .w at 3*$margin east of 1st text.e  "Haiku on Genode"
GKern:  box "Nova Microkernel" fit wid 290%

Ghda:  box with .nw at sw of GKern  "pci_audio_drv" "(OpenBSD)" fill $blue
Ghda:  box with .nw at sw of GKern  "pci_audio" "(OpenBSD)" fill $blue
right
move 20%
Gahci:  box "ahci_drv" fill $blue
Gahci:  box "ahci" fill $blue
move 20%
Gvesa:  box "vesa_fb_drv" fill $blue
Gvesa:  box "vesa_fb" fill $blue
move 20%
Gnet:   box "TCP/IP: lxip" "(Linux)" fill $blue

down

       box with .n at south of Ghda  "mixer" "+ libav"  fill $blue

156
157
158
159
160
161
162
163

164
165
166
167
168
169
170
156
157
158
159
160
161
162

163
164
165
166
167
168
169
170







-
+








Gnp:    box with .n at south of Gvesa  "nitpicker"  fill $blue
box "libbe-HiG" "(Haiku, ttcoder)"  fill $misc thick
box "registrar"
box "Deskbar, Tracker"
box "AutoCast, MMD," "AK, L'ning, etc"

Gnetserv: box with .n at south of Gnet  "nic_drv"  fill $blue
Gnetserv: box with .n at south of Gnet  "nic"  fill $blue
box  "nic_router"  fill $blue
~~~

How to read that diagram:

- components that are 'foreign' to either project (originate neither from within Haiku nor Genode), have their origin noted in brackets, e.g. "(Linux)"
- colors denotate kernel-land vs. user-space: Haiku has a "sea of red" (dozens of components mixed together

Changes to genode-haiku/ge-drivers/vfs_fuse_ntfs_tts/world-src-lib-ntfs-3g/init.cc.

126
127
128
129
130
131
132
133

134
135
136
137
138
139
140
126
127
128
129
130
131
132

133
134
135
136
137
138
139
140







-
+







	(*ctx)->silent  = TRUE;  // silence the ntfs_mst_post_read_fixup_warn notices...
	(*ctx)->recover = TRUE;
#if 1  // HoG_GENODE
	(*ctx)->ro = configured_as_readwrite ? FALSE : TRUE;  // !
		/*
		READ-ONLY versus read/write flag:
		Careful to *only* enable read-write ("ro == FALSE") if the backing
		components provide access all the way down (vfs server, part_block, ahci_drv...).
		components provide access all the way down (vfs server, part_block, ahci(_drv)...).
		Otherwise NTFS will fail not only to write, but also to *read*, in some cases!
		Hence, if a partition is read-only for any reason then libntfs-3g must be made
		aware of that using that one flag above and not other schemes,
		otherwise libntfs will attempt to write stuff to disk even when asked to READ (!), e.g.
		readdir() might fail to read some directories in mysterious ways, with the below cryptic
		errors as the only hints as to what's going on:
			[init -> vfs_ntfs] ntfs_fuse_readdir () :1121: </hog_genode_AudioStation> -------------------------

Changes to genode-haiku/ge-services/repos-gems-src-apps/driver_manager/main.cc.

180
181
182
183
184
185
186
187

188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208


209
210
211

212
213
214
215
216
217
218


219
220
221

222
223
224
225
226
227

228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246

247
248
249
250
251
252
253
180
181
182
183
184
185
186

187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206


207
208
209
210

211
212
213
214
215
216


217
218
219
220

221
222
223
224
225
226

227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245

246
247
248
249
250
251
252
253







-
+



















-
-
+
+


-
+





-
-
+
+


-
+





-
+


















-
+









struct Driver_manager::Vesa_fb_driver : Device_driver
{
	void generate_start_node(Xml_generator &xml) const override
	{
		xml.node("start", [&] () {
			_gen_common_start_node_content(xml, "vesa_fb_drv", "vesa_fb_drv",
			_gen_common_start_node_content(xml, "vesa_fb", "vesa_fb",
#if 0
			                               Ram_quota{8*1024*1024}, Cap_quota{110},
#else
	/// VESA needs *more* than 110 caps on bare metal (e.g. on a T410) ; this might have escaped Genode's Q.A. as they probably test the native Intel FB driver, rather than Vesa FB
	// We also need to raise the RAM quota if using high resolutions like 1920px or even 2560px (as tested in qemu)
			                               Ram_quota{16*1024*1024}, Cap_quota{150},
#endif
			                               Priority{-1}, Version{0});
			xml.node("route", [&] () {
				_gen_config_route(xml, "fb_drv.config");
				_gen_default_parent_route(xml);
			});
		});
	}
};

/*
Those generate e.g.:

			<start name="vesa_fb_drv" caps="200">
				<binary name="vesa_fb_drv"/>
			<start name="vesa_fb" caps="200">
				<binary name="vesa_fb"/>
				<resource name="RAM" quantum="9M"/>
				<route>
					<service name="Platform"> <child name="platform_drv"/> </service>
					<service name="Platform"> <child name="platform"/> </service>
					<service name="ROM" label="config">
						<parent label="vesa.config"/>   </service>
					<any-service> <parent/> <any-child /> </any-service>
				</route>
			</start>
			<start name="intel_fb_drv" caps="1000">
				<binary name="pc_intel_fb_drv"/>
			<start name="intel_fb" caps="1000">
				<binary name="pc_intel_fb"/>
				<resource name="RAM" quantum="90M"/>
				<route>
					<service name="Platform"> <child name="intel_gpu_drv"/> </service>
					<service name="Platform"> <child name="intel_gpu"/> </service>
					<service name="ROM" label="config"> <parent label="fb_drv.config"/> </service>
					<service name="Report"> <child name="report_rom"/> </service>
					<any-service> <parent/> <any-child /> </any-service>
				</route>
			</start>
			<start name="intel_gpu_drv" caps="2000">
			<start name="intel_gpu" caps="2000">
				<resource name="RAM" quantum="90M"/>
				<provides>
					<service name="Gpu"/>
					<service name="Platform"/>
				</provides>
				<config max_framebuffer_memory="64M">
					<device vendor="0x8086" device="0x1606" generation="8" platform="broadwell" description="HD Graphics (BDW GT1 ULT)"/>
					<device vendor="0x8086" device="0x1616" generation="8" platform="broadwell" description="HD Graphics 5500 (BDW GT2 ULT)"/>
					<device vendor="0x8086" device="0x1622" generation="8" platform="broadwell" description="Iris Pro Graphics 6200 (BDW GT3e)"/>
					<device vendor="0x8086" device="0x1916" generation="9" platform="skylake"  description="HD Graphics 520 (Skylake, Gen9)"/>
					<device vendor="0x8086" device="0x191b" generation="9" platform="skylake"  description="HD Graphics 530 (Skylake, Gen9)"/>
					<device vendor="0x8086" device="0x5916" generation="9" platform="kabylake" description="HD Graphics 620 (Kaby Lake, Gen9p5)"/>
					<device vendor="0x8086" device="0x5917" generation="9" platform="kabylake" description="UHD Graphics 620 (Kaby Lake, Gen9p5)"/>
					<device vendor="0x8086" device="0x591b" generation="9" platform="kabylake" description="HD Graphics 630 (Kaby Lake, Gen9p5)"/>
					<device vendor="0x8086" device="0x3ea0" generation="9" platform="whiskeylake" description="UHD Graphics 620 (Whiskey Lake, Gen9p5)"/>
					<device vendor="0x8086" device="0x9a49" generation="12" platform="tigerlake" description="Iris Xe Graphics (Tiger Lake, Xe)"/>
				</config>
				<route>
					<service name="Platform"> <child name="platform_drv"/>    </service>
					<service name="Platform"> <child name="platform"/>    </service>
					<any-service> <parent /> <any-child/> </any-service>
				</route>
			</start>
*/



279
280
281
282
283
284
285
286

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303

304
305
306
307

308
309
310
311
312
313
314
279
280
281
282
283
284
285

286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302

303
304
305
306

307
308
309
310
311
312
313
314







-
+
















-
+



-
+







	};

	Boot_fb_driver(Mode const mode) : _ram_quota(Ram_quota{mode.num_bytes()}) { }

	void generate_start_node(Xml_generator &xml) const override
	{
		xml.node("start", [&] () {
			_gen_common_start_node_content(xml, "boot_fb_drv", "boot_fb_drv",
			_gen_common_start_node_content(xml, "boot_fb", "boot_fb",
			                               _ram_quota, Cap_quota{100},
			                               Priority{-1}, Version{0});
			xml.node("route", [&] () {
				_gen_config_route(xml, "fb_drv.config");
				_gen_default_parent_route(xml);
			});
		});
	}
};


struct Driver_manager::Ahci_driver : Device_driver
{
	void generate_start_node(Xml_generator &xml) const override
	{
		xml.node("start", [&] () {
			_gen_common_start_node_content(xml, "ahci_drv", "ahci_drv",
			_gen_common_start_node_content(xml, "ahci", "ahci",
#if 0
			                               Ram_quota{10*1024*1024}, Cap_quota{100},
#else
	/// ahci_drv runs out of caps on bare metal (e.g. T410) if provided with only 100 caps
	/// ahci(_drv) runs out of caps on bare metal (e.g. T410) if provided with only 100 caps
			                               Ram_quota{10*1024*1024}, Cap_quota{150},
#endif
			                               Priority{-1}, Version{0});
			_gen_provides_node<Block::Session>(xml);
			xml.node("config", [&] () {
				xml.node("report", [&] () { xml.attribute("ports", "yes"); });
				for (unsigned i = 0; i < 6; i++) {
335
336
337
338
339
340
341
342

343
344
345
346
347
348
349
350

351
352
353
354
355
356
357
358
359
360
361
362
363
364

365
366
367
368
369
370
371
335
336
337
338
339
340
341

342
343
344
345
346
347
348
349

350
351
352
353
354
355
356
357
358
359
360
361
362
363

364
365
366
367
368
369
370
371







-
+







-
+













-
+







	void gen_service_forwarding_policy(Xml_generator &xml,
	                                   Default_label const &default_label) const
	{
		for (unsigned i = 0; i < 6; i++) {
			xml.node("policy", [&] () {
				xml.attribute("label_suffix", String<64>("ahci-", i));
				xml.node("child", [&] () {
					xml.attribute("name", "ahci_drv"); });
					xml.attribute("name", "ahci"); });
			});
		}

		if (default_label.valid()) {
			xml.node("policy", [&] () {
				xml.attribute("label_suffix", " default");
				xml.node("child", [&] () {
					xml.attribute("name", "ahci_drv");
					xml.attribute("name", "ahci");
					xml.attribute("label", default_label);
				});
			});
		}
	}
};


struct Driver_manager::Nvme_driver : Device_driver
{
	void generate_start_node(Xml_generator &xml) const override
	{
		xml.node("start", [&] () {
			_gen_common_start_node_content(xml, "nvme_drv", "nvme_drv",
			_gen_common_start_node_content(xml, "nvme", "nvme",
			                               Ram_quota{8*1024*1024}, Cap_quota{100},
			                               Priority{-1}, Version{0});
			_gen_provides_node<Block::Session>(xml);
			xml.node("config", [&] () {
				xml.node("report", [&] () { xml.attribute("namespaces", "yes"); });
				xml.node("policy", [&] () {
					xml.attribute("label_suffix", String<64>("nvme-0"));
387
388
389
390
391
392
393
394

395
396
397
398
399
400
401

402
403
404
405
406
407
408
387
388
389
390
391
392
393

394
395
396
397
398
399
400

401
402
403
404
405
406
407
408







-
+






-
+








	void gen_service_forwarding_policy(Xml_generator &xml,
	                                   Default_label const &default_label) const
	{
		xml.node("policy", [&] () {
			xml.attribute("label_suffix", String<64>("nvme-0"));
			xml.node("child", [&] () {
				xml.attribute("name", "nvme_drv"); });
				xml.attribute("name", "nvme"); });
		});

		if (default_label.valid()) {
			xml.node("policy", [&] () {
				xml.attribute("label_suffix", " default");
				xml.node("child", [&] () {
					xml.attribute("name", "nvme_drv");
					xml.attribute("name", "nvme");
					xml.attribute("label", default_label);
				});
			});
		}
	}
};

Changes to genode-haiku/hai-src/apps/deskbar/_GeJamfile.inc.

28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
28
29
30
31
32
33
34

35
36
37
38
39
40
41
42







-
+







	AddInteractiveComponents  hog-deskbar.run ;
}

# Deskbar runs at "emu8" level (with a whole haiku.lib.so, which thus needs media libs)
AddAudioComponents hog-deskbar.run ;


AddComponentService	hog-deskbar.run : 1M : rtc_drv : Rtc ;
AddComponentService	hog-deskbar.run : 1M : pc_rtc : Rtc ;
AddComponentClient	hog-deskbar.run : 5M : acpica :
	"
\	<config ld_verbose=\"yes\"  sleep=\"yes\" reset=\"no\" poweroff=\"yes\"
		report=\"yes\" acpi_ready=\"no\" act_as_acpi_drv=\"no\" />
\	<route>
\			<!-- Note re. this setting: if not done/correctly, the resulting failure will be silent, i.e. Acpica will not log/warn about its failure to listen to ROM changes -->
\		<service name=\"ROM\" label=\"system\"> <child name=\"platform_report_rom\"/> </service>
87
88
89
90
91
92
93
94

95
96

97
98
99
100
101
102
103
87
88
89
90
91
92
93

94
95

96
97
98
99
100
101
102
103







-
+

-
+







	AddComponentAsStart  hog-deskbar.run : 128M : init :
			" name=\"drivers_init\" caps=\"1300\" priority=\"-2\" " :
		"		<binary name=\"init\"/>
		\		<route>
		\			<service name=\"ROM\" label=\"config\">
		\				<child name=\"dynamic_rom\"/>
		\			</service>
		\			<service name=\"ROM\" label=\"system\"> <child name=\"platform_report_rom\" label=\"ps2_drv\"/> </service>
		\			<service name=\"ROM\" label=\"system\"> <child name=\"platform_report_rom\" label=\"ps2\"/> </service>  <!-- was: ps2_drv -->
		\			<service name=\"Event\"> <child name=\"event_filter\" label=\"ps2\"/> </service>
		\			<service name=\"Platform\" label=\"ps2_drv\"> <child name=\"platform_drv\" label=\"ps2_drv\"/> </service>
		\			<service name=\"Platform\" label=\"ps2\"> <child name=\"platform_drv\" label=\"ps2\"/> </service>  <!-- was: ps2_drv -->
		\			<any-service> <parent/> <any-child/> </any-service>
		\		</route>
		\		<default-route>
		\			<any-service> <parent/> <any-child/> </any-service>
		\		</default-route>
			"
			;
122
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137
138
139

140
141
142
143
144
145
146
147
148
149

150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167


168
169
170
171
172
173
174
122
123
124
125
126
127
128

129
130
131
132
133
134
135
136
137
138

139
140
141
142
143
144
145
146
147
148

149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165


166
167
168
169
170
171
172
173
174







-
+









-
+









-
+
















-
-
+
+







	\			<service name=\"Report\"/>
	\			<service name=\"Timer\"/>
	\			<service name=\"Capture\"/>
	\			<service name=\"IO_MEM\"/>
	\			<service name=\"IO_PORT\"/>
	\			<service name=\"Event\"/>
	\		</parent-provides>
	\			<start name=\"vesa_fb_drv\" caps=\"1000\">
	\			<start name=\"vesa_fb\" caps=\"1000\">
	\				<resource name=\"RAM\" quantum=\"60M\"/>
	\				<config ld_verbose=\"yes\" width=\"1024\" height=\"768\">
	\					<report connectors=\"yes\"/>
	\				</config>
	\				<route>
						# for PD etc
	\					<any-service> <parent/> <any-child/> </any-service>
	\				</route>
	\			</start>
	\			<start name=\"ps2_drv\" caps=\"100\">
	\			<start name=\"ps2\" caps=\"100\">
	\				<resource name=\"RAM\" quantum=\"3M\"/>
	\				<config system=\"yes\"
	\					verbose_keyboard=\"no\"
	\					verbose_mouse=\"no\"
	\					verbose_scancodes=\"no\"
	\					/>
	\				<route>
	\					<service name=\"Event\"> <parent label=\"ps2\"/> </service>
						<service name=\"ROM\" label=\"system\"> <parent label=\"system\"/> </service>
	\					<service name=\"Platform\"> <parent label=\"ps2_drv\"/> </service>
	\					<service name=\"Platform\"> <parent label=\"ps2\"/> </service>
	\					<any-service> <parent/> <any-child/> </any-service>
	\				</route>
	\			</start>
	\		</config>
		\				</inline>
		
#		\				<sleep milliseconds=\"25000\" />
#		\				<inline description=\"iteration : last\">
#		\					<config/>
#		\				</inline>
#		\				<sleep milliseconds=\"5000\" />
\				<sleep milliseconds=\"50000\" />
		\			</rom>
		\		</config>
		"
		;
	AddRawComponent      hog-deskbar.run : vesa_fb_drv : vesa_fb_drv ;
	AddRawComponent      hog-deskbar.run : ps2_drv : ps2_drv ;
	AddBootModule  hog-deskbar.run : vesa_fb ;
	AddBootModule  hog-deskbar.run : ps2 ;
}


if $(Deskbar_FULL_TEST) || $(BUILD_DISTRO)
{
	AddRawComponent  hog-deskbar.run : top		: top ;
	AddRawComponent  hog-deskbar.run : nano3d	: nano3d ;

Changes to genode-haiku/hai-src/servers/registrar/_Ge_InitPilot.cpp.

267
268
269
270
271
272
273
274

275
276
277
278
279
280
281
267
268
269
270
271
272
273

274
275
276
277
278
279
280
281







-
+







	{
		// Genode apps (nano3d etc) should route "Gui" to WM:
		// re-label Gui (to use MOTIF window manager Gui instead of raw nitpicker Gui)
		s
		<< "		<route>\n"
		<< "			<service name=\"Gui\"> <parent label=\"ge_wm_gui\"/> </service>\n"  // dynit parent knows how to route "ge_wm_gui"
			;
		///hack: support PartitionsSetupGPT's use of mkntfs (it should look for Blocks in part_block, not call up to ahci_drv):
		///hack: support PartitionsSetupGPT's use of mkntfs (it should look for Blocks in part_block, not call up to driver/ahci(_drv)):
		if( stripped_arg_zero.EndsWith("/mkntfs") )
		{
			s << "			<any-service> <child name=\"dyn/part_block\"/> <parent/> </any-service>\n" ;
		}
		else
		{
			s << "			<any-service> <parent/> </any-service>\n" ;

Changes to genode-haiku/haiku-on-genode/kits/app/Application.cpp.

35
36
37
38
39
40
41
42

43
44
45
46
47
48
49
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49







-
+







#include <Roster.h>
#include <Window.h>

#include <AppMisc.h>
#if 0  // HoG_GENODE
#include <AppServerLink.h>
#else
#	define IS_BROKER_AWARE_TEAM(team) (team != 0)  //xx should move that macro definition to RemoteBroker.h ...
#	define IS_BROKER_AWARE_TEAM(team) (team != 0)  ///ToDo: should move that macro definition to RemoteBroker.h ...
#endif  // ~HoG_GENODE
#include <AutoLocker.h>
#if 0  // HoG_GENODE
#include <BitmapPrivate.h>
#include <DraggerPrivate.h>
#endif  // ~HoG_GENODE
#include <LaunchDaemonDefs.h>
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
299
300
301
302
303
304
305




































































306
307
308
309
310
311
312







-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







}

MouseAndKeyboard & BApplication::MouseKbd()
{
	return inputDevicesState;
}


/************
* FontStash has to be in global be_apps, so that class BFont may remain a fly-weight
* object that just refers to (rather than copy) the actual font data
*/

static Text_painter::Font * defFont = NULL;

#if 1
// Statically linked data:
//extern char _binary_droidsansb10_tff_start[];
extern char _binary_default_tff_start[];

///ToDo: make these *members* ; then make stash inherit BLock, and protect everything with BAutoLock( stash )
static Tff_font::Static_glyph_buffer<4096> _glyph_buffer { };
static Tff_font _font_trivial { _binary_default_tff_start, _glyph_buffer };

#else

#include <base/attached_rom_dataspace.h>
#include <base/heap.h>
#include <gems/ttf_font.h>
///ToDo: optimization: use the font glyph (gems/cached_font.h ?), drawing TTF fonts is slower than TFF
#endif


FontStash::FontStash()
{
#if 1
	defFont = &_font_trivial;

#else

	Genode::Env &
		HogEnv();
	static Genode::Attached_rom_dataspace _vera_ttf_ds { HogEnv(), "Vera.ttf" };
	static Genode::Heap _heap { HogEnv().ram(), HogEnv().rm() };
	static Ttf_font _font_TrueType {
		_heap,
		_vera_ttf_ds.local_addr<void>(),
		13
		};
	
	defFont = &_font_TrueType;
#endif
}

/*
FontStash::FontStash( const FontStash & peer )
{
	//+ init from <peer>..
}
*/

const Text_painter::Font &
	FontStash::Font( int font_id ) const
{
	return *defFont;
}
/*
float FontStash::FontHeight( int font_id ) const
{
	///+++ use this method in Canvas et al?
	
	return defFont->height();
}
*/



/************
* MouseAndKeyboard has to be in global be_app, as Genode does not broadcast mouse
* pointer coords and key-downs to all windows of the app, but only to the "focused"
* window, which breaks some (admittedly cheesy) Haiku code that relies on that.
*/

Changes to genode-haiku/haiku-on-genode/kits/app/Application.h.

15
16
17
18
19
20
21
22
23
24
25


26
27
28
29
30
31
32
15
16
17
18
19
20
21




22
23
24
25
26
27
28
29
30







-
-
-
-
+
+









#if defined( HoG_GENODE )

// libbe.so
#include <support/Locker.h>  // member

// base
//#include <base/component.h>  // Env..
// genode/base.lib.a extras..
#include <nitpicker_gfx/tff_font.h>
// genode/base.lib.a
#include <base/mutex.h>  // member

namespace Genode {
	class Env;
}
namespace hog {
//+	class FontStash;
//+	class MouseAndKeyboard;
50
51
52
53
54
55
56



57
58
59
60


61
62
63
64
65
66
67

68
69
70
71
72
73
74
48
49
50
51
52
53
54
55
56
57
58
59
60

61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77







+
+
+



-
+
+







+







		VideoMode( const VideoMode & peer );
		VideoMode & operator=( const VideoMode & );
};
*/

class FontStash
{
public: ///
		struct opaque_painter;  // hide the 'Text_painter::Font' implementation, from the (many) users of the Application.h header

public:
		FontStash();
		
		const Text_painter::Font & Font( int font_id ) const;
//		const Text_painter::Font & Font( int font_id ) const;
		opaque_painter  Font( int font_id ) const;
			///ToDo-2: CanvasWindow ought to retrieve a copy once at creation, so that all further calls to canvas.DrawString() work without locking or speed or concurrency issues
		float FontHeight( int font_id ) const;

private:  // Disabled
		FontStash( const FontStash & peer );
		FontStash & operator=( const FontStash & );
};


class MouseAndKeyboard
{
	// Written by <inputBridger>, read by BView.GetMouse()
	
public:

Changes to genode-haiku/haiku-on-genode/kits/app/Cursor.cpp.

15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29







-
+







			to see a nice shadowes one, we will need to extend this one.
 */

#include <AppDefs.h>
#include <Cursor.h>

#ifdef HoG_GENODE
#	warning . . . missing BCursor support
///later: missing BCursor support
#else
#include <AppServerLink.h>
#include <ServerProtocol.h>
#endif


const BCursor *B_CURSOR_SYSTEM_DEFAULT;
50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
50
51
52
53
54
55
56

57
58
59
60
61
62
63
64







-
+







		|| data[0] != 16	// size
		|| data[1] != 1		// depth
		|| data[2] >= 16 || data[3] >= 16)	// hot-spot
		return;

	// Send data directly to server
#ifdef HoG_GENODE
	//TODO
	///later
#else
	BPrivate::AppServerLink link;
	link.StartMessage(AS_CREATE_CURSOR);
	link.Attach(cursorData, 68);

	status_t status;
	if (link.FlushWithReply(status) == B_OK && status == B_OK) {
122
123
124
125
126
127
128
129

130
131
132
133
134
135
136
122
123
124
125
126
127
128

129
130
131
132
133
134
135
136







-
+







	if (&other != this && other != *this) {
		_FreeCursorData();

		fServerToken = other.fServerToken;
		fNeedToFree = other.fNeedToFree;

#ifdef HoG_GENODE
		//TODO
		///later
#else
		if (fNeedToFree) {
			// Tell app_server that there is another reference for this
			// cursor data!
			BPrivate::AppServerLink link;
			link.StartMessage(AS_REFERENCE_CURSOR);
			link.Attach<int32>(fServerToken);
168
169
170
171
172
173
174
175

176
177
178
179
180
181
182
183
184
185
186
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182
183
184
185
186







-
+











void BCursor::_ReservedCursor4() {}


void
BCursor::_FreeCursorData()
{
#ifdef HoG_GENODE
	//TODO
	///later
#else
	// Notify server to deallocate server-side objects for this cursor
	if (fNeedToFree) {
		BPrivate::AppServerLink link;
		link.StartMessage(AS_DELETE_CURSOR);
		link.Attach<int32>(fServerToken);
		link.Flush();
	}
#endif
}

Changes to genode-haiku/haiku-on-genode/kits/app/Jamfile.

10
11
12
13
14
15
16


17
18
19
20
21
22
23
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+
+







	-Wno-missing-field-initializers
	;


if $(LayerLevel) >= 5
{
	HaikuKit app_kit.a :
		_GeFontStash.cpp
		
		AppDefs.cpp
		Application.cpp
#	##
#	#	AppMisc.cpp
#	##	AppServerLink.cpp
		Cursor.cpp
		Clipboard.cpp
58
59
60
61
62
63
64




65
66
67
68
69
70
71
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77







+
+
+
+







	#
	#	# KeyStore implementation
	##	Key.cpp
	##	KeyStore.cpp
		;
}


#///later: get rid of this hack once I upgrade my GCC toolchain
ObjectC++Flags _GeFontStash.cpp : "-std=gnu++20" ;


# Roster.cpp is compiled differently below/above level 7:
# (i.e. there are *two* .o object files, that spares us having to call rule "Always Roster.o", which would slow down builds and be hackish)
#
if $(LayerLevel) >= 7
{
	HaikuKit app_kit.a :

Added genode-haiku/haiku-on-genode/kits/app/_GeFontStash.cpp.























































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
 * Copyright 2024, ttcoder
 * All rights reserved. Distributed under the terms of the MIT license.
 */


// genode/base.lib.a
#include <nitpicker_gfx/tff_font.h>

// this
#include "_GeFontStash.h"



/************
* FontStash has to be in global be_apps, so that class BFont may remain a fly-weight
* object that just refers to (rather than copy) the actual font data
*/

static Text_painter::Font * defFont = NULL;

#if 1
// Statically linked data:
//extern char _binary_droidsansb10_tff_start[];
extern char _binary_default_tff_start[];

///ToDo: make these *members* ; then make stash inherit BLock, and protect everything with BAutoLock( stash )
static Tff_font::Static_glyph_buffer<4096> _glyph_buffer { };
static Tff_font _font_trivial { _binary_default_tff_start, _glyph_buffer };

#else

#include <base/attached_rom_dataspace.h>
#include <base/heap.h>
#include <gems/ttf_font.h>
///ToDo: optimization: use the font glyph (gems/cached_font.h ?), drawing TTF fonts is slower than TFF
#endif


FontStash::FontStash()
{
#if 1
	defFont = &_font_trivial;

#else

	Genode::Env &
		HogEnv();
	static Genode::Attached_rom_dataspace _vera_ttf_ds { HogEnv(), "Vera.ttf" };
	static Genode::Heap _heap { HogEnv().ram(), HogEnv().rm() };
	static Ttf_font _font_TrueType {
		_heap,
		_vera_ttf_ds.local_addr<void>(),
		13
		};
	
	defFont = &_font_TrueType;
#endif
}

/*
FontStash::FontStash( const FontStash & peer )
{
	//+ init from <peer>..
}
*/


FontStash::opaque_painter  FontStash::Font( int font_id ) const
//const struct FontStash::opaque_painter &
//const Text_painter::Font &
//	FontStash::Font( int font_id ) const
{
//	return *defFont;
	return opaque_painter { defFont };
}
/*
float FontStash::FontHeight( int font_id ) const
{
	///+++ use this method in Canvas et al?
	
	return defFont->height();
}
*/


Added genode-haiku/haiku-on-genode/kits/app/_GeFontStash.h.






















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
 * Copyright 2024, ttcoder
 * All rights reserved. Distributed under the terms of the MIT license.
 */
#ifndef _GeFontStash_H
#define _GeFontStash_H



#include <Application.h>  // opaque_painter


// by contrast to Application.h, *this* header is include'd
// less often, so here we can define the opaque type:
struct FontStash::opaque_painter
{
	Text_painter::Font * tpainterFont;
};


#endif // _GeFontStash_H

Changes to genode-haiku/haiku-on-genode/kits/interface/Font.cpp.

15
16
17
18
19
20
21


22
23
24
25
26
27
28
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30







+
+







// preprocessor note : due to the complexity of this file, instead of "ifndef HoG.." we use "if 0" down here
#endif

#if 0  // HoG_GENODE
#include <AppServerLink.h>
#else
#	include <app/Application.h>  // FontStash
#	include <nitpicker_gfx/tff_font.h>  ///later: in fact we should maintain a "firewall" between Be and Ge code, this include and dep code should go to _GeFontStash.cpp, with a "shim" to forward calls
#	include <_GeFontStash.h>
#endif
#include <FontPrivate.h>
#include <ObjectList.h>
#if 0  // HoG_GENODE
#include <ServerProtocol.h>
#else
#	include <support/String.h>
390
391
392
393
394
395
396
397

398
399
400
401
402
403
404
392
393
394
395
396
397
398

399
400
401
402
403
404
405
406







-
+







		font->fExtraFlags = kUninitializedExtraFlags;
	}

#else  // HoG_GENODE

	const int id_for_main_font = 0;//
	const Text_painter::Font & font =
		be_app->GenoFonts().Font( id_for_main_font )
		*be_app->GenoFonts().Font( id_for_main_font ).tpainterFont
		;
	// set size of global fonts:
	sPlainFont.SetSize( font.height() );
	
///ToDo: BFont: currently, all fonts are "plain", even be_bold_font
	sBoldFont  = sPlainFont;
	sFixedFont = sPlainFont;
1131
1132
1133
1134
1135
1136
1137
1138

1139
1140
1141
1142
1143
1144
1145
1133
1134
1135
1136
1137
1138
1139

1140
1141
1142
1143
1144
1145
1146
1147







-
+







		return;

	link.Read(widthArray, sizeof(float) * numStrings);

#else  // HoG_GENODE

	const Text_painter::Font & font =
		be_app->GenoFonts().Font( fFamilyID );
		*be_app->GenoFonts().Font( fFamilyID ).tpainterFont;
	
	for( int i = 0; i < numStrings; i++ )
	{
		widthArray[i] = font
			.string_width( stringArray[i], lengthArray[i] ).decimal();
	}
#endif  // HoG_GENODE
1193
1194
1195
1196
1197
1198
1199
1200

1201
1202
1203
1204
1205
1206
1207
1195
1196
1197
1198
1199
1200
1201

1202
1203
1204
1205
1206
1207
1208
1209







-
+







	//
	// (hog) It seems "escapements" 1) relate to the width of characters
	// and 2) are measured in fraction of font size (i.e. "font units").
	// I.e. character_width is equal to "char_escapement * font_size"
	// (and thus char_escapement = char_width/font_size)
	
	const Text_painter::Font & font =
		be_app->GenoFonts().Font( fFamilyID )
		*be_app->GenoFonts().Font( fFamilyID ).tpainterFont
		;
	for( int i = 0; i < numChars; i++ )
	{
		escapementArray[i] =
			font.string_width( charArray+i, 1/**/ ).decimal()
			/
			fSize
1321
1322
1323
1324
1325
1326
1327
1328

1329
1330
1331
1332
1333
1334
1335
1323
1324
1325
1326
1327
1328
1329

1330
1331
1332
1333
1334
1335
1336
1337







-
+







	}

#else  // HoG_GENODE

	if (fHeight.ascent == kUninitializedAscent)
	{
		const Text_painter::Font & font =
			be_app->GenoFonts().Font( fFamilyID );
			*be_app->GenoFonts().Font( fFamilyID ).tpainterFont;
		
		// could also use Genode's struct Vertical_metrics, though this seems to work well:
		fHeight.ascent = font.baseline();
		fHeight.descent = font.height() - font.baseline();
		fHeight.leading = 1.;
	}
#endif  // HoG_GENODE
1446
1447
1448
1449
1450
1451
1452
1453

1454
1455
1456
1457
1458
1459
1460
1448
1449
1450
1451
1452
1453
1454

1455
1456
1457
1458
1459
1460
1461
1462







-
+







		return;

	link.Read(boundingBoxArray, sizeof(BRect) * numStrings);

#else

	const Text_painter::Font & font =
		be_app->GenoFonts().Font( fFamilyID );
		*be_app->GenoFonts().Font( fFamilyID ).tpainterFont;
	for( int i = 0; i < numStrings; i++ )
	{
		///later: this should be good enough for Deskbar, but are there other users of this method?
		boundingBoxArray[ i ] = BRect(
			0.,
			0.,//xx
			0.,

Changes to genode-haiku/haiku-on-genode/kits/interface/InterfaceDefs.cpp.

34
35
36
37
38
39
40


41
42
43
44
45
46
47
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49







+
+







#include <String.h>
#include <TextView.h>
#include <Window.h>

#ifndef HoG_GENODE
#include <ApplicationPrivate.h>
#include <AppServerLink.h>
#else
#	include <app/Application.h>  // be_app
#endif
#include <ColorConversion.h>
#ifndef HoG_GENODE
#include <DecorInfo.h>
#endif
#include <DefaultColors.h>
#ifndef HoG_GENODE

Changes to genode-haiku/haiku-on-genode/kits/interface/Jamfile.

86
87
88
89
90
91
92








93
94
95
96
97
98
99
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107







+
+
+
+
+
+
+
+







		InlineInput.cpp
		LineBuffer.cpp
		StyleBuffer.cpp
		TextGapBuffer.cpp
		UndoBuffer.cpp
		WidthBuffer.cpp
		;
	
	#///later: get rid of gnu++20 hacks once I update my GCC toolchain:
	ObjectC++Flags _CanvasGenode.cpp	: "-std=gnu++20" ;
	ObjectC++Flags _GeInput.cpp			: "-std=gnu++20" ;
	ObjectC++Flags _WindowNitpickerPriv.cpp : "-std=gnu++20" ;
	ObjectC++Flags Screen.cpp			: "-std=gnu++20" ;
	ObjectC++Flags Font.cpp				: "-std=gnu++20" ;
	ObjectC++Flags View.cpp				: "-std=gnu++20" ;
}

if $(LayerLevel) >= 6
{
	# BAlert is required by demos/Clock, which in turn requires BButton & layout:
	HaikuKit interface_kit.a :
		AbstractLayout.cpp

Changes to genode-haiku/haiku-on-genode/kits/interface/Screen.cpp.

15
16
17
18
19
20
21

22

23
24
25
26
27
28
29
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31







+

+







#ifndef HoG_GENODE
#include <PrivateScreen.h>


using namespace BPrivate;

#else  // HoG:
	///later: move the Genode-specific code to a _GeScreen.cpp file
#	include <gui_session/connection.h>
#	include <app/Application.h>  // be_app
#endif  // ~HoG


BScreen::BScreen(screen_id id)
{
#ifndef HoG_GENODE
	fScreen = BPrivateScreen::Get(id.id);
103
104
105
106
107
108
109
110
111


112
113
114
115
116
117
118
105
106
107
108
109
110
111


112
113
114
115
116
117
118
119
120







-
-
+
+







	// attaches itself to nitpicker, informing Nitpicker of the actual 1280x768 etc resolution.
	
	///later: OPTIM ? E.g. this is used in TBarView::MouseMoved() (!), so maybe cache the rect in a 'static' during a few ms (not initially, only after getting a non 0x0 value)
	
	// transient NP connection
	Gui::Connection nitpicker( be_app->Env() );
	BSize size(
			nitpicker.mode().area.w(),
			nitpicker.mode().area.h()
			nitpicker.mode().area.w,
			nitpicker.mode().area.h
		);
	if( size.width < 640 ) size.width  = 640;
	if( size.height< 480 ) size.height = 480;
	
	return BRect(
		0.,
		0.,

Changes to genode-haiku/haiku-on-genode/kits/interface/View.cpp.

10
11
12
13
14
15
16

17

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33



34
35
36
37
38
39
40
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45







+

+
















+
+
+







 *		Julian Harnath, julian.harnath@rwth-aachen.de
 *		Joseph Groover, looncraz@looncraz.net
 */


#include <View.h>

#ifndef HoG_GENODE
#include <algorithm>
#endif
#include <new>

#include <math.h>
#include <stdio.h>

#include <Application.h>
#include <Bitmap.h>
#include <Button.h>
#include <Cursor.h>
#include <File.h>
#include <GradientLinear.h>
#include <GradientRadial.h>
#ifndef HoG_GENODE
#include <GradientRadialFocus.h>
#include <GradientDiamond.h>
#include <GradientConic.h>
#else
#	include "_CanvasGenode.h"
#	include "_WindowNitpickerPriv.h"
#endif  // ~HoG_GENODE
#include <InterfaceDefs.h>
#include <Layout.h>
#include <LayoutContext.h>
#include <LayoutUtils.h>
#include <MenuBar.h>
#include <Message.h>
53
54
55
56
57
58
59

60
61
62
63
64
65
66
67
68
69

70

71
72
73
74
75
76
77
58
59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84







+


-







+

+








#include <AppMisc.h>
#ifndef HoG_GENODE
#include <AppServerLink.h>
#endif  // ~HoG_GENODE
#include <binary_compatibility/Interface.h>
#include <binary_compatibility/Support.h>
#ifndef HoG_GENODE
#include <MessagePrivate.h>
#include <MessageUtils.h>
#ifndef HoG_GENODE
#include <PortLink.h>
#include <ServerProtocol.h>
#include <ServerProtocolStructs.h>
#endif  // ~HoG_GENODE
#include <ShapePrivate.h>
#include <ToolTip.h>
#include <ToolTipManager.h>
#ifndef HoG_GENODE
#include <TokenSpace.h>
#endif
#include <ViewPrivate.h>

using std::nothrow;



#if defined( HoG_GENODE )

Changes to genode-haiku/haiku-on-genode/kits/interface/Window.cpp.

63
64
65
66
67
68
69



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

100
101
102
103
104
105
106
63
64
65
66
67
68
69
70
71
72
73

74
75
76

























77
78
79
80
81
82
83
84







+
+
+

-



-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+







#ifndef HoG_GENODE
#include <input_globals.h>
#include <tracker_private.h>
#endif  // ~HoG_GENODE


#if defined( HoG_GENODE )
#	include <base/env.h>
#	include <base/log.h>
#	include "_GeNitWindow.h"

#	include "_WindowNitpickerPriv.h"
/**************/
static int debug = 0;

typedef Genode::Surface_base::Point Point;
typedef Genode::Surface_base::Area  Area;
typedef Genode::Surface_base::Rect  Rect;

//#pragma mark -genode / Nitpicker-

#	if defined( HAS_MICRO_WINDOW_MANAGER )
Gui::Connection & BWindow::ServerWindow()
{
	// USED BY
	// ->  _WindowNitpickerPriv.cpp / Micro-window-manager
	
	return nitPrivate->ConnectionAndGeom();
}
#	endif  // ~HAS_MICRO_WINDOW_MANAGER

Input::Session_client & BWindow::ServerInput()
{
	// USED BY
	// ->  _WindowNitpickerPriv.cpp
	
	return nitPrivate->Input();
}

#endif
#endif  // ~HoG_GENODE




//#define DEBUG_WIN
#ifdef DEBUG_WIN
#	define STRACE(x) printf x
458
459
460
461
462
463
464
465

466
467
468
469
470
471
472
436
437
438
439
440
441
442

443
444
445
446
447
448
449
450







-
+







		Genode::log( "\n~BWindow DTOR for <", const_cast<const char*>(fTitle), ">" );
	
///ToDo: still needed in the public branch ..?
	// HoG: terminate the "input" thread -- signal it to quit, then wait for it.
	fTerminating = true;  // to be 100% sure we signal input-thread to quit
	
	//Genode::log( "t- DEL-inputbridger cap: T- used caps:  ", be_app->Env().pd().used_caps().value );
	delete inputBridger;  inputBridger = NULL;  // this will wait_for_thread()
	hog::destroy_in_bri( inputBridger );  inputBridger = NULL;  // this will wait_for_thread()
	//Genode::log( "t+ DEL-inputbridger cap: T+ used caps:  ", be_app->Env().pd().used_caps().value, "\n" );
#endif
	if (BMenu* menu = dynamic_cast<BMenu*>(fFocus)) {
		MenuPrivate(menu).QuitTracking();
	}

	// The BWindow is locked when the destructor is called,
2252
2253
2254
2255
2256
2257
2258
2259
2260


2261
2262

2263
2264
2265
2266
2267
2268
2269
2230
2231
2232
2233
2234
2235
2236


2237
2238
2239

2240
2241
2242
2243
2244
2245
2246
2247







-
-
+
+

-
+







		fTopView,
		B_ORIGIN,
		Bounds()//-> ++ OPTIM !
		);
	
	// T+
	dirtyRect = BRect();  // empty the dirty region
	nitPrivate->Canvas().SetOriginAndClipping( BPoint(), BRect() );  // reset, to disable "out of band" calls to Draw() (though BeOS did support those, hmmm)
		// NOTE: even if calling "SetViewPort( Bounds() )", it's STILL not enough to support out-of-band drawing, the out-of-band code would need to trigger a call to Canvas().Update() like called down here, to push the updated pixels to nitpicker !
	nitPrivate->Canvas_SetOriginAndClipping( BPoint(), BRect() );  // reset, to disable "out of band" calls to Draw() (though BeOS did support those, hmmm)
		// NOTE: even if calling "SetViewPort( Bounds() )", it's STILL not enough to support out-of-band drawing, the out-of-band code would need to trigger a call to Canvas_Update() like called down here, to push the updated pixels to nitpicker !
		// So for now we patch the offending apps (e.g. Clock) and make them call UpdateIfNeeded() or Invalidate().
	nitPrivate->Canvas().Update();
	nitPrivate->Canvas_Update();
		// Push the pixels changed in this update session to NitPicker;
		// interestingly, if we fail to call this, it gets called by nitpicker (NP "pulls" our framebuffer data) as the mouse cursor moves around, even when not moving in the vicinity of the concerned window, odd!

//ToDO:
	/*
	Haiku does this in DispatchMessage/ case _UPDATE_.. :
				// draw
2372
2373
2374
2375
2376
2377
2378
2379

2380
2381
2382
2383
2384
2385
2386
2387

2388
2389
2390
2391
2392
2393
2394
2350
2351
2352
2353
2354
2355
2356

2357

2358
2359
2360
2361
2362
2363

2364
2365
2366
2367
2368
2369
2370
2371







-
+
-






-
+







		
		//
		return;  // skip drawing this branch (i.e. this view and all its offspring)
		//
	}
	
	// ! configure painting engine !
	nitPrivate->Canvas()
	nitPrivate->Canvas_SetOriginAndClipping(
		.SetOriginAndClipping(
			this_lefttop,
			clipped_intersection & dirtyRect  // only draw pixels that fall inside the dirty rect
			);
	
	// T- : view color fill
	if( B_TRANSPARENT_COLOR != view->ViewColor() )
		nitPrivate->Canvas().FillRect(
		nitPrivate->Canvas_FillRect(
			view->Bounds(),
			view->ViewColor()
			);
	
///ToDo: ViewBitmap painting
	// T-
	//if( view->ViewBitmap... )
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868

2869
2870
2871
2872
2873
2874
2875
2834
2835
2836
2837
2838
2839
2840





2841
2842
2843
2844
2845
2846
2847
2848







-
-
-
-
-
+







			settings.FindRect(  "tab frame",    &tab_frame );
			settings.FindFloat( "border width", &border_width );
		}
	}
	nitPrivate->Set_ClientSide_Decorations( fFrame, tab_frame, border_width );
	if( false==IsHidden() )
	{
		Rect rect(
			Point( fFrame.left, fFrame.top ),
			Area( fFrame.Width() +1., fFrame.Height() +1. )
			);
		nitPrivate->SetClientGeometry( rect );
		nitPrivate->SetClientGeometry( fFrame );
	}
#else  // no HAS_MICRO_WINDOW_MANAGER:
	///later-maybe: Genode-style server-side decorations?
#endif  // ~no HAS_MICRO_WINDOW_MANAGER

#endif // ~HoG_GENODE

3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130

3131
3132
3133
3134
3135
3136
3137
3092
3093
3094
3095
3096
3097
3098





3099
3100
3101
3102
3103
3104
3105
3106







-
-
-
-
-
+







#else // HoG_GENODE

		fFrame.OffsetTo(x, y);
		
		// careful to not apply the raw geometry in the IsHidden case: for 'hiding' we use a hack whereby we set geometry to Area(0,0). That would be messed up by a subsequent moveto() to full-size area.
		if( false==IsHidden() )
		{
			Rect rect(
				Point( fFrame.left, fFrame.top ),
				Area( fFrame.Width() +1., fFrame.Height() +1. )
				);
			nitPrivate->SetClientGeometry( rect );
			nitPrivate->SetClientGeometry( fFrame );
		}
#endif // ~HoG_GENODE
	}

	Unlock();
}

3387
3388
3389
3390
3391
3392
3393
3394
3395

3396
3397
3398
3399
3400
3401
3402
3403
3356
3357
3358
3359
3360
3361
3362


3363

3364
3365
3366
3367
3368
3369
3370







-
-
+
-







#if defined( HoG_GENODE )
	// HoG: each BWindow has its own "input_server" bridge:
	
	if( inputBridger )
		debugger( "input bridger already present ?! in window" );
	
	//Genode::log( "\nt- New-inputbridger cap: T- used caps:  ", be_app->Env().pd().used_caps().value );
	
	inputBridger = new hog::InputBridger( *this );
	inputBridger = hog::create_in_bri( *this );//new hog::InputBridger( *this );
	
	//Genode::log( "t+ New-inputbridger cap: T+ used caps:  ", be_app->Env().pd().used_caps().value );
#endif

	return BLooper::Run();
}


3527
3528
3529
3530
3531
3532
3533
3534

3535
3536
3537
3538
3539
3540
3541
3494
3495
3496
3497
3498
3499
3500

3501
3502
3503
3504
3505
3506
3507
3508







-
+







///ToDo: is a default frame still needed ?
	if( !frame.IsValid() )
		frame = fFrame = BRect(10,10,256,100);
	
	inputBridger = NULL;
	
	//Genode::log( "\nt- NitPriv cap" );
	nitPrivate = new NitpickerInternals( offscreen_bitmap );
	nitPrivate = hog::NitWindowBase::Instantiate( offscreen_bitmap );
	//Genode::log( "t+ NitPriv cap" );
#endif
	frame.left = roundf(frame.left);
	frame.top = roundf(frame.top);
	frame.right = roundf(frame.right);
	frame.bottom = roundf(frame.bottom);

3696
3697
3698
3699
3700
3701
3702
3703

3704
3705
3706
3707
3708
3709
3710
3663
3664
3665
3666
3667
3668
3669

3670
3671
3672
3673
3674
3675
3676
3677







-
+







		fLink->SetSenderPort(sendPort);
		STRACE(("Server says that our send port is %ld\n", sendPort));
	}

	if( bitmapToken >= 0 )
		fOffscreen = true;

#else
#else  // HoG_GENODE:
	
	//fMaxZoomWidth = fMaxWidth;
	//fMaxZoomHeight = fMaxHeight;
	
	if( offscreen_bitmap )
		fOffscreen = true;  // used by BApplication::_WindowAt() etc
	
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3685
3686
3687
3688
3689
3690
3691





3692
3693
3694
3695
3696
3697
3698







-
-
-
-
-







	//Genode::log( "\nt- nitpriv-View cap" );
	nitPrivate->Create_Bare_Window();
	//Genode::log( "t+ nitpriv-View cap" );
	
	if( debug >= 2 )
		Genode::log( " win initial frame ltrb: ", frame.left, " ", frame.top, " ", frame.right, " ", frame.bottom );
	
	Rect rect(
		Point( frame.left, frame.top ),
		Area( frame.Width(), frame.Height() )///+1.0 ?
		);
	
	nitPrivate->Set_Title( fTitle );
	if( kDesktopWindowFeel == fFeel )
	{
///ToDo: ..background..: implement "desktop background" GUI session (also see: Activate(), IsFront()), so that SendBehind() won't send window behind the desktop
			//this doesn't do what I expected, seems I have no choice but to implement "background domain" (see Sculpt's README)... Although some Genode run files do implement "backdrop" without resorting to a "domain" ..?
		nitPrivate->Background();
	}
4051
4052
4053
4054
4055
4056
4057
4058

4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4013
4014
4015
4016
4017
4018
4019

4020




4021
4022
4023
4024
4025
4026
4027







-
+
-
-
-
-








	fTopView->_ResizeBy(deltaWidth, deltaHeight);

#if defined( HoG_GENODE )
	// framebuffer and view-port:
	if( false==IsHidden() )
	{
		nitPrivate->SetClientGeometry(
		nitPrivate->SetClientGeometry( fFrame );
			Rect(
				Point( fFrame.left, fFrame.top ),
				Area( fFrame.Width() +1., fFrame.Height() +1.) )
			);
		
		dirtyRect = Bounds();
		// UpdateIfNeeded();
		// --- No, do not call it right away as (in many cases) that ends up with a "black canvas"
		// Seems that this resets dirtyRect, even though some BView fiddling is sometimes done *after* us.. (eg Tracker/Find, click "more settings") and it's then too late to "notice" their dirty flag being raised.
		// We could also Post(_UPDATE_).. except this might get us in a loop
		// Luckily, it seems in all scenarios we end up calling UpdateIfNeeded() later on, the "right" way, anyway.
5021
5022
5023
5024
5025
5026
5027
5028

5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041

5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
4979
4980
4981
4982
4983
4984
4985

4986


4987
4988
4989
4990
4991
4992
4993
4994
4995
4996

4997




4998
4999
5000
5001
5002
5003
5004







-
+
-
-










-
+
-
-
-
-







	if( IsHidden() )
	{
		if( debug >= 2 )
			Genode::log( " Hide: set NIL ltrb on nitpicker!" );
		
		// the Qt5 port does the below "set size to zero" for hiding
		// a window, so we follow suit, we of course don't call np.destroy_view()
		nitPrivate->SetClientGeometry(
		nitPrivate->SetClientGeometry( BRect() );
			Gui::Rect( Gui::Point(), Gui::Area(0, 0) )
			);
	}
	else  // Show
	{
		// T- : force painting
		dirtyRect = Bounds();  // fFrame, offset to (0, 0)
		
		if( debug >= 2 )
			Genode::log( " Show <", Name(), ">: wid/hei: ", fFrame.Width(), " / ", fFrame.Height() );
		
		// Nitpicker Geometry: restore "zeroed" frame, if Hide() was called
		nitPrivate->SetClientGeometry(
		nitPrivate->SetClientGeometry( fFrame );
			Rect(
				Point( fFrame.left, fFrame.top ),
				Area( fFrame.Width() +1., fFrame.Height() +1.) )
			);
		// !
		nitPrivate->To_Front();
		
		// T+ : paint (this works because of the full dirtyRect above)
		// Cannot call UpdateIfNeeded() directly, we might be called from another thread, whereby that method will bail out first thing...
		// Instead post to self, to ensure UpdateIfNeeded() ends up being called from this window's thread:
		PostMessage( _UPDATE_ );

Changes to genode-haiku/haiku-on-genode/kits/interface/Window.h.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30

31
32
33
34
35
36
37









38
39
40
41
42
43
44
45
1
2
3
4
5
6
7
8
9
10
11
12
13




14










15


16


17
18



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35













-
-
-
-
+
-
-
-
-
-
-
-
-
-
-

-
-
+
-
-


-
-
-
+
+
+
+
+
+
+
+
+








/*
 * Copyright 2001-2015, Haiku, Inc. All rights reserved.
 * Distributed under the terms of the MIT License.
 */
#ifndef	_WINDOW_H
#define	_WINDOW_H


#include <Looper.h>
#include <StorageDefs.h>
#include <View.h>

#if defined( HoG_GENODE )
// haiku.lib.so
#include "_WindowNitpickerPriv.h"
/*
namespace Nitpicker
namespace Input {
{
	struct Session;
	{
	public:
		class View_handle;
		class Command;
	};
	class Session::View_handle;
	
	class Connection;
	class Session_client;
	class View_capability;
}
};
*/
struct NitpickerInternals;
// no choice on this one, it needs to be exported
// to the "input events handler" (in e.g.  main-demo.cc)
namespace Gui
{
	class Connection;
namespace Gui {
	class Connection;
};

// haiku.lib.so
#include "_GeNitWindow.h"  // member
namespace hog {
	class InputBridger;
	class Wm;
};
#endif  // ~HoG_GENODE


class BButton;
class BMenuBar;
class BMenuItem;
class BMessage;
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
115
116
117
118
119
120
121










122
123
124
125
126
127
128







-
-
-
-
-
-
-
-
-
-







									uint32 workspace = B_CURRENT_WORKSPACE);
								BWindow(BRect frame, const char* title,
									window_look look, window_feel feel,
									uint32 flags, uint32 workspace
										= B_CURRENT_WORKSPACE);
	virtual						~BWindow();

#if defined( HoG_GENODE )
#	if defined( HAS_MICRO_WINDOW_MANAGER )
		// used by hog::Wm ...
		Gui::Connection
			& ServerWindow();
#	endif  // ~HAS_MICRO_WINDOW_MANAGER
		// used by inputbridger...
		Input::Session_client
			& ServerInput();
#endif
								BWindow(BMessage* archive);
	static	BArchivable*		Instantiate(BMessage* archive);
	virtual	status_t			Archive(BMessage* archive,
									bool deep = true) const;

	virtual	void				Quit();
			void				Close() { Quit(); }
483
484
485
486
487
488
489
490

491
492
493
494
495
496
497
463
464
465
466
467
468
469

470
471
472
473
474
475
476
477







-
+







		
		hog::InputBridger * inputBridger;
		
		// cannot #include the Nitpicker definitions, as that
		// ends up with genode's cpu.h which has a #define OVERFLOW
		// which conflicts with Rect.h/math.h #define OVERFLOW, dang.
		// Anyway it's better to hide the implementation regardless:
		NitpickerInternals * nitPrivate;
		hog::NitWindowBase * nitPrivate;
		
		// painting/optim -- might be even better as a BRegion (is it worth it ?)
		BRect dirtyRect;  // cumulative, i.e. Invalidate() might be called several times, enlarging this each time, before UpdateIfNeeded() clears it in one fell swoop.
#endif  // ~HoG_GENODE

			BMessageRunner*		fPulseRunner;
			BRect				fPreviousFrame;

Changes to genode-haiku/haiku-on-genode/kits/interface/_CanvasGenode.cpp.

22
23
24
25
26
27
28

29
30
31
32
33
34
35
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36







+







#include <polygon_gfx/line_painter.h>
#include <polygon_gfx/shaded_polygon_painter.h>

// libc.lib.so
#include <stdlib.h>  // malloc()

// haiku.lib.so
#include "_GeFontStash.h"
#include <app/Application.h>  // be_app
#include <interface/AffineTransform.h>
#include <interface/Bitmap.h>
#include <interface/Gradient.h>
#include <interface/Polygon.h>
#include "ColorConversion.h"  // BPrivate::ConvertBits()

115
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130
131


132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

152
153
154
155
156
157
158
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130


131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

152
153
154
155
156
157
158
159







-
+







-
-
+
+



















-
+







		//
		return;
		//
	}
	
	const Framebuffer::Mode mode
	{
		.area = { _size.w(), _size.h() }
		.area = { _size.w, _size.h }
	};
	
	// setup virtual framebuffer mode
	nitServer.buffer( mode, false );
	
	// it should return us the requested px:
	int const
		scr_w = _size.w(),
		scr_h = _size.h();
		scr_w = _size.w,
		scr_h = _size.h;
	
	if( debug >= 1 )
		Genode::log( " screen is ", mode );
	
	if( !scr_w || !scr_h )
	{
		Genode::error("CanvasGenode: got invalid screen - aborting");
		//
		return;
		//
	}
	
	// alloc RM
	
	if( debug_caps )
		Genode::log( "\nt- Attached_dataspace_fbuffer ctor" );
	
	screenCanvas = new Genode::Attached_dataspace (
		env.rm(),
		server_events.framebuffer()->dataspace()
		server_events.framebuffer.dataspace()
		);
	
	if( debug_caps )
		Genode::log( "t+ Attached_dataspace_fbuffer ctor" );
	
	// clear framebuffer..
	//memset(_fb_ds->local_addr<pixel_t>(), 0, _fb_ds->size());
198
199
200
201
202
203
204
205

206
207

208
209
210
211
212
213
214
199
200
201
202
203
204
205

206
207

208
209
210
211
212
213
214
215







-
+

-
+







		//
		return;  // nothing to sync, off-screen bitmaps are single-buffered
		//
	
	if( debug >= 3 )
		Genode::log( "    => blit to NitPicker <= ----------" );
	
	nitServer.framebuffer()->refresh(
	nitServer.framebuffer.refresh(
		0, 0,
		_size.w(), _size.h() //+clientFrame instead
		_size.w, _size.h //+clientFrame instead
		);
}

///later: talking of drawing bugs and 'missing lines': I should roundf() maybe ?
// see:  https://xref.landonf.org/source/xref/haiku/src/servers/app/drawing/drawing_support.cpp#9
// align_rect_to_pixels(BRect* rect) -> rect->right = roundf(rect->right); and so on

236
237
238
239
240
241
242
243

244
245
246
247
248
249
250
251
252
253
254
255
256



257
258
259
260
261
262
263
264
265
266
267
268
269

270
271
272
273
274
275
276
237
238
239
240
241
242
243

244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272

273
274
275
276
277
278
279
280







-
+













+
+
+












-
+







	updateDecor();
}

Gui::Rect CanvasGenode::DecoratedOuterRect_For_Inner( const Rect inner_rect ) const
{
//open /GenCharlie/_nimble_Master/dev_github.com/genode/repos/os/include/util/geometry.h
	// enlarge the inner frame by "csdBorder" pixels, to obtain the outer (decorated) frame
	Rect outer_rect(
	Rect outer_rect = Rect::compound(
		Point(
			inner_rect.x1() - csdBorder,
			inner_rect.y1() - csdBorder - (csdTab.Height() +1.) ), //xx support left-hand tab..
		Point(
			inner_rect.x2() + csdBorder,
			inner_rect.y2() + csdBorder )
		);
	
	return outer_rect;
}

void CanvasGenode::updateDecor()
{
	if( debug )
		PDBG( "updateDecor: csdBorder=", csdBorder );
	
	if( csdBorder <= 0. && false==csdTab.IsValid() )
		//
		return;
		//
	
	// T- prologue
	const BPoint save_orig = currentOrigin;
	const BRect  save_clip = clipRect;
	
	// With the above which saves clipping & origin (some apps do misbehave if we don't, like
	// Clock), we can now override them, so as to paint decorations, outside "client" area:
	currentOrigin = BPoint( 0., 0. );
	clipRect = BRect( currentOrigin, BPoint(_size.w()-1, _size.h()-1) );
	clipRect = BRect( currentOrigin, BPoint(_size.w -1, _size.h -1) );
	
///ToDo-2: upgrade from "bare bones" decorator to actual Haiku-code decorator
	// -- bare-bones decorator --
	
	//xx implement support for left-side tab
	const float tab_hei = csdTab.IsValid()
		? csdTab.Height() +1.
324
325
326
327
328
329
330
331

332
333
334
335
336
337
338
328
329
330
331
332
333
334

335
336
337
338
339
340
341
342







-
+







			r.left = tab_hei + 3;
			
			// vert centering:
			if( be_app )
			{
				const int font_id = 0;
				const Text_painter::Font & font =
					be_app->GenoFonts().Font( font_id )
					*be_app->GenoFonts().Font( font_id ).tpainterFont
					;
				r.bottom /= 2;
				r.bottom += font.baseline() / 2;
			}
			
			where = r.LeftBottom();
		}
357
358
359
360
361
362
363
364

365
366
367
368
369

370
371
372
373
374
375
376
361
362
363
364
365
366
367

368
369
370
371
372

373
374
375
376
377
378
379
380







-
+




-
+







{
	// AKA "resize_buffer_for_this_inner_frame"
	
#ifdef HAS_MICRO_WINDOW_MANAGER
	Rect outer_rect =
		DecoratedOuterRect_For_Inner( inner_rect );
	
	rebufferOuter( outer_rect.area() );
	rebufferOuter( outer_rect.area );

#else  // no-client-side-deco

	Rect outer_rect = inner_rect;
	rebufferOuter( outer_rect.area() );
	rebufferOuter( outer_rect.area );
#endif  // ~no-client-side-deco
}



//#pragma mark - > decoration-agnostic (almost) remainder of the code

388
389
390
391
392
393
394
395
396


397
398
399
400
401
402
403
392
393
394
395
396
397
398


399
400
401
402
403
404
405
406
407







-
-
+
+







		PDBG( "resize: ", outer_area, " (outer area)" );//, " for window <", csdTitle.String(), ">" );
	
	/********/
	
	//?
	SetOriginAndClipping( BPoint(), BRect() );//	SetOriginAndClipping( B_ORIGIN, clientFrame );
	
	int width  = outer_area.w();
	int height = outer_area.h();
	int width  = outer_area.w;
	int height = outer_area.h;
	
	// T0
	_size = Genode::Surface_base::Area( width, height );
	//PDBG( "  final size: ", _size );
	
	/********/
	
415
416
417
418
419
420
421
422

423
424
425
426
427
428
429
430
431
432
433
434
435

436
437
438
439
440
441
442
419
420
421
422
423
424
425

426
427
428
429
430
431
432
433
434
435
436
437
438

439
440
441
442
443
444
445
446







-
+












-
+







		return;
		//
	
	//if (max_x > _size.width() || max_y > _size.height())
	{
		const Framebuffer::Mode mode
		{
			.area = { _size.w(), _size.h() }
			.area = { _size.w, _size.h }
		};
		nitServer.buffer( mode, false );//NO_ALPHA);
		
		if( debug_caps )
			Genode::log( "t- Attached_dataspace_fbuffer ReCycle.." );
		
		if( screenCanvas )
			delete screenCanvas;
		screenCanvas = nullptr;
		;
		screenCanvas = new Genode::Attached_dataspace(
			env.rm(),
			nitServer.framebuffer()->dataspace()
			nitServer.framebuffer.dataspace()
			);
		
		if( debug_caps )
			Genode::log( "t+ Attached_dataspace_fbuffer ReCycle.." );
	}
	
	// T+
485
486
487
488
489
490
491
492
493


494
495
496
497
498
499
500
489
490
491
492
493
494
495


496
497
498
499
500
501
502
503
504







-
-
+
+







	// adjust client-reference to framebuffer (decorator-aware) reference frame
	//
	BRect client_frame;  // aka client-Side-Inner-Frame
#ifdef HAS_MICRO_WINDOW_MANAGER
	client_frame = BRect(
		0			+ csdBorder,
		0			+ csdBorder + csdTab.Height()+1.0,
		_size.w() -1 -csdBorder,
		_size.h() -1 -csdBorder
		_size.w -1 -csdBorder,
		_size.h -1 -csdBorder
		);

#else  // no_CS_WINMAN:

	client_frame = BRect(
		0., 0.,
		_size.w() -1,
634
635
636
637
638
639
640
641

642
643
644

645
646
647
648
649
650
651

652
653
654
655
656
657
658
638
639
640
641
642
643
644

645
646
647

648
649
650
651
652
653
654

655
656
657
658
659
660
661
662







-
+


-
+






-
+







		
		const Genode::Color
			genodecolor( color.red, color.green, color.blue, color.alpha )
			;
		PT pixel;
		pixel.rgba( color.red, color.green, color.blue );
		
		if( x + y*_size.w() >= screenCanvas->size() )
		if( x + y*_size.w >= screenCanvas->size() )
		{
			// this ought to have been caught by the <clippingPort> test above...:
			Genode::error("framebuffer: attempting to write beyond FB addy space! FB size: ", screenCanvas->size(), " wanted offset: ", x + y*_size.w(), " ---------");
			Genode::error("framebuffer: attempting to write beyond FB addy space! FB size: ", screenCanvas->size(), " wanted offset: ", x + y*_size.w, " ---------");
			
			//
			return;
			//
		}
		
		PT & dst = pixels[ x + y*_size.w() ];
		PT & dst = pixels[ x + y*_size.w ];
		
		// T0
		//
		if( genodecolor.opaque() )
			dst = pixel;
		else
			// alpha blending
996
997
998
999
1000
1001
1002
1003

1004
1005
1006
1007
1008
1009
1010
1000
1001
1002
1003
1004
1005
1006

1007
1008
1009
1010
1011
1012
1013
1014







-
+







			col
			);
		
		points[i] = p;
		//Genode::log( "      poly-point: ", p, " color: ", col );
	}
	
	Genode::Heap heap { env.ram(), env.rm() }; ///later: optim
	Genode::Heap heap { env.ram(), env.rm() }; ///ToDo: OPTIM! Keep the heap around (used by FillRect(BGradient) in title bars and menus)
	Polygon::Shaded_painter painter(
		heap,
		polygon.Frame().Height() +1//clipRect.Height() //?
		);
	
///ToDo: work-around for Shaded_painter: any other way to do this ?
	// Alpha needs to be redirected to a "dummy" buffer to avoid visual artifacts in the screen buffer (white rects of 1/4th size of the rect)
1033
1034
1035
1036
1037
1038
1039

1040
1041
1042
1043
1044
1045
1046
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051







+







	//surface.flush_pixels(surface.clip());// clipped );
}



void CanvasGenode::FillRect( BRect rect_local, const BGradient & gradient )
{
///FIXME: nothing drawn any more in this 'gradient' variant, even though a 'plain' FillRect works: FillRect( rect_local, make_color(180,0,0));
	if( debug >= 4 )
		Genode::log( "  fillrect-Gradient (", memoryCanvas?"OFFscreen":"screen", "): local", stringFor(rect_local).String() );//, stringFor(color).String() );
	
	// delegate to FillPolygon(), which knows how to paint "shades" ("gradients"):
	
	//xx work-around for Polygon::Shaded_painter eating up the last pixel down (and sometimes right), as seen in the Client-Side Decorator, painting the yellow(ish) tab:
	const BPoint ytweak( 0., 1. );
1644
1645
1646
1647
1648
1649
1650
1651

1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662

1663
1664
1665
1666
1667
1668
1669
1649
1650
1651
1652
1653
1654
1655

1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675







-
+











+







		Point( clipRect.left, clipRect.top ),
		Area( clipRect.Width() +1, clipRect.Height() +1 )
		) );
	
///ToDo: DrawString() params: pass BFont/family/ID as param, or outright the full *BView.viewState* itself
	const int font_id = 0;
	const Text_painter::Font & font =
		be_app->GenoFonts().Font( font_id )
		*be_app->GenoFonts().Font( font_id ).tpainterFont
		;
	
	{
		// do apply the length, otherwise BTextView displays junk (it passes us strings that are *not* nul-terminated)
		char * text = (char*)malloc( length +sizeof('\0') );
		strlcpy( text, raw_text, length +sizeof('\0') );
		text[ length ] = '\0';
		
		if( debug >= 5 )
			Genode::log( "   ->drawString <", raw_text, ">: substracting ", font.baseline(), " from where_local.y=", where_local.y );
		
///FIXME: nothing drawn any more in Text_painter
		Text_painter::paint(
			surface,
			Text_painter::Position(
				where.x,
				where.y - font.baseline()  // seems Genode works the opposite of Haiku, handles y coord relative to top instead of relative to baseline..
				),
			font,
1815
1816
1817
1818
1819
1820
1821
1822

1823
1824
1825
1826
1827
1828
1829
1821
1822
1823
1824
1825
1826
1827

1828
1829
1830
1831
1832
1833
1834
1835







-
+







			dest_where += chopping;
		}
	}
	
	if( debug >= 4 )
		Genode::log(
			"   paint bitmap to Surface: ", surface.size(),
			" with stride dst_w=", surface.size().w(),
			" with stride dst_w=", surface.size().w,
			" src_where: ", int(src_where.x), " ", int(src_where.y),
			" dest_where: ", int(dest_where.x), " ", int(dest_where.y)
			); // note: beside surface.size(), surface.clip() is interesting, it has an offset, denoting the view "port" inside dest window..
	
	switch( bitmap.ColorSpace() )
	{
		case B_CMAP8:
1857
1858
1859
1860
1861
1862
1863
1864

1865
1866

1867
1868
1869
1870
1871
1872
1873
1863
1864
1865
1866
1867
1868
1869

1870
1871

1872
1873
1874
1875
1876
1877
1878
1879







-
+

-
+







			const color_space
				nitpicker_colspace = B_RGB32;  // Haiku's equivalent for <PT> Genode::Pixel_rgb888
			
			BPrivate::ConvertBits(
				src,  // initial byte of texture
				dst,  // initial byte of surface output
				bitmap.BitsLength(),
				get_raw_bytes_per_row( nitpicker_colspace, surface.size().w() ) *surface.size().h(),// *clipped.h(),
				get_raw_bytes_per_row( nitpicker_colspace, surface.size().w ) *surface.size().h,// *clipped.h(),
				bitmap.BytesPerRow(),
				get_raw_bytes_per_row( nitpicker_colspace, surface.size().w() ),  // B_RGB16 takes 2 bytes per pixel
				get_raw_bytes_per_row( nitpicker_colspace, surface.size().w ),  // B_RGB16 takes 2 bytes per pixel
				bitmap.ColorSpace(),
				nitpicker_colspace,
#if 0
				BPoint( 0,0),//clipped.x1(), clipped.y1() ),//0., 0. ),  // offset at which to start reading
				BPoint( position.x(), position.y() ),  // offset at which to start writing
				bitmap.Bounds().IntegerWidth() +1,//clipped.w(),  // The width (in pixels) to convert.
				bitmap.Bounds().IntegerHeight() +1//clipped.h()  // The height (in pixels) to convert.

Changes to genode-haiku/haiku-on-genode/kits/interface/_GeInput.cpp.

1
2
3
4
5
6
7

8
9
10
11

12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
19







+



-
+







/*
 * Copyright 2021-2024, ttcoder of TTS-LLC
 * All rights reserved. Distributed under the terms of the MIT license.
 */


// haiku.lib.so
#include <interface/InterfaceDefs.h>  // B_ESCAPE etc
#include <support/Debug.h>  // STATIC_ASSERT()

// this
#include "_WindowNitpickerPriv.h"
#include "_GeInput.h"



// Map
// - from Genode-Nitpicker scan-code
// - to   UTF8 (in fact, ASCII) character, or modifier
//

Added genode-haiku/haiku-on-genode/kits/interface/_GeInput.h.


















































































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
 * Copyright 2024, ttcoder
 * All rights reserved. Distributed under the terms of the MIT license.
 */
#ifndef _GeInput_H
#define _GeInput_H


// genode/base.lib.a
#include <input_session/connection.h>

// libbe.so
class BWindow;
#include <interface/Point.h>  // member
#include <interface/Size.h>  // member
#include "_WindowNitpickerPriv.h"  // Wm


namespace hog {
	class InputBridger;
	//class Wm;
	
	namespace conv_input {
		int HaikuKey_for_GeKey(
			const	Input::Keycode genode_scancode,
					int32 & changed_disambiguated_modifier
			);
		int ModifiedKey_for_RawBeKey(
			int raw_be_key,
			int virtualized_modifiers
			);
	}
}


class hog::InputBridger
{
public:
		InputBridger( BWindow & win );
		~InputBridger();
		
	//static int input_server_( void * data );
		void eventLoop();
		
		void handleInput();
		void handleDisplayMode();


private:  // Code

		void handleOneEvent(
			const Input::Event & ev
			);
		BMessage mouseDown( int32 button );
		BMessage mouseUp( int32 button );
		BMessage keyDownOrUp(
			const Input::Keycode genode_key,
			const bool latch_down );
		
	static int forwarding_to_pthread( void * bridger_uncast );


private:  // Data

		// Tx -- for pushing to PostMessage() and access to ServerWindow()
		BWindow & ourWin;
		
		// State --
		// double-click detection state
		bigtime_t latestClick;  // last time any button (left, right, etc) was pressed down, in support of mouseDown()
		// current state, previously in struct "MouseState":
		BPoint curScreenWhere;
		int32  curButtons;
		
		// distinct thread, to separate Genode-context and LibC-context code,
		// communicating through a mutex'ed FIFO:
		//
		thread_id threadId;
		Genode::Entrypoint localEp;  // Genode thread dedicated to the sigh
		// Rx -- let Genode push events to us
		Genode::Signal_handler<InputBridger>
			inputHandler;
		Genode::Signal_handler<InputBridger>
			dispModeHandler;
		
		// shared between our <ep> Genode-thread and <forwarder> pthread
		//
		Genode::Blockade greenlightForwarder;
		Genode::Mutex mutexFwd;
		
		struct EvItem : public Genode::Fifo<EvItem>::Element
		{
			EvItem( const Input::Event & ev )
			: event( ev )  // copy ctor seems to work fine
			{
			}
			
			Input::Event  event;
		};
		Genode::Fifo< EvItem > eventsToForward;
		
		BSize newMode; //_d_: Framebuffer::Mode  newMode;
		bool tearDownThread;  // set to <true> to signal function forwarding_to_pthread() to end its thread
		
#ifdef HAS_MICRO_WINDOW_MANAGER
		Wm winManager;
#endif  // ~HAS_MICRO_WINDOW_MANAGER
};



#endif // _GeInput_H

Added genode-haiku/haiku-on-genode/kits/interface/_GeNitWindow.h.









































































1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
/*
 * Copyright 2024, ttcoder
 * All rights reserved. Distributed under the terms of the MIT license.
 */
#ifndef _GeNitWindow_H
#define _GeNitWindow_H


// genode/base.a
namespace Gui {
	class  Connection;
}
namespace Input {
	class  Session_client;
}

// haiku.lib.so
class BWindow;
namespace hog {
	class NitWindowBase;
	
	class InputBridger;
	///ToDo: replace these with static/factory type functions, using a "Base" class shielding mechanism (similar to NitWinBase vs. NitWinPrivate)
	extern InputBridger * create_in_bri( BWindow & win );
	extern void destroy_in_bri( InputBridger * ptr );
};



class hog::NitWindowBase
{
	// Hide the implementation details behind this "base"/"interface"
	// (to avoid header clashes between Ge and Hai headers)
	
public:

		// Xtors
		
		virtual ~NitWindowBase();
		
	static
		hog::NitWindowBase * Instantiate( BBitmap * offscreen_bitmap );
		
		// Canvas "firewall/shim":
		
		void Canvas_SetOriginAndClipping( BPoint, BRect );
		void Canvas_FillRect( BRect, rgb_color );
		void Canvas_Update();
		
	virtual CanvasGenode & Canvas() = 0; //+ "PaintingSurface" ?
	virtual Input::Session_client & Input() = 0;
	
	virtual void Create_Bare_Window() = 0;
	virtual void Destroy_Bare_Window() = 0;
	virtual void Set_Title( const char * title ) = 0;
	virtual void To_Front() = 0;
	virtual void To_Back() = 0;
	virtual void Background() = 0;
	virtual void SetClientGeometry( BRect inner_rect ) = 0;//Gui::Rect inner_rect );
#ifdef HAS_MICRO_WINDOW_MANAGER
	virtual Gui::Connection & ConnectionAndGeom() = 0;//nah!: ///+ "DecoratedGeom" ?
	virtual void Set_ClientSide_Decorations(
			BRect inner_frame,
			BRect tab_frame,
			float border_thickness
			) = 0;
#endif
};


#endif // _GeNitWindow_H

Changes to genode-haiku/haiku-on-genode/kits/interface/_WindowNitpickerPriv.cpp.

8
9
10
11
12
13
14



15
16
17
18
19
20
21
22

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

























































































57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85

86
87
88
89
90
91
92
93
94
95
96
97
98
99



100

101
102
103
104
105
106
107
8
9
10
11
12
13
14
15
16
17
18
19




20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163










164
165



166
167
168
169
170
171




172
173
174

175
176
177
178
179
180
181
182







+
+
+


-
-
-
-


+













-




















+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+



















-
-
-
-
-
-
-
-
-
-
+

-
-
-






-
-
-
-
+
+
+
-
+







#include <format/snprintf.h>

// libc.lib.so
#include <ctype.h>  // toupper()
#include <stdio.h>  // sprintf()

// haiku.lib.so
#include <app/Application.h>  // be_app
#include "_CanvasGenode.h"
#include "_GeInput.h"
#include <interface/Window.h>

//#ifdef HAS_MICRO_WINDOW_MANAGER
//#	include <gui_session/connection.h>  // Command::To_front etc
//#endif  // ~HAS_MICRO_WINDOW_MANAGER

// this
#include "_WindowNitpickerPriv.h"


// - namespaces -
typedef
	Gui::Session::Command
	Command
	;

// - macros -
#if 0
#define PDBG(...) Genode::log( "\033[33m", __VA_ARGS__, "\033[0m" )
#else
#define PDBG(...) ;
#endif



/**************/
static int debug = 0;


static BString WhatAsStr( int32 what )
{
	char what_str[4 +sizeof('\0')] = {};
	
	// Use the Genode implementation (the libc snprintf() trips a pthread assertion when run in a sig-handler):
	Format::snprintf( what_str, sizeof(what_str), "%4s", (const char*)&what );
	
	return what_str;
}



//#pragma mark - Nitpicker win -


struct NitpickerInternals : public hog::NitWindowBase
{
public:

		NitpickerInternals( BBitmap * paint_offscreen = NULL );
		
		//
		// Override/implement NitWindowBase:
		//
		
		CanvasGenode & Canvas() override; //+ "PaintingSurface" ?
		Input::Session_client & Input() override;
		
		void Create_Bare_Window() override;
		void Destroy_Bare_Window() override;
		void Set_Title( const char * title )  override;
		void To_Front() override;
		void To_Back() override;
		void Background() override;
		void SetClientGeometry( BRect inner_rect ) override;
			///++ "SetInnerGeometry( Rect inner_rect ) !
		
#if defined( HAS_MICRO_WINDOW_MANAGER )
		Gui::Connection & ConnectionAndGeom() override;//nah!: ///+ "DecoratedGeom" ?
		void Set_ClientSide_Decorations(
			BRect inner_frame,
			BRect tab_frame,
			float border_thickness
			) override;
#endif


private:  // Code

		void reGeom(   Gui::Rect inner_rect );
		void reBuffer( Gui::Rect inner_rect );


private:  // Data

		Gui::Connection //*
			nitpicker;
		CanvasGenode //*
			geCanvas;
		
		// Our window (aka 'view') ID
		Gui::View_id
			_handle;// or "bareWindow" or "undecoratedWindow"
				// or just "windowviewId"
		///later: we let the ctor initialize _handle to its default value (0)
		// is that good enough ? Seems to be, given we only have one view/window, so the ID does not matter
};



//#pragma mark - Nitpicker win BASE -


hog::NitWindowBase::~NitWindowBase()
{
}

void hog::NitWindowBase::Canvas_SetOriginAndClipping( BPoint p, BRect r )
{
	Canvas().SetOriginAndClipping( p, r );
}

void hog::NitWindowBase::Canvas_FillRect( BRect r, rgb_color c )
{
	Canvas().FillRect( r, c );
}

void hog::NitWindowBase::Canvas_Update()
{
	Canvas().Update();
}


//static
hog::NitWindowBase * hog::NitWindowBase::Instantiate( BBitmap * offscreen_bitmap )
{
	return new NitpickerInternals( offscreen_bitmap );
}



//#pragma mark - Nitpicker win IMPL -


NitpickerInternals::NitpickerInternals( BBitmap * offscreen_bitmap )
:	nitpicker( be_app->Env(), "BWindow" )
	,geCanvas( be_app->Env(), nitpicker, offscreen_bitmap )
	,_handle()
{
	PDBG( "-- created Decorated-window, bare-window, and surface/canvas --" );
}


CanvasGenode &
	NitpickerInternals::Canvas()
{
	return geCanvas;
}

Input::Session_client &
	NitpickerInternals::Input()
{
	return *nitpicker.input();
}


#if defined( HAS_MICRO_WINDOW_MANAGER )

Gui::Connection &
	NitpickerInternals::ConnectionAndGeom()
{
	return nitpicker;
	return nitpicker.input;
}

#endif  // ~HAS_MICRO_WINDOW_MANAGER



void NitpickerInternals::Create_Bare_Window()
{
	PDBG( "-- creating a 'view'  (T- used caps/mem:  ", be_app->Env().pd().used_caps().value, ", ", be_app->Env().pd().used_ram().value/1024, " KB)" );
	
	// 'nil' parent
	Gui::Session::View_handle
		parent_handle;
	
	nitpicker.view(
		_handle,
		{ }  // we will set the title/rect/front attributes separately
	_handle = nitpicker.create_view( parent_handle );
		);
	
	PDBG( "--  created a 'view'  (T+ used caps/mem:  ", be_app->Env().pd().used_caps().value, ", ", be_app->Env().pd().used_ram().value/1024, " KB)" );
}

void NitpickerInternals::Destroy_Bare_Window()
{
	PDBG( "DELETING 'view'  (T- used caps/mem: ", be_app->Env().pd().used_caps().value, ", ", be_app->Env().pd().used_ram().value/1024, " KB)" );
123
124
125
126
127
128
129
130

131
132
133
134
135
136
137
138
139
140
141

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163

164
165

166
167
168
169
170
171
172
198
199
200
201
202
203
204

205



206
207
208
209
210
211
212

213



214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231

232
233

234
235
236
237
238
239
240
241







-
+
-
-
-







-
+
-
-
-


















-
+

-
+







#endif
}

void NitpickerInternals::To_Front()
{
	PDBG( "to-front" );
	
	nitpicker.enqueue<Command::To_front>(
	nitpicker.enqueue<Command::Front>( _handle );
		_handle,
		Gui::Session::View_handle()
		);
	nitpicker.execute();
}

void NitpickerInternals::To_Back()
{
	PDBG( "to-Back" );
	
	nitpicker.enqueue<Command::To_back>(
	nitpicker.enqueue<Command::Back>( _handle );
		_handle,
		Gui::Session::View_handle()
		);
	nitpicker.execute();
}

void NitpickerInternals::Background()
{
	PDBG( "to-Background" );
	
/// (see matching 'FIXME' in Window.cpp): .. Background() .. neither of the below variants work, the window just hides/disappears, so call To_Back() for now...
	To_Back(); return;
	/**********/
	
#if 0
	// let's try just ::Background on its own
	nitpicker.enqueue<Command::Background>( _handle );
	nitpicker.execute();
#else
	// let's try the whole block from backdrop
	nitpicker.enqueue<Command::Background>( _handle );
	Gui::Rect rect(Gui::Point(0,0), Gui::Point(800,600));//_buffer->size());
	Gui::Rect rect = Gui::Rect::compound( Gui::Point(0,0), Gui::Point(800,600) );//_buffer->size());
	nitpicker.enqueue<Command::Geometry>( _handle, rect );
	nitpicker.enqueue<Command::To_back>( _handle, Gui::Session::View_handle() );
	nitpicker.enqueue<Command::Back>( _handle );
	nitpicker.execute();
#endif
}


void NitpickerInternals::reGeom( Gui::Rect inner_rect )
{
194
195
196
197
198
199
200
201







202
203
204
205
206
207
208
209

210



211
212
213
214
215
216
217
218


219
220
221

222
223
224
225
226
227
228
229
230
231
232
233

234
235
236
237
238






239
240
241
242
243
244
245
263
264
265
266
267
268
269

270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285

286
287
288
289
290
291
292
293
294
295

296
297
298
299

300
301
302
303
304
305
306
307
308
309
310
311

312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330







-
+
+
+
+
+
+
+








+
-
+
+
+







-
+
+


-
+











-
+





+
+
+
+
+
+







		Genode::log( "  reBuffer: inner_rect: ", inner_rect );
	
	// T0
	geCanvas.Rebuffer_Inner( inner_rect );
}


#ifdef HAS_MICRO_WINDOW_MANAGER
#if defined( HAS_MICRO_WINDOW_MANAGER )

Gui::Connection &
	NitpickerInternals::ConnectionAndGeom()
{
	return nitpicker;
}

void NitpickerInternals::Set_ClientSide_Decorations(
			BRect inner_frame,
			BRect tab_frame,
			float border_thickness
			)
{
	if( debug )
	{
		Genode::log( "NitPriv.setDecorations" );
		Genode::log( "NitPriv.setDecorations with thickness ", border_thickness, " and rect: " );
		inner_frame.PrintToStream();
	}
	
	// T0
	geCanvas.SetInsets_DecorCS(
		tab_frame,
		border_thickness
		);
	
	Gui::Rect inner_rect(
	Gui::Rect inner_rect
	{
		Gui::Point( inner_frame.left, inner_frame.top ),
		Gui::Area(  inner_frame.Width()+1, inner_frame.Height()+1)
		);
	};
	
	// T+
	reBuffer( inner_rect );
	// do NOT call this:
	// reGeom(   inner_rect );
	// as that might reset the hide/show state.
}

#endif  // ~HAS_MICRO_WINDOW_MANAGER


void NitpickerInternals::SetClientGeometry( Gui::Rect inner_rect )
void NitpickerInternals::SetClientGeometry( BRect be_inner_rect )
{
	// So, 3 things are kept in sync:
	// - Rebuffer() -- in BWindow
	// - nitpicker.Geom -- below
	// - canvas.decorations -- below
	
	// BRect -> Gui::Rect
	Gui::Rect inner_rect(
		Gui::Point( be_inner_rect.left, be_inner_rect.top ),
		Gui::Area( be_inner_rect.Width() +1., be_inner_rect.Height() +1. )
		);
	
	if( debug )
		Genode::log( "NitPriv.SetGeom-inner: ", inner_rect );
	PDBG( "-- geom x: ", inner_rect.x1(), " to ", inner_rect.x2(), "  y: ", inner_rect.y1(), " to ", inner_rect.y2() );
	
	if( false == inner_rect.valid() )
	{
407
408
409
410
411
412
413











414
415
416
417
418
419
420
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516







+
+
+
+
+
+
+
+
+
+
+








#endif  // ~no-HAS_MICRO_WINDOW_MANAGER



//#pragma mark - InputBridge -


hog::InputBridger * hog::create_in_bri( BWindow & win )
{
	return new hog::InputBridger( win );
}

void hog::destroy_in_bri( hog::InputBridger * ptr )
{
	delete ptr;
}


int hog::InputBridger::forwarding_to_pthread( void * bridger_uncast )
{
	// Forward Input::Events from the Genode signal handler, to the Haiku "world"
	// here where we can call PostMessage() to further convert/forward to BWindow.
	// That cannot all be done in the signal handler itself, because
	// BLooper.PostMessage() makes heavy use of e.g. find_thread(NULL), which
434
435
436
437
438
439
440
441

442
443
444
445
446
447
448
449
450

451
452
453
454
455
456
457
458
459
460

461
462
463
464
465
466
467
530
531
532
533
534
535
536

537
538
539
540
541
542
543
544
545

546
547
548
549
550
551
552
553
554
555

556
557
558
559
560
561
562
563







-
+








-
+









-
+







			//
		
		if( debug >= 6 )
			Genode::warning( "  forwarder: received a task to perform" );
		
		// Mode-Change task
		//
		if( bridger->newMode.area.w() > 0 && bridger->newMode.area.h() > 0 )
		if( bridger->newMode.width > 0 && bridger->newMode.height > 0 )
		{
			Genode::Mutex::Guard
				_( bridger->mutexFwd )
				;
			
			// Tx screen resolution information
			BMessage m( B_SCREEN_CHANGED );
			{
				const BRect r( 0., 0., bridger->newMode.area.w() -1, bridger->newMode.area.h() -1 );
				const BRect r( 0., 0., bridger->newMode.width -1, bridger->newMode.height -1 );
				
				m.AddRect( "frame", r );
				m.AddInt32( "mode",
					B_RGBA32 ///maybe check that newMode.bytes_per_pixel() == 4 ?
					);
			}
			BMessenger( NULL, &bridger->ourWin ).SendMessage( &m );
			
			// Reset
			bridger->newMode = {};
			bridger->newMode = { -1, -1 };
		}
		
		// Input-Event tasks
		//
		for( ;; )
		{
			// sprinkle more tear-down checks for good measure...
504
505
506
507
508
509
510
511
512








513
514
515
516
517
518
519
600
601
602
603
604
605
606


607
608
609
610
611
612
613
614
615
616
617
618
619
620
621







-
-
+
+
+
+
+
+
+
+







// last tweak, move this below the above guard:
if( bridger->tearDownThread ) return 0;//break;
				if( bridger->eventsToForward.empty() )
					//
					break;  // go back to blockade.block()
				
if( bridger->tearDownThread ) return 0;//break;
				ev = bridger->eventsToForward.front();
				bridger->eventsToForward.pop();
				// pop <ev> from the events FIFO
				bridger->eventsToForward.dequeue
				(
					[&] (EvItem & e) {
						ev = e.event;  // 'operator=' seems to work fine
						delete &e;
					}
				);
			}
			
			/*******/
			
#	ifdef HAS_MICRO_WINDOW_MANAGER
			if( bridger->tearDownThread )
				//
574
575
576
577
578
579
580
581
582


583
584
585
586
587
588
589
676
677
678
679
680
681
682


683
684
685
686
687
688
689
690
691







-
-
+
+







	threadId = spawn_thread( input_server_, s, 10, this );
	
	if( threadId >= 0 )
		resume_thread( threadId );
#endif
	// Collect nitpicker events
	//
	win.ServerInput().sigh( inputHandler );
	win.ServerWindow().mode_sigh( dispModeHandler );///.. putting this here since we have the infrastructure here, although it does not really belong here
	win.nitPrivate->Input().sigh( inputHandler );
	win.nitPrivate->ConnectionAndGeom().mode_sigh( dispModeHandler );///.. putting this here since we have the infrastructure here, although it does not really belong here
	
	// Bridge "Genode" world to "libc/pthreads/Haiku" world:
	//
	status_t res = spawn_thread( forwarding_to_pthread, "forward-genode_events-to-haiku",10, this );
	threadId = res;
	if( res < B_OK )
		Genode::error("error: cannot Spawn 'forwarder' thread\n");
823
824
825
826
827
828
829
830

831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847

848
849
850
851
852
853
854
855
856
857
858
859
860
861

862
863
864
865

866

867
868
869
870
871
872
873
925
926
927
928
929
930
931

932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948

949
950
951
952
953
954
955
956
957
958
959
960
961
962

963
964
965
966
967
968

969
970
971
972
973
974
975
976







-
+
















-
+













-
+




+
-
+







	find_thread/pthread_self() won't work, and so on). This must be
	pure Genode code only.
	*/
	
	if( debug >= 5 )
		Genode::log( "..Inputbridger.handleInput()" );
	
	ourWin.ServerInput().for_each_event(
	ourWin.nitPrivate->Input().for_each_event(
		[&] ( Input::Event const & ev )
		{
#if 0
			must have only pure Genode code here, no haiku code !
#	ifdef HAS_MICRO_WINDOW_MANAGER
			// Nitpicker : geometry (move/pull-to-front/push-back)
			winManager.HandleEvent( ev, curScreenWhere, curButtons );
#	endif
			
			// BWindow/BView : generate B_MOUSE_DOWN, B_MOUSE_MOVED, etc
			handleOneEvent( ev );
#else
			// delegate all the heavy lifting to the "pthread" thread:
			{
				Genode::Mutex::Guard _( mutexFwd );
				
				eventsToForward.push( ev );  // copy ctor seems to work fine
				eventsToForward.enqueue( *new EvItem(ev) );  // copy ctor seems to work fine
			}
			greenlightForwarder.wakeup();
#endif
		}
	);
	
	if( debug >= 5 )
		Genode::log( "..~Inputbridger.handleInput() *Done*" );
}

void hog::InputBridger::handleDisplayMode()
{
	if( debug >= 3 )
		Genode::log( "handleDisplayMode got mode: ", ourWin.ServerWindow().mode() );
		Genode::log( "handleDisplayMode got mode: ", ourWin.nitPrivate->ConnectionAndGeom().mode() );
	
	{
		Genode::Mutex::Guard _( mutexFwd );
		
		Framebuffer::Mode new_mode = ourWin.nitPrivate->ConnectionAndGeom().mode();
		newMode = ourWin.ServerWindow().mode();
		newMode = BSize( new_mode.area.w, new_mode.area.h );
	}
	greenlightForwarder.wakeup();
}



void hog::InputBridger::handleOneEvent(

Changes to genode-haiku/haiku-on-genode/kits/interface/_WindowNitpickerPriv.h.

1
2
3
4
5
6
7
8
9
10
11
12

13
14

15
16
17


18
19
20
21
22
23
24

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
1
2
3
4
5
6
7
8




9


10



11
12
13
14
15
16

17

18







































































19
20
21
22
23
24
25








-
-
-
-
+
-
-
+
-
-
-
+
+




-

-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-







/*
 * Copyright 2018-2024, ttcoder of TTS-LLC
 * All rights reserved. Distributed under the terms of the MIT license.
 */
#ifndef _WindowNitpickerPriv_H
#define _WindowNitpickerPriv_H


// libstdc++
#include <queue>  // member

// genode
// genode/base.a
//#include <base/entrypoint.h>

#ifdef HAS_MICRO_WINDOW_MANAGER
// haiku.lib.so
#include "_CanvasGenode.h"  // member
#include <app/Application.h>
#include <input_session/connection.h>  // Input::Event
#endif


namespace hog {
	//class MouseState;
	class InputBridger;
	class Wm;
	
}
	///ToDo: create "_GeInput.h" and move these there:
	namespace conv_input {
		int HaikuKey_for_GeKey(
			const	Input::Keycode genode_scancode,
					int32 & changed_disambiguated_modifier
			);
		int ModifiedKey_for_RawBeKey(
			int raw_be_key,
			int virtualized_modifiers
			);
	}
	
	//+ NitpickerInternals !
}



//#pragma mark


struct NitpickerInternals
{
public:

		NitpickerInternals( BBitmap * paint_offscreen = NULL );
		
		CanvasGenode & Canvas(); //+ "PaintingSurface" ?
		Input::Session_client & Input();
		
		void Create_Bare_Window();
		void Destroy_Bare_Window();
		void Set_Title( const char * title );
		void To_Front();
		void To_Back();
		void Background();
		void SetClientGeometry( Gui::Rect inner_rect );
			///++ "SetInnerGeometry( Rect inner_rect ) !
		
#if defined( HAS_MICRO_WINDOW_MANAGER )
		Gui::Connection & ConnectionAndGeom();//nah!: ///+ "DecoratedGeom" ?
		void Set_ClientSide_Decorations(
			BRect inner_frame,
			BRect tab_frame,
			float border_thickness
			);
#endif


private:  // Code

		void reGeom(   Gui::Rect inner_rect );
		void reBuffer( Gui::Rect inner_rect );


private:  // Data

		Gui::Connection //*
			nitpicker;
		CanvasGenode //*
			geCanvas;
		
		// We'll call create_view() and destroy_view() on the session:
//actually it works just as well to call the Connection above
//instead of this Session! Delete this?:
//		Nitpicker::Session_client &
//			_nitpicker;  //+++ managerWindow
		// A window handle is named a * "view" * handle in NitPicker:
		Gui::Session::View_handle //*
			_handle; //+ "bareWindow" or "undecoratedWindow" ?
			// + windowHandle !
};



//#pragma mark -


/*
123
124
125
126
127
128
129
130

131
132
133
134
135
136
137
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60







-
+









#ifdef HAS_MICRO_WINDOW_MANAGER

class hog::Wm
{
	// A microscopic "window manager", so that our (Be-style) windows can be moved
	// and closed even though they interact only with Nitpicker (but not with Wm)
	// and closed even though they interact only with Nitpicker (but not with the true Genode/MOTIF Wm)
	// and draw their own window decorations.
	
public:
		Wm( BWindow & win );
		
		void HandleEvent(
			const Input::Event & ev,
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
69
70
71
72
73
74
75
76
77


































































78
79









-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-


		
		bool isDragging;  // if true, we're moving the window with the below hot-spot
		BPoint trackWithHot;
};

#endif  // ~HAS_MICRO_WINDOW_MANAGER




class hog::InputBridger
{
public:
		InputBridger( BWindow & win );
		~InputBridger();
		
	//static int input_server_( void * data );
		void eventLoop();
		
		void handleInput();
		void handleDisplayMode();


private:  // Code

		void handleOneEvent(
			const Input::Event & ev
			);
		BMessage mouseDown( int32 button );
		BMessage mouseUp( int32 button );
		BMessage keyDownOrUp(
			const Input::Keycode genode_key,
			const bool latch_down );
		
	static int forwarding_to_pthread( void * bridger_uncast );


private:  // Data

		// Tx -- for pushing to PostMessage() and access to ServerWindow()
		BWindow & ourWin;
		
		// State --
		// double-click detection state
		bigtime_t latestClick;  // last time any button (left, right, etc) was pressed down, in support of mouseDown()
		// current state, previously in struct "MouseState":
		BPoint curScreenWhere;
		int32  curButtons;
		
		// distinct thread, to separate Genode-context and LibC-context code,
		// communicating through a mutex'ed std::queue:
		//
		thread_id threadId;
		Genode::Entrypoint localEp;  // Genode thread dedicated to the sigh
		// Rx -- let Genode push events to us
		Genode::Signal_handler<InputBridger>
			inputHandler;
		Genode::Signal_handler<InputBridger>
			dispModeHandler;
		
		// shared between our <ep> Genode-thread and <forwarder> pthread
		//
		Genode::Blockade greenlightForwarder;
		Genode::Mutex mutexFwd;
		std::queue< Input::Event > eventsToForward;
		Framebuffer::Mode  newMode;
		bool tearDownThread;  // set to <true> to signal function forwarding_to_pthread() to end its thread
		
#ifdef HAS_MICRO_WINDOW_MANAGER
		Wm winManager;
#endif  // ~HAS_MICRO_WINDOW_MANAGER
};



#endif // _WindowNitpickerPriv_H

Changes to genode-haiku/haiku-on-genode/system/kinda-kernel/api-public_main.cpp.

366
367
368
369
370
371
372
373
374


375
376
377
378
379
380
381
366
367
368
369
370
371
372


373
374
375
376
377
378
379
380
381







-
-
+
+







	
	// generate report
	reporter.enabled( true );
	reporter.clear();
	if( reboot )
		Genode::Reporter::Xml_generator xml( reporter, [&] ()
		{
			// This may be handled by pc_platform_drv or ps2_drv (or even acpica) : we follow the example of SculptOS and route to it for best compatibility (indeed, ps2_drv reset works on older thinkpads, unlike acpica).
			// REQUIRES: pc_platform_drv/ps2_drv must get 1) "system" ROM updates, and 2) "acpi" ROM updates, or risk failing silently to reset.
			// This may be handled by pc_platform(_drv) or ps2(_drv) (or even acpica) : we follow the example of SculptOS and route to it for best compatibility (indeed, ps2 reset works on older thinkpads, unlike acpica).
			// REQUIRES: pc_platform(_drv)/ps2(_drv) must get 1) "system" ROM updates, and 2) "acpi" ROM updates, or risk failing silently to reset.
			xml.attribute( "state", "reset" );
		});
	else
		Genode::Reporter::Xml_generator xml( reporter, [&] ()
		{
			// This is handled by acpica.
			// REQUIRES: acpica must get "system" ROM updates.
390
391
392
393
394
395
396
397

398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416

417
418
419
420
421
422
423
390
391
392
393
394
395
396

397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415

416
417
418
419
420
421
422
423







-
+


















-
+








extern "C" {

status_t _kern_suspend_to_ram()
{
	Genode::log( "==> _kern_suspend_to_ram()" );
	
	///later: "Suspend" works in qemu, but not on metal... Dig into intel_fb_drv/platform/etc, or wait for newer Genode ?
	///later: "Suspend" works in qemu, but not on metal... Dig into intel_fb(_drv)/platform/etc, or wait for newer Genode ?
	/*
		Status:
		- incomplete implementation, early experimental support only
		- disabled in _kapm_control_() -- change its return code to 0 to enable the feature, a "Suspend" menu item will show up in Deskbar.
		
		Details:
		This only works in Qemu. On bare metal, the computer does "suspend", but
		fails to "resume" completely. So with Genode 23.05 there's little room left for digging, and only so
		with intel-based laptops : better wait until newer releases "blaze the way".
		Once the feature does work with Vesa etc, will do further work on this, do proper pre-suspend shutdown
		of drivers-init with a report_rom (not with a dynamic_rom!) and post-resume
		reinitialization with a report_rom (also not with a dynamic_rom!) etc.
		
		Alexander B. at Genode Labs:
		> (..)
		> For Intel graphic devices we have a, in principal capable driver, to do 
		> the job, so intel_fb and intel_gpu works on some systems. By restarting 
		> them, they initialize the hardware again into a usable state.
		> In contrast, vesa_drv or boot_fb expects that someone (e.g. Bios/UEFI) 
		> In contrast, vesa_fb or boot_fb expects that someone (e.g. Bios/UEFI) 
		> did the job of setting up the hardware, which is not the case after ACPI 
		> resume (as far as I can tell).
		> (..)
		> So for now, I think you should consider this feature experimental, as 
		> you guessed already.
	*/
	

Changes to genode-haiku/hog-apps/drivesetup_gpt/Jamfile.

13
14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28
29
30
31
32

33
34
35
36
37
38
39
40







-
+












-
+









#
# Test-run in Qemu  (invoke with "jam hog-drivesetup-gpt.emu6")
#

AddInteractiveComponents	hog-drivesetup-gpt.run ;
AddComponentService			hog-drivesetup-gpt.run : 1M : rtc_drv : Rtc ;
AddComponentService			hog-drivesetup-gpt.run : 1M : pc_rtc : Rtc ;
AddComponentAsStart			hog-drivesetup-gpt.run : 4M : report_rom :
		"name=\"storage_report_rom\" caps=\"120\"" :
	"	<binary name=\"report_rom\"/>
	\		<provides> <service name=\"Report\"/> <service name=\"ROM\"/> </provides>
	\		<config verbose=\"yes\">
	\			<policy label_prefix=\"PartitionSetupGPT -> partitions\"	report=\"part_block -> partitions\"/>
	\		</config>
	"
	;

AddComponentService  hog-drivesetup-gpt.run
	: 2M
	: ahci_drv
	: ahci  # was: ahci_drv
	: Block
	: "<config>
			<default-policy device=\"0\" writeable=\"yes\" />
#			<default-policy device=\"0\" writeable=\"no\" />
		</config>
		"
	;
50
51
52
53
54
55
56
57

58
59
60

61
62

63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
50
51
52
53
54
55
56

57
58
59

60
61

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

83
84
85
86
87
88
89
90







-
+


-
+

-
+




















-
+







##	\				<add entry=\"1\" type=\"BIOS\"  label=\"GRUB BIOS\"  start=\"2048\"  size=\"1M\"/>
#	\				<add           type=\"BDP\"   label=\"FAT32 Data\" size=\"max\"/>
##	\				<modify label=\"GENODE\" new_label=\"GENODE*\" new_size=\"max\"/>
#	\			</actions>
# 	\		</config>
#	\		<route>
#		# route "Block" toward AHCI_drv, not to sub-partition of drive #
#		# - ahci_drv is withing "use drv manager" sub-init...
#		# - ahci(_drv) is within "use drv manager" sub-init...
#		# - part_block, however, is separate, right ?
#	\			<service name=\"Block\">
#						# use label " default" (instead of "ahci-0" or "ahci-1" etc), so that ahci_drv will be called (by driver_manager) with either port 0 or 1 or 2... dynamically
#						# use label " default" (instead of "ahci-0" or "ahci-1" etc), so that ahci(_drv) will be called (by driver_manager) with either port 0 or 1 or 2... dynamically
#	\				<child name=\"drivers_init\" label=\"basic-layers: default\" />  <!-- for the USE_DRV_MANAGER case ; careful to preserve the whitespace in ' default' (see main.cc:399) -->
#	\				<child name=\"ahci_drv\" />  <!-- for the 'static drivers' case -->
#	\				<child name=\"ahci\" />  <!-- for the 'static drivers' case -->
#	\			</service>
# 	\			<any-service> <parent/> <any-child/> </any-service>
#	\		</route>
#	"
#	;

#AddComponentService  hog-drivesetup-gpt.run : 10M :
#	part_block : Block
#	: "
#	\		<config use_gpt=\"yes\" io_buffer=\"4M\"  >
#	\			<report partitions=\"yes\"/>
#		#no need, we're only interested in the report, not in accessing the partitions themselves:
#		#	\			<default-policy partition=\"1\" writeable=\"no\"/>
#	\		</config>
#	\		<route>
#	\			<service name=\"Report\"> <child name=\"storage_report_rom\"/> </service>
#					# Handle both USE_DRV_MANAGER and 'static' drivers cases
#					# Careful to preserve the whitespace in " default" here:
#	\			<service name=\"Block\">
#	\				<child name=\"drivers_init\" label=\"ahci: default\" />
#	\				<child name=\"ahci_drv\" />
#	\				<child name=\"ahci\" />
#	\			</service>
#	\			<any-service> <parent/> <any-child/> </any-service>
#	\		</route>
#	"
#	;

Config_Vfs on hog-drivesetup-gpt.run +=

Changes to genode-haiku/hog-services/broker/Jamfile.

18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
18
19
20
21
22
23
24

25
26
27
28
29
30
31
32







-
+







	_test_client.cpp
	;


###############  Test Scénario: hog-broker.run  #################

#AddInteractiveComponents  hog-broker.run ;
# Optim/scale down to "minimum plus" (disable vesa_fb_drv etc), so as to shave a second of build time:
# Optim/scale down to "minimum plus" (disable vesa_fb etc), so as to shave a second of build time:
AddMinimumComponents  hog-broker.run ;
local libs_list =
		haiku.lib.so
		libc.lib.so
		libm.lib.so
		stdcxx.lib.so
		vfs.lib.so

Changes to genode-haiku/hog-services/indexer/Jamfile.

47
48
49
50
51
52
53
54

55
56
57
58
59
60
61
62
63
64

65
66
67
68
69
70
71
47
48
49
50
51
52
53

54
55
56
57
58
59
60
61
62
63

64
65
66
67
68
69
70
71







-
+









-
+







#	vfs_foo.a : $(objs) ;



###############  Scénario: hog-people.run  #################

AddInteractiveComponents	hog-people.run ;
AddComponentService			hog-people.run : 1M : rtc_drv : Rtc ;
AddComponentService			hog-people.run : 1M : pc_rtc : Rtc ;

IndexerTest_NTFS_IMAGE =
	/tmp/hog_IndexerTest_disk_image.raw
	;
DiskNtfsBlank
	$(IndexerTest_NTFS_IMAGE)
	;
AddComponentService  hog-people.run
	: 2M
	: ahci_drv
	: ahci  # was: ahci_drv
	: Block
	: "<config>
			<policy label_prefix=\"\" device=\"0\" writeable=\"yes\" />
		</config>
		"
	;

Changes to genode-haiku/hog-services/indexer/README.md.

102
103
104
105
106
107
108
109

110
111
112
113
114
102
103
104
105
106
107
108

109
110
111
112
113
114







-
+






oval "lib-ntfs-3g" fit
arrow "via" aligned "libc" aligned

oval "Block dev" fit
arrow

oval "ahci_drv" fit
oval "ahci" fit

~~~



Changes to genode-haiku/jam/jamrules-pkg-versions.

1
2
3
4


5
6

7
8
9
10
11
12
13
1
2
3
4
5
6
7

8
9
10
11
12
13
14
15




+
+

-
+








# === Contrib folder IDs ===

# -- grub2 --
# Genode 24.08
Contrib_grub2 = grub2-8c6a21b5e837a9491ebcb21611f5f865411544f5 ;
# Genode 23.02
Contrib_grub2 = grub2-80d41dfe8a1d8d8a80c51f446553b7d28c3ce395 ;
#Contrib_grub2 = grub2-80d41dfe8a1d8d8a80c51f446553b7d28c3ce395 ;
# Genode 22.11
#Contrib_grub2 = grub2-aae6a9ce3485b9fe5c589817e4cfc80b199d8e11 ;
# Genode 20.08
#Contrib_grub2 = grub2-856f9946a1482cbebc519818e3e4736bcd11e5e4 ;
# Genode ~18.11
#Contrib_grub2 = grub2-8cf62c015199b37018676d8c13be026989724a4b ;

Changes to genode-haiku/jam/jamrules-qemu.

387
388
389
390
391
392
393
394

395
396
397
398
399

400
401
402
403
404
405
406
387
388
389
390
391
392
393

394
395
396
397
398

399
400
401
402
403
404
405
406







-
+




-
+







		
		#echo ...SEARCH $(_s) .. [ GetTargetVar $(_s) : SEARCH ] ;
	}
	
	# special cases: these 3 files are hardcoded, and get *renamed* as
	# they are copied, so we cannot use "rule Bulk":
	SoftLink $(ldlib) : ld-nova.lib.so ;
	SoftLink $(timer) : nova_timer_drv ;
	SoftLink $(timer) : nova_timer ;  # was: "nova_timer_drv"
#	File $(configfile) : $(scenario).config ;
ConfigFile $(configfile) ;  # uses target-local "CONFIG" variable for text payload
Always $(configfile) ;  # xx We could dodge this "always": detect changes in $(CONFIG) vs file contents ? Won't be trivial...
	SEARCH on ld-nova.lib.so += $(GenodeBuild)/bin ;
	SEARCH on nova_timer_drv += $(GenodeBuild)/bin ;
	SEARCH on nova_timer	+= $(GenodeBuild)/bin ;
#	SEARCH on $(scenario).config  += $(GenodeBuild)/var/run ;
	Depends $(core) : $(ldlib) $(timer) $(configfile) ;
	MakeLocate $(timer) $(ldlib) $(configfile) : $(GenodeBuild)/var/run/$(scenario)_genode ;
}


#rule SoftLink
588
589
590
591
592
593
594
595

596
597

598
599
600

601
602
603
604


605
606
607

608
609
610
611
612
613
614
588
589
590
591
592
593
594

595
596

597
598
599

600
601
602


603
604
605
606

607
608
609
610
611
612
613
614







-
+

-
+


-
+


-
-
+
+


-
+







	{
		# drv manager
		AddBootModule $(runfile) : driver_manager ;
#+///ToDo: clean-up jam/* re. "drivers_init" blocks ? Maybe do "Jamrules" cleanup too.. and AddMediaStack cleanup
		AddBootModule $(runfile) : drivers.config ;  # repos/gems/sculpt/drivers/pc, aka drivers.config
		
		# hal
		AddBootModule $(runfile) : acpi_drv ;
		AddBootModule $(runfile) : acpi ;  # was: "acpi_drv"
		AddBootModule $(runfile) : pci_decode ;
		AddBootModule $(runfile) : pc_platform_drv ;
		AddBootModule $(runfile) : pc_platform ;  # was: "pc_platform_drv"
		
		# drivers
		AddBootModule $(runfile) : vesa_fb_drv ;
		AddBootModule $(runfile) : vesa_fb ;
		AddBootModule $(runfile) : pc_intel_fb_drv ;
		AddBootModule $(runfile) : intel_gpu_drv ;  # intel_fb cannot work without intel_gpu (gpu serves as "Platform" service for fb)
		AddBootModule $(runfile) : boot_fb_drv ;    # driver_manager might select this one on some devices, if Platform mandates it
		AddBootModule $(runfile) : ahci_drv ;
		AddBootModule $(runfile) : boot_fb ;        # driver_manager might select this one on some devices, if Platform mandates it
		AddBootModule $(runfile) : ahci ;
		AddBootModule $(runfile) : pc_usb_host_drv ;
		AddBootModule $(runfile) : usb_hid_drv ;
		AddBootModule $(runfile) : ps2_drv ;
		AddBootModule $(runfile) : ps2 ;
		
		# glue
		AddBootModule $(runfile) : event_filter ;
		AddBootModule $(runfile) : event_filter.config ;
		AddBootModule $(runfile) : rom_reporter ;
		
		#/// maybe also: priority="-1" (like in sculpt.run) ?
758
759
760
761
762
763
764
765
766


767
768
769
770
771
772
773
758
759
760
761
762
763
764


765
766
767
768
769
770
771
772
773







-
-
+
+







		\		</route>
		\	</start>
			"
			;
	}
	else  # do not USE_DRV_MANAGER:
{
	AddComponent $(runfile) : acpi_drv : "
	\	<start name=\"acpi_drv\"  caps=\"400\" >
	AddComponent $(runfile) : acpi : "
	\	<start name=\"acpi\"  caps=\"400\" >
	\		<resource name=\"RAM\" quantum=\"4M\"/>
	\		<config report=\"yes\" />  <!-- To report on S3 level support... -->
	\		<route>
#	\			<service name=\"LOG\"> $(LogOutput_Terminal_or_Serial) </service>
#	\			<service name=\"LOG\">    <parent/> </service>
	\			<service name=\"LOG\"> <child name=\"term_app_log\"/> <parent/> </service>
	\			<service name=\"IO_MEM\"> <parent/> </service>
789
790
791
792
793
794
795
796

797
798
799
800
801
802
803
804
805
806



807
808
809
810
811
812
813
814
815
816
817


818
819
820
821
822
823
824
825
826
827
828
829
830
831
832

833
834
835
836
837


838
839
840
841
842


843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861

862
863

864
865
866
867
868
869
870
789
790
791
792
793
794
795

796
797
798
799
800
801
802
803



804
805
806
807
808
809
810
811
812
813
814
815


816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831

832
833
834
835


836
837
838
839
840


841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860

861
862

863
864
865
866
867
868
869
870







-
+







-
-
-
+
+
+









-
-
+
+














-
+



-
-
+
+



-
-
+
+


















-
+

-
+







	
	AddComponent $(runfile) : pci_decode : "
	\	<start name=\"pci_decode\"  caps=\"350\" >
	\		<resource name=\"RAM\" quantum=\"1M\"/>
	\		<route>
	\			<service name=\"LOG\"> <child name=\"term_app_log\"/> <parent/> </service>
	\			<service name=\"Report\">               <child name=\"report_rom\"/> </service>
	\			<service name=\"ROM\" label=\"system\"> <child name=\"report_rom\"/> </service>  <!-- pci_decode seems to require 'system', an alias for 'acpi_drv -> acpi', not to be confused with the 'system=reset/poweroff' ROM... -->
	\			<service name=\"ROM\" label=\"system\"> <child name=\"report_rom\"/> </service>  <!-- pci_decode seems to require 'system', an alias for 'acpi(_drv) -> acpi', not to be confused with the 'system=reset/poweroff' ROM... -->
	\			<any-service> <parent/> <any-child/> </any-service>
	\		</route>
	\	</start>
	"
		;
	
	# "managing_system" is necessary, otherwise we get "Device PD: attach_dma denied"
	AddComponent $(runfile) : pc_platform_drv : "
	\	<start name=\"platform_drv\"  caps=\"400\"  managing_system=\"yes\">
	\		<binary name=\"pc_platform_drv\"/>
	AddComponent $(runfile) : pc_platform : "
	\	<start name=\"platform\"  caps=\"400\"  managing_system=\"yes\">
	\		<binary name=\"pc_platform\"/>
	\		<resource name=\"RAM\" quantum=\"6M\"/>
	\		<provides>
	\			<service name=\"Platform\"/>
	\		</provides>
	\		<route>
	\ 			<service name=\"LOG\"> $(LogOutput_Terminal_or_Serial) </service>
	\			<service name=\"ROM\" label=\"system\">	<child name=\"platform_report_rom\"/> </service>
	\				<!-- feed a dummy 'sleep_states' here in static paradigm, it's only in USE_DRV_MANAGER mode that we'll (attempt to) support S3 suspend: -->
	\			<service name=\"ROM\" label=\"sleep_states\"> <child name=\"rom_filter\" label=\"sleep_states\"/> </service>
	\			<service name=\"ROM\" label=\"acpi\">	<child name=\"report_rom\"/> </service>  <!-- for pc_platform_drv to get 'acpi reset via such and such port' info -->
	\				<!-- careful with 'devices' ROM, if not present and set to 'report_rom', ahci_drv SILENTLY gets stuck -->
	\			<service name=\"ROM\" label=\"acpi\">	<child name=\"report_rom\"/> </service>  <!-- for pc_platform(_drv) to get 'acpi reset via such and such port' info -->
	\				<!-- careful with 'devices' ROM, if not present and set to 'report_rom', ahci(_drv) SILENTLY gets stuck -->
					# if I use rom_filter, PS/2 works but AHCI fails
					# if I use report_rom, AHCI works but PS/2 fails
					# Fixed! Was missing a "policy" in report_rom... (via rom_filter, which I now use):
	\			<service name=\"ROM\" label=\"devices\"> <child name=\"rom_filter\"/> </service>
		#?		<service name=\"Report\" label=\"iommu\">	<parent label=\"iommu\"/> </service>
	\			<service name=\"Report\"> <child name=\"report_rom\"/> </service>
	\			<any-service> <parent/> <any-child/> </any-service>
	\		</route>
			"
				# -- split string to dodge Jam crash --
			"
	\		<config>
	\			<report devices=\"yes\" iommu=\"yes\"/>
	\			
	\			<policy label_prefix=\"ps2_drv\">  <device name=\"ps2\"/> </policy>
	\			<policy label_prefix=\"ps2\">  <device name=\"ps2\"/> </policy>  <!-- was: label prefix ps2_drv -->
\	<policy label_suffix=\"-> nic\"	info=\"yes\">	<pci class=\"ETHERNET\"/> </policy>
\	<policy label_prefix=\"sequence -> nic_drv\"	info=\"yes\">	<pci class=\"ETHERNET\"/> </policy>
	\			<policy label_prefix=\"nic_drv\"	info=\"yes\">	<pci class=\"ETHERNET\"/> </policy>
	\			<policy label_prefix=\"fb_drv\"      info=\"yes\">   <pci class=\"VGA\"/> </policy>
	\			<policy label_prefix=\"vesa_fb_drv\" info=\"yes\">   <pci class=\"VGA\"/> </policy>
	\			<policy label_prefix=\"fb_drv\"     info=\"yes\">   <pci class=\"VGA\"/> </policy>
	\			<policy label_prefix=\"vesa_fb\"    info=\"yes\">   <pci class=\"VGA\"/> </policy>
#	\	<policy label_prefix=\"drivers_init\" info=\"yes\"> <pci class=\"VGA\"/> </policy>
	\			<policy label_prefix=\"wifi_drv\" info=\"yes\"> <pci class=\"WIFI\"/> </policy>
	\			<policy label_prefix=\"usb_host_drv\" info=\"yes\">  <pci class=\"USB\"/> </policy>
	\			<policy label_prefix=\"ahci_drv\"> <pci class=\"AHCI\"/> </policy>
	\			<policy label_prefix=\"nvme_drv\"> <pci class=\"NVME\"/> </policy>
	\			<policy label_prefix=\"ahci\"> <pci class=\"AHCI\"/> </policy>
	\			<policy label_prefix=\"nvme\"> <pci class=\"NVME\"/> </policy>
	\			<policy label_prefix=\"audio_drv\"> <pci class=\"AUDIO\"/> <pci class=\"HDAUDIO\"/> </policy>
	\			<policy label_prefix=\"intel_fb_drv\" info=\"yes\">
	\				<pci class=\"VGA\"/>
	\				<pci class=\"ISABRIDGE\"/>
	\			</policy>
	\			<policy label_prefix=\"intel_gpu_drv\" info=\"yes\">
	\				<pci class=\"VGA\"/>
	\				<pci class=\"ISABRIDGE\"/>
	\			</policy>
	\			<policy label_prefix=\"acpica\"> <device name=\"acpi\"/> </policy>
	\		</config>
	\	</start>
		"
		;

	# Genode support: input device drivers
	#
	# Platform support for ps/2 devices etc
	AddBootModule  $(runfile) : devices ;  # "base/board/pc/devices" xml file with IRQ/IO range for ps/2, and infos for platform_drv
	AddBootModule  $(runfile) : devices ;  # "base/board/pc/devices" xml file with IRQ/IO range for ps/2, and infos for driver/platform(_drv)
	#
	# Platform support for pc_platform_drv, ps/2 devices etc
	# Platform support for pc_platform, ps/2 devices etc
	AddComponentService  $(runfile) : 1M : rom_filter : ROM : "
	\	<config buffer=\"32K\">
	\		<input name=\"devices\"/>
	\		<input name=\"pci_devices\"/>
	\		<output node=\"devices\">
	\			<input name=\"devices\"     skip_toplevel=\"yes\"/>
	\			<input name=\"pci_devices\" skip_toplevel=\"yes\"/>
878
879
880
881
882
883
884
885

886
887

888
889

890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907

908
909
910


911
912
913
914
915
916
917
878
879
880
881
882
883
884

885
886

887
888

889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906

907
908


909
910
911
912
913
914
915
916
917







-
+

-
+

-
+

















-
+

-
-
+
+







	\		<any-service> <parent/> <any-child/> </any-service>
	\	</route>
		"
		;
	AddComponentService $(runfile) : 4M : report_rom : Report ROM : "
	\		<config verbose=\"no\">
	\	<policy label_prefix=\"to_whom_it_may_concern\" report=\"mixer -> channel_list\"/>
	\			<policy label=\"pci_decode -> system\"		report=\"acpi_drv -> acpi\"/>
	\			<policy label=\"pci_decode -> system\"		report=\"acpi -> acpi\"/>  <!-- was 'acpi_drv..acpi' -->
	\			<policy label=\"rom_filter -> pci_devices\"	report=\"pci_decode -> devices\"/>
	\			<policy label=\"platform_drv -> devices\"	report=\"pci_decode -> devices\"/>
	\			<policy label=\"platform -> devices\"		report=\"pci_decode -> devices\"/>  <!-- was 'platform_drv' -->
		# These are needed in static-drivers mode(?):
	\			<policy label=\"platform_drv -> acpi\"		report=\"acpi_drv -> acpi\"/>
	\			<policy label=\"platform -> acpi\"             report=\"acpi -> acpi\"/>  <!-- was 'platform_drv...' 'acpi_drv...' -->
	\			<policy label=\"status_bar -> focus\"          report=\"nitpicker -> focus\"/>
	\			<policy label=\"nitpicker_config -> xray\"     report=\"global_keys_handler -> xray\"/>
	\			<policy label=\"global_keys_handler -> hover\" report=\"nitpicker -> hover\"/>
	\			<policy label=\"nit_focus -> clicked\"         report=\"nitpicker -> clicked\"/>
	\			<policy label=\"nitpicker -> focus\"           report=\"nit_focus -> focus\"/>
	\		</config>
		"
		;
	}  # ~USE_DRV_MANAGER .............................
	
	# Common
	#
	AddComponentAsStart  $(runfile) : 4M : report_rom :
			"name=\"platform_report_rom\" caps=\"120\"" :
		"	<binary name=\"report_rom\"/>
		\		<provides> <service name=\"Report\"/> <service name=\"ROM\"/> </provides>
		\		<config verbose=\"yes\">
		\				<!-- Only registrar is allowed to send Power-Off/Suspend/Reset to acpica/ps2_drv/platform_drv -->
		\				<!-- Only registrar is allowed to send Power-Off/Suspend/Reset to acpica/ps2/platform -->
		\			<policy label_prefix=\"acpica\"			report=\"registrar -> system\"/>
		\			<policy label_prefix=\"ps2_drv\"		report=\"registrar -> system\"/>
		\			<policy label_prefix=\"platform_drv\"	report=\"registrar -> system\"/>
		\			<policy label_prefix=\"ps2\"			report=\"registrar -> system\"/>  <!-- was: ps2_drv -->
		\			<policy label_prefix=\"platform\"		report=\"registrar -> system\"/>  <!-- was pc_platform_drv -->
		\			<policy label_prefix=\"drivers_init\"	report=\"registrar -> system\"/>
		\		</config>
		"
		;
}


972
973
974
975
976
977
978
979

980
981
982
983
984
985
986
972
973
974
975
976
977
978

979
980
981
982
983
984
985
986







-
+







}


# Mandatory params:
#	- runfile, e.g. "test.run", from which we'll derive image name "test.iso"
# Optional params:
#	- ahci_disk_image: e.g. "/tmp/test_ntfs_image.raw"
#	(a disk image for Qemu to provide as a block device to e.g. ahci_drv)
#	(a disk image for Qemu to provide as a block device to e.g. driver/ahci(_drv))
#
rule RunQemu  runfile : ahci_disk_image
{
	local scenario = $(runfile:B) ;
	NotFile $(scenario) ;  # silences e.g. "warning: using independent target hog-demos"
	
	#++fix "warning: indep target ld.lib.so"... maybe similar to this?:

Changes to genode-haiku/jam/jamrules-qemu-hog.

39
40
41
42
43
44
45
46

47
48
49
50
51
52
53
54
55
56
57
58

59
60
61
62
63
64
65
39
40
41
42
43
44
45

46
47
48
49
50
51
52
53
54
55
56
57

58
59
60
61
62
63
64
65







-
+











-
+







	# Haiku libraries and their (libc et al) dependencies
	#
	AddHaikuDepLibs $(runfile) ;
	
	
	# Capture Gui, render to VESA framebuffer
	#
	# resolution: without a configured one, vesa_fb_drv will use the native resolution it seems.
	# resolution: without a configured one, vesa_fb will use the native resolution it seems.
	# (on qemu, oddly, it is 2560x1600@32)
	# That only works on (my) laptops though:
	# F2A55 and ThinkCentre M73 go "black screen" if no resolution is specified (unlike laptops)... So hardcode something:
# On laptops, either of these can come in handy:
#		: "\		<config buffered=\"yes\" />"
#		: "\		<config buffered=\"yes\" width=\"1280\" height=\"800\" />"
if ! $(USE_DRV_MANAGER)
{
if ! "NO_fb_DRIVER" in $(extra_options)
{
	AddComponentAsStart $(runfile) : 59M  #xxxx
		: vesa_fb_drv : "name=\"vesa_fb_drv\" caps=\"150\""
		: vesa_fb : "name=\"vesa_fb\" caps=\"150\""
		: "\		<config buffered=\"yes\" width=\"1024\" height=\"768\" />
	\	<route>
	\		<service name=\"Capture\"> <child name=\"nitpicker\"/> </service>
	\		<any-service> <parent/> <any-child/> </any-service>
	\	</route>
		"
		;
118
119
120
121
122
123
124
125

126
127
128
129
130
131
132
118
119
120
121
122
123
124

125
126
127
128
129
130
131
132







-
+







	
if ! $(USE_DRV_MANAGER)
{
	# PS/2:
	#
if ! "NO_ps2_DRIVER" in $(extra_options)
{
	AddComponentClient $(runfile) : 2M : ps2_drv :  # config: set attribute "system=yes" so that ps2_drv will watch for "reset" ROM change and trigger a reset (useful when ACPI reset refers to a reserved/inaccessible port, see ticket #2726)
	AddComponentClient $(runfile) : 2M : ps2 :  # config: set attribute "system=yes" so that ps2 will watch for "reset" ROM change and trigger a reset (useful when ACPI reset refers to a reserved/inaccessible port, see ticket #2726)
	"
	\	<config system=\"yes\"
	\		verbose_keyboard=\"no\"
	\		verbose_mouse=\"no\"
	\		verbose_scancodes=\"no\"
	\		/>
	\	<route>
743
744
745
746
747
748
749
750

751
752
753
754
755
756
757
743
744
745
746
747
748
749

750
751
752
753
754
755
756
757







-
+







	\				<!-- Support specific to GeDepot: -->
	\			<service name=\"Report\" label=\"dyn/GeDepot -> installation_for_manager\">
	\				<child name=\"dynit_report_rom\" label=\"dynit -> installation_for_manager\" />
	\			</service>
	\				<!-- Support specific to part_block: -->
	\			<service name=\"Block\" label=\"dyn/part_block -> \">
	\				<child name=\"drivers_init\" label=\"ahci: default\" />
	\				<child name=\"ahci_drv\" />
	\				<child name=\"ahci\" />  <!-- was: ahci_drv -->
	\			</service>
	\			<service name=\"Report\" label=\"dyn/part_block -> partitions\">
	\				<child name=\"storage_report_rom\" label=\"part_block -> partitions\"/>
	\			</service>
##	\			<service name=\"Report\"> <child name=\"dynit_report_rom\"/> </service>
					# wildcard: just set "label_prefix='' (empty string)"...
					# UPD: what we *really* want is to map /foo/something, NOT the boot-modules ROMs ! So distinguish between those slash-less or not:

Changes to genode-haiku/misc-apps/Jamfile.

1
2
3
4
5
6
7
8
9
10
11

12
13
14
15
16
17
18
1
2
3
4
5
6
7
8
9
10

11
12
13
14
15
16
17
18










-
+







SubDir TOP misc-apps ;



###############  Scénario: hog-demos.run  #################

AddInteractiveComponents
	hog-demos.run
	;
AddComponentService
	hog-demos.run : 1M : rtc_drv : Rtc
	hog-demos.run : 1M : pc_rtc : Rtc
	;

if $(HAS_GENODE_BACKDROP)
{
	AddRawComponent     hog-demos.run : libpng.lib.so : libpng.lib.so ;
	AddRawComponent     hog-demos.run : zlib.lib.so : zlib.lib.so ;
	AddComponentService hog-demos.run : 99M : backdrop : backdrop :

Changes to genode-haiku/misc-apps/pulse/Prefs.cpp.

31
32
33
34
35
36
37
38

39
40
41
42
43
44
45
31
32
33
34
35
36
37

38
39
40
41
42
43
44
45







-
+







	path.Append("Pulse_settings");
	fFile = new BFile(path.Path(), B_READ_WRITE | B_CREATE_FILE);
	if (fFile->InitCheck() != B_OK) {
		// try to open read-only
		if (fFile->SetTo(path.Path(), B_READ_ONLY) != B_OK) {
			fFatalError = true;
#if defined( HoG_GENODE )
			Genode::warning( "Pulse: applying vital minimum prefs, since BFile is not implemented yet" );
			printf( "Pulse: applying vital minimum prefs, so as not to depend on BFile implementation\n" );
			window_mode = NORMAL_WINDOW_MODE;
			deskbar_icon_width = 16.;
			normal_window_rect = GetNormalWindowRect();
			mini_window_rect = GetMiniWindowRect();
			normal_bar_color = 250 << (8+8+8);
#endif  // ~HoG_GENODE
			return;

Changes to genode-haiku/misc-tests/Jamfile.

110
111
112
113
114
115
116
117

118
119
120
121
122
123
124
110
111
112
113
114
115
116

117
118
119
120
121
122
123
124







-
+







		;
	DiskNtfsBlank $(NTFS_TEST_IMAGE_PATH) ;
	
	if ! $(USE_DRV_MANAGER)
	{
		AddComponentService  hog-test.run
			: 10M
			: ahci_drv
			: ahci  # was: ahci_drv
			: Block
			: "<config>
					<default-policy device=\"0\" writeable=\"yes\" />
				</config>
				"
			;
	}
167
168
169
170
171
172
173
174

175
176

177
178
179
180
181
182
183
184
185
186
187
188
189

190
191
192
193

194
195
196
197
198
199
200
167
168
169
170
171
172
173

174
175

176
177
178
179
180
181
182
183
184
185
186
187
188

189
190
191
192

193
194
195
196
197
198
199
200







-
+

-
+












-
+



-
+







			"
								# we keep the indexer client-side and even the server-side ntfs is exposed "raw" (neither of which would not normally be done) since we do "invasive" correctness tests
		\				</dir>
		\			</vfs>
		\		</config>
		\		<route>
		\			<service name=\"Block\">
							# use label " default" (instead of "ahci-0" or "ahci-1" etc), so that ahci_drv will be called (by driver_manager) with either port 0 or 1 or 2... dynamically
							# use label " default" (instead of "ahci-0" or "ahci-1" etc), so that driver/ahci(_drv) will be called (by driver_manager) with either port 0 or 1 or 2... dynamically
		\				<child name=\"drivers_init\" label=\"basic-layers: default\" />  <!-- for the USE_DRV_MANAGER case ; careful to preserve the whitespace in ' default' (see main.cc:399) -->
		\				<child name=\"ahci_drv\" />  <!-- for the 'static drivers' case -->
		\				<child name=\"ahci\" />  <!-- for the 'static drivers' case -->
		\			</service>
		\			<any-service>
		\				<parent/><any-child/>
		\			</any-service>
		\		</route>
	"
	;
	# NOTE on dynamic detection of AHCI ports:
	#   The "drivers_init -> dynamic" policies look like this:
	#
	#[init -> drivers_init -> report_rom]    <service name="Block">
	#[init -> drivers_init -> report_rom]            <policy label_suffix="ahci-0">
	#[init -> drivers_init -> report_rom]                    <child name="ahci_drv"/>
	#[init -> drivers_init -> report_rom]                    <child name="ahci"/>
	#[init -> drivers_init -> report_rom]            </policy>
	#......
	#[init -> drivers_init -> report_rom]            <policy label_suffix=" default">
	#[init -> drivers_init -> report_rom]                    <child name="ahci_drv" label="ahci-0"/>
	#[init -> drivers_init -> report_rom]                    <child name="ahci" label="ahci-0"/>
	#[init -> drivers_init -> report_rom]            </policy>
	#[init -> drivers_init -> report_rom]    </service>

#AddComponentClient  hog-test.run
#	: 2M
#	: top
#	;