Commit d0dbccb7a54ea6b590f5ef96126516264f6bd874
1 parent
23cbfe02
*** empty log message ***
Showing
8 changed files
with
97 additions
and
36 deletions
Show diff stats
anubis_dev/compiler/src/predef.aux
| ... | ... | @@ -4057,7 +4057,20 @@ new_string("hw")), |
| 4057 | 4057 | nil), |
| 4058 | 4058 | no_term); |
| 4059 | 4059 | |
| 4060 | -new_op_scheme(18794524,1, | |
| 4060 | +new_op_scheme(18795036,1, | |
| 4061 | +new_string("One"), | |
| 4062 | +cons(new_string("resize"), | |
| 4063 | +nil), | |
| 4064 | +cons(cons(new_string("HostWindow"), | |
| 4065 | +new_string("hw")), | |
| 4066 | +cons(cons(type_Int32, | |
| 4067 | +new_string("width")), | |
| 4068 | +cons(cons(type_Int32, | |
| 4069 | +new_string("height")), | |
| 4070 | +nil))), | |
| 4071 | +no_term); | |
| 4072 | + | |
| 4073 | +new_op_scheme(18801692,1, | |
| 4061 | 4074 | cons(app_ts, |
| 4062 | 4075 | cons(new_string("£Tuple2"), |
| 4063 | 4076 | cons(type_Int32, |
| ... | ... | @@ -4068,7 +4081,7 @@ nil), |
| 4068 | 4081 | nil, |
| 4069 | 4082 | no_term); |
| 4070 | 4083 | |
| 4071 | -new_op_scheme(18798620,1, | |
| 4084 | +new_op_scheme(18805788,1, | |
| 4072 | 4085 | new_string("One"), |
| 4073 | 4086 | cons(new_string("change_title"), |
| 4074 | 4087 | nil), |
| ... | ... | @@ -4079,7 +4092,7 @@ new_string("new_title")), |
| 4079 | 4092 | nil)), |
| 4080 | 4093 | no_term); |
| 4081 | 4094 | |
| 4082 | -new_op_scheme(18807822,0, | |
| 4095 | +new_op_scheme(18813966,0, | |
| 4083 | 4096 | new_string("Bool"), |
| 4084 | 4097 | cons(new_string("£window_event_pending"), |
| 4085 | 4098 | nil), |
| ... | ... | @@ -4089,7 +4102,7 @@ new_string("handle")), |
| 4089 | 4102 | nil), |
| 4090 | 4103 | no_term); |
| 4091 | 4104 | |
| 4092 | -new_op_scheme(18813454,0, | |
| 4105 | +new_op_scheme(18819598,0, | |
| 4093 | 4106 | cons(app_ts, |
| 4094 | 4107 | cons(new_string("HostWindowEvent"), |
| 4095 | 4108 | cons(new_utvar("E"), |
| ... | ... | @@ -4102,7 +4115,7 @@ new_string("handle")), |
| 4102 | 4115 | nil), |
| 4103 | 4116 | no_term); |
| 4104 | 4117 | |
| 4105 | -new_op_scheme(18821134,0, | |
| 4118 | +new_op_scheme(18827278,0, | |
| 4106 | 4119 | cons(app_ts, |
| 4107 | 4120 | cons(new_string("List"), |
| 4108 | 4121 | cons(cons(app_ts, |
| ... | ... | @@ -4118,7 +4131,7 @@ new_string("handle")), |
| 4118 | 4131 | nil), |
| 4119 | 4132 | no_term); |
| 4120 | 4133 | |
| 4121 | -new_op_scheme(18829326,0, | |
| 4134 | +new_op_scheme(18835470,0, | |
| 4122 | 4135 | new_string("Bool"), |
| 4123 | 4136 | cons(new_string("£default_host_window_handling"), |
| 4124 | 4137 | nil), |
| ... | ... | @@ -4161,7 +4174,7 @@ new_string("event_handler")), |
| 4161 | 4174 | nil))))), |
| 4162 | 4175 | no_term); |
| 4163 | 4176 | |
| 4164 | -new_op_scheme(18835982,0, | |
| 4177 | +new_op_scheme(18842126,0, | |
| 4165 | 4178 | new_string("One"), |
| 4166 | 4179 | cons(new_string("£begin_paint"), |
| 4167 | 4180 | nil), |
| ... | ... | @@ -4170,7 +4183,7 @@ new_string("window")), |
| 4170 | 4183 | nil), |
| 4171 | 4184 | no_term); |
| 4172 | 4185 | |
| 4173 | -new_op_scheme(18839566,0, | |
| 4186 | +new_op_scheme(18845710,0, | |
| 4174 | 4187 | new_string("One"), |
| 4175 | 4188 | cons(new_string("£end_paint"), |
| 4176 | 4189 | nil), |
| ... | ... | @@ -4179,7 +4192,7 @@ new_string("window")), |
| 4179 | 4192 | nil), |
| 4180 | 4193 | no_term); |
| 4181 | 4194 | |
| 4182 | -new_op_scheme(18843662,0, | |
| 4195 | +new_op_scheme(18849806,0, | |
| 4183 | 4196 | new_string("Bool"), |
| 4184 | 4197 | cons(new_string("£handle_host_window_events"), |
| 4185 | 4198 | nil), |
| ... | ... | @@ -4217,7 +4230,7 @@ new_string("eh")), |
| 4217 | 4230 | nil)))), |
| 4218 | 4231 | no_term); |
| 4219 | 4232 | |
| 4220 | -new_op_scheme(18860558,0, | |
| 4233 | +new_op_scheme(18866702,0, | |
| 4221 | 4234 | new_string("Bool"), |
| 4222 | 4235 | cons(new_string("£default_host_window_handling"), |
| 4223 | 4236 | nil), |
| ... | ... | @@ -4260,7 +4273,7 @@ new_string("event_handler")), |
| 4260 | 4273 | nil))))), |
| 4261 | 4274 | no_term); |
| 4262 | 4275 | |
| 4263 | -new_op_scheme(18871836,1, | |
| 4276 | +new_op_scheme(18877980,1, | |
| 4264 | 4277 | new_string("One"), |
| 4265 | 4278 | cons(new_string("generic_host_window_handler"), |
| 4266 | 4279 | nil), |
| ... | ... | @@ -4318,7 +4331,7 @@ nil), |
| 4318 | 4331 | nil), |
| 4319 | 4332 | nil)),0,1); |
| 4320 | 4333 | |
| 4321 | -new_op_scheme(18887182,0, | |
| 4334 | +new_op_scheme(18893326,0, | |
| 4322 | 4335 | cons(app_ts, |
| 4323 | 4336 | cons(new_string("Maybe"), |
| 4324 | 4337 | cons(cons(app_ts, |
| ... | ... | @@ -4346,7 +4359,7 @@ new_string("sort")), |
| 4346 | 4359 | nil)))))), |
| 4347 | 4360 | no_term); |
| 4348 | 4361 | |
| 4349 | -new_op_scheme(18895388,1, | |
| 4362 | +new_op_scheme(18901532,1, | |
| 4350 | 4363 | cons(app_ts, |
| 4351 | 4364 | cons(new_string("Maybe"), |
| 4352 | 4365 | cons(new_string("HostWindow"), |
| ... | ... | @@ -4400,7 +4413,7 @@ new_string("compress")), |
| 4400 | 4413 | nil)))))), |
| 4401 | 4414 | no_term); |
| 4402 | 4415 | |
| 4403 | -new_op_scheme(18911772,1, | |
| 4416 | +new_op_scheme(18917916,1, | |
| 4404 | 4417 | new_string("One"), |
| 4405 | 4418 | cons(new_string("show"), |
| 4406 | 4419 | nil), |
| ... | ... | @@ -4409,7 +4422,7 @@ new_string("win")), |
| 4409 | 4422 | nil), |
| 4410 | 4423 | no_term); |
| 4411 | 4424 | |
| 4412 | -new_op_scheme(18915868,1, | |
| 4425 | +new_op_scheme(18922012,1, | |
| 4413 | 4426 | new_string("One"), |
| 4414 | 4427 | cons(new_string("hide"), |
| 4415 | 4428 | nil), |
| ... | ... | @@ -4418,7 +4431,7 @@ new_string("win")), |
| 4418 | 4431 | nil), |
| 4419 | 4432 | no_term); |
| 4420 | 4433 | |
| 4421 | -new_op_scheme(18925596,1, | |
| 4434 | +new_op_scheme(18931740,1, | |
| 4422 | 4435 | new_string("Bool"), |
| 4423 | 4436 | cons(new_string("queue_event"), |
| 4424 | 4437 | nil), |
| ... | ... | @@ -4432,7 +4445,7 @@ new_string("e")), |
| 4432 | 4445 | nil)), |
| 4433 | 4446 | no_term); |
| 4434 | 4447 | |
| 4435 | -new_op_scheme(18935836,1, | |
| 4448 | +new_op_scheme(18941980,1, | |
| 4436 | 4449 | new_string("One"), |
| 4437 | 4450 | cons(new_string("paint_rectangle"), |
| 4438 | 4451 | nil), |
| ... | ... | @@ -4445,7 +4458,7 @@ new_string("color")), |
| 4445 | 4458 | nil))), |
| 4446 | 4459 | no_term); |
| 4447 | 4460 | |
| 4448 | -new_op_scheme(18941468,1, | |
| 4461 | +new_op_scheme(18947612,1, | |
| 4449 | 4462 | new_string("One"), |
| 4450 | 4463 | cons(new_string("paint_rectangle"), |
| 4451 | 4464 | nil), |
| ... | ... | @@ -4458,7 +4471,7 @@ new_string("color")), |
| 4458 | 4471 | nil))), |
| 4459 | 4472 | no_term); |
| 4460 | 4473 | |
| 4461 | -new_op_scheme(18958876,1, | |
| 4474 | +new_op_scheme(18965020,1, | |
| 4462 | 4475 | new_string("One"), |
| 4463 | 4476 | cons(new_string("paint_image"), |
| 4464 | 4477 | nil), |
| ... | ... | @@ -4475,7 +4488,7 @@ new_string("image")), |
| 4475 | 4488 | nil))))), |
| 4476 | 4489 | no_term); |
| 4477 | 4490 | |
| 4478 | -new_op_scheme(18965532,1, | |
| 4491 | +new_op_scheme(18971676,1, | |
| 4479 | 4492 | new_string("One"), |
| 4480 | 4493 | cons(new_string("paint_image"), |
| 4481 | 4494 | nil), |
| ... | ... | @@ -4492,7 +4505,7 @@ new_string("image")), |
| 4492 | 4505 | nil))))), |
| 4493 | 4506 | no_term); |
| 4494 | 4507 | |
| 4495 | -new_op_scheme(18971676,1, | |
| 4508 | +new_op_scheme(18977820,1, | |
| 4496 | 4509 | new_string("One"), |
| 4497 | 4510 | cons(new_string("map_to_host_window"), |
| 4498 | 4511 | nil), | ... | ... |
anubis_dev/include/bytecode.h
anubis_dev/library/examples/try_window.anubis
| ... | ... | @@ -11,13 +11,13 @@ define One |
| 11 | 11 | paint_method |
| 12 | 12 | ( |
| 13 | 13 | HostWindow window, |
| 14 | - Rectangle r | |
| 14 | + List(Rectangle) rs | |
| 15 | 15 | ) = |
| 16 | - print("Painting\n"); | |
| 17 | - paint_rectangle(window,r,rgb(128,128,128)); | |
| 18 | - paint_rectangle(window,rect(10,10,50,50),rgb(255,0,0)); | |
| 19 | - paint_rectangle(window,rect(60,10,100,50),rgb(0,255,0)); | |
| 20 | - paint_rectangle(window,rect(110,10,150,50),rgb(0,0,255)). | |
| 16 | + forget(map((Rectangle r) |-> | |
| 17 | + paint_rectangle(window,r,rgb(128,128,128)); | |
| 18 | + paint_rectangle(window,rect(10,10,50,50),rgb(255,0,0)); | |
| 19 | + paint_rectangle(window,rect(60,10,100,50),rgb(0,255,0)); | |
| 20 | + paint_rectangle(window,rect(110,10,150,50),rgb(0,0,255)),rs)). | |
| 21 | 21 | |
| 22 | 22 | |
| 23 | 23 | ... | ... |
anubis_dev/library/predefined.anubis
| ... | ... | @@ -3935,8 +3935,22 @@ public define (Int32,Int32) |
| 3935 | 3935 | ) = £avm{ host_window_size }. |
| 3936 | 3936 | |
| 3937 | 3937 | |
| 3938 | - The size (width,height) of the screen itself (in pixels) is returned by: | |
| 3939 | 3938 | |
| 3939 | + You can change the size of the window: | |
| 3940 | + | |
| 3941 | +public define One | |
| 3942 | + resize | |
| 3943 | + ( | |
| 3944 | + HostWindow hw, | |
| 3945 | + Int32 width, | |
| 3946 | + Int32 height | |
| 3947 | + ) = | |
| 3948 | + £avm{ resize_host_window }. | |
| 3949 | + | |
| 3950 | + | |
| 3951 | + | |
| 3952 | + The size (width,height) of the screen itself (in pixels) is returned by: | |
| 3953 | + | |
| 3940 | 3954 | public define (Int32,Int32) |
| 3941 | 3955 | screen_size |
| 3942 | 3956 | = |
| ... | ... | @@ -3954,8 +3968,6 @@ public define One |
| 3954 | 3968 | |
| 3955 | 3969 | |
| 3956 | 3970 | |
| 3957 | - | |
| 3958 | - | |
| 3959 | 3971 | |
| 3960 | 3972 | |
| 3961 | 3973 | *** (11.3) Generic host window handler. | ... | ... |
anubis_dev/vm/src/host_graph.h
| ... | ... | @@ -50,6 +50,7 @@ U8 host_translate_keyboard_state(unsigned int state); |
| 50 | 50 | void host_sc_screen_size(int *witdh, int *height); |
| 51 | 51 | BOOL host_sc_open_host_window(U32 xWin, U32 yWin, U32 wWin, U32 hWin, char * title, BOOL transcientFlag, U32 *the_window, U32 *the_gc); |
| 52 | 52 | void host_sc_host_window_size(U32 handle, int * wSize, int * hSize); |
| 53 | +void host_sc_resize_host_window(U32 handle, int width, int height); | |
| 53 | 54 | |
| 54 | 55 | void host_free_host_window(U32 winPointer); |
| 55 | 56 | void host_free_host_pixmap(U32 pixPointer); | ... | ... |
anubis_dev/vm/src/linux/host_graph.c
| ... | ... | @@ -71,7 +71,9 @@ BOOL host_sc_open_host_window(U32 xPos, U32 yPos, U32 wSize, U32 hSize, |
| 71 | 71 | the_hints.height = hSize; |
| 72 | 72 | the_hints.flags = PPosition | PSize; |
| 73 | 73 | |
| 74 | - xswa.override_redirect = transcientFlag; | |
| 74 | + xswa.override_redirect = transcientFlag; | |
| 75 | + xswa.background_pixmap = None; | |
| 76 | + | |
| 75 | 77 | |
| 76 | 78 | /* Create the (not yet mapped to screen) window. */ |
| 77 | 79 | *the_window = (U32)XCreateSimpleWindow(the_display, |
| ... | ... | @@ -93,7 +95,7 @@ BOOL host_sc_open_host_window(U32 xPos, U32 yPos, U32 wSize, U32 hSize, |
| 93 | 95 | |
| 94 | 96 | XChangeWindowAttributes(the_display, |
| 95 | 97 | *the_window, |
| 96 | - CWOverrideRedirect, | |
| 98 | + CWOverrideRedirect|CWBackPixmap, | |
| 97 | 99 | &xswa); |
| 98 | 100 | |
| 99 | 101 | |
| ... | ... | @@ -173,6 +175,13 @@ void host_change_host_window_title(U32 the_window, char * title) |
| 173 | 175 | XStoreName(the_display,(Window)the_window,title); |
| 174 | 176 | } |
| 175 | 177 | |
| 178 | +void host_sc_resize_host_window(U32 the_window, int width, int height) | |
| 179 | +{ | |
| 180 | + XResizeWindow(the_display,(Window)the_window, | |
| 181 | + (unsigned int)sup(30,width), | |
| 182 | + (unsigned int)sup(30,height)); | |
| 183 | +} | |
| 184 | + | |
| 176 | 185 | void host_sc_paint_rectangle(U32 handle, U32 gc, int x, int y, int w, int h, U32 color) |
| 177 | 186 | { |
| 178 | 187 | unsigned long xcolor = RGB_to_X(color); | ... | ... |
anubis_dev/vm/src/syscalls.c
| ... | ... | @@ -2692,9 +2692,9 @@ switch (get16(1)) |
| 2692 | 2692 | */ |
| 2693 | 2693 | case sc_host_window_size: |
| 2694 | 2694 | { |
| 2695 | - int wSize; | |
| 2696 | - int hSize; | |
| 2697 | - U32 the_window = ((U32 *)(((U32 *)(*(SP-1)))[1]))[1]; | |
| 2695 | + int wSize; | |
| 2696 | + int hSize; | |
| 2697 | + U32 the_window = ((U32 *)(((U32 *)(*(SP-1)))[1]))[1]; | |
| 2698 | 2698 | |
| 2699 | 2699 | if ((R = allocate_data_segment(3,allocator)) == 0) |
| 2700 | 2700 | { |
| ... | ... | @@ -2702,7 +2702,7 @@ switch (get16(1)) |
| 2702 | 2702 | goto end; |
| 2703 | 2703 | } |
| 2704 | 2704 | |
| 2705 | - host_sc_host_window_size(the_window, &wSize, &hSize); | |
| 2705 | + host_sc_host_window_size(the_window, &wSize, &hSize); | |
| 2706 | 2706 | |
| 2707 | 2707 | ((U32 *)R)[1] = wSize; |
| 2708 | 2708 | ((U32 *)R)[2] = hSize; |
| ... | ... | @@ -2712,6 +2712,23 @@ switch (get16(1)) |
| 2712 | 2712 | goto do_computing; |
| 2713 | 2713 | |
| 2714 | 2714 | |
| 2715 | + /* Expects: at *(SP-1): HostWindow | |
| 2716 | + at *(SP-2): (Int32)width | |
| 2717 | + at *(SP-3): (Int32)height | |
| 2718 | + | |
| 2719 | + Returns: (One)unique (i.e. 0) | |
| 2720 | + */ | |
| 2721 | + case sc_resize_host_window: | |
| 2722 | + { | |
| 2723 | + U32 the_window = ((U32 *)(((U32 *)(*(SP-1)))[1]))[1]; | |
| 2724 | + | |
| 2725 | + host_sc_resize_host_window(the_window,*(SP-2),*(SP-3)); | |
| 2726 | + | |
| 2727 | + R = 0; | |
| 2728 | + } | |
| 2729 | + IP += 1+2; | |
| 2730 | + goto do_computing; | |
| 2731 | + | |
| 2715 | 2732 | |
| 2716 | 2733 | /* |
| 2717 | 2734 | Returns: ((Int32,Int32))(width,height) | ... | ... |
anubis_dev/vm/src/win32/host_graph.c
| ... | ... | @@ -126,6 +126,13 @@ void host_sc_host_window_size(U32 theWindow, int * wSize, int * hSize) |
| 126 | 126 | *hSize = rect.bottom - rect.top; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | +void host_sc_resize_host_window(U32 theWindow, int width, int height) | |
| 130 | +{ | |
| 131 | + Salut David ! | |
| 132 | + noublie pas de mettre quelque chose comme sup(30,width) et sup(30,height) pour éviter les tailles | |
| 133 | + négatives ou trop petites. | |
| 134 | +} | |
| 135 | + | |
| 129 | 136 | void host_pixmap_size(U32 thePixmap, int * wSize, int * hSize) |
| 130 | 137 | { |
| 131 | 138 | HostImage pixmap = (HostImage)thePixmap; | ... | ... |