forked from AdaDoom3/AdaDoom3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
neo-system-window.adb
702 lines (701 loc) · 26.8 KB
/
neo-system-window.adb
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
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
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
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
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
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
381
382
383
384
385
386
387
388
389
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
424
425
426
427
428
429
430
431
432
433
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
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
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
517
518
519
520
521
522
523
524
525
526
527
528
529
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
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
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
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
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
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
--
PACKAGE BODY Neo.System.Window
IS
--------------------
-- Implementation --
--------------------
PACKAGE BODY Generic_Implementation
IS SEPARATE;
PACKAGE Implementation
IS NEW Generic_Implementation(
Handle_Finalization => Handle_Finalization,
Handle_Activation => Handle_Activation,
Handle_State_Change => Handle_State_Change,
Handle_Window_Move => Handle_Window_Move,
Handle_Resize => Handle_Resize);
-------------------------------
-- Task_Multi_Monitor_Window --
-------------------------------
TASK BODY Task_Multi_Monitor_Window
IS
Index : Integer_4_Positive := 1;
Do_Quit : Boolean := False;
--Render_Backend : Access_Procedure := NULL;
BEGIN
ACCEPT Initialize(
I : IN Integer_4_Positive
)--Backend : IN Access_Procedure)
DO
Index := I;
--Render_Backend := Backend;
END Initialize;
WHILE Implementation.Handle_Events(Index) AND NOT Do_Quit LOOP
SELECT
ACCEPT Finalize
DO
Do_Quit := True;
END Finalize;
ELSE
NULL;--Render_Backend.All;
END SELECT;
END LOOP;
END Task_Multi_Monitor_Window;
---------
-- Run --
---------
PROCEDURE Run(
Title : IN String_2;
Icon_Path : IN String_2;
Cursor_Path : IN String_2;
--Render_Backend : IN Access_Procedure;
Do_Allow_Multiple_Instances : IN Boolean := False)
IS
Native_Width : Integer_4_Positive := 1;
Native_Height : Integer_4_Positive := 1;
Bits_Per_Pixel : Integer_4_Positive := 1;
Previous_State : Enumerated_Window_State := Protected_Data.Get.State;
X : Integer_4_Signed := Protected_Data.Get.X;
Y : Integer_4_Signed := Protected_Data.Get.Y;
BEGIN
IF Protected_Data.Get.Title /= NULL THEN
RETURN;
END IF;
IF NOT Do_Allow_Multiple_Instances AND THEN NOT Implementation.Is_Only_Instance(Title) THEN
RAISE System_Call_Failure;
END IF;
Implementation.Initialize(Title, Icon_Path, Cursor_Path);
-------------
Setup_Window:
-------------
DECLARE
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Title := NEW String_2(1..Title'Length);
Window.TItle.All := Title;
Window.Icon_Path := NEW String_2(1..Icon_Path'Length);
Window.Icon_Path.All := Icon_Path;
Window.Cursor_Path := NEW String_2(1..Cursor_Path'Length);
Window.Cursor_Path.All := Cursor_Path;
Protected_Data.Set(Window);
END Setup_Window;
Outter:LOOP
Get_Screen_Information(Bits_Per_Pixel, Native_Width, Native_Height);
-- Check IF monitor native resolution violates the minimum/maximum aspect requirements
CASE Protected_Data.Get.State IS
WHEN Fullscreen_State | Multi_Monitor_State =>
Implementation.Adjust(
Title => Title,
Do_Fullscreen => True,
X => 0,
Y => 0,
Width => Native_Width,
Height => Native_Height);
IF Protected_Data.Get.State = Multi_Monitor_State THEN
Implementation.Initialize_Multi_Monitor(
Monitors => Implementation.Get_Monitors);
-- Detect number of graphics cards
-- Spawn_Tasks_For_Auxiliarary_Video_Cards:
END IF;
Center := (Native_Width / 2, Native_Height / 2);
WHEN Windowed_State =>
-- IF the current width AND height are greater than native, THEN accomications must be made
Implementation.Adjust(
Title => Title,
Do_Fullscreen => False,
X => X,
Y => Y,
Width => Protected_Data.Get.Width,
Height => Protected_Data.Get.Height);
END CASE;
Previous_State := Protected_Data.Get.State;
Protected_Data.Set_Initialized(True);
Inner:LOOP
IF Protected_Data.Get.Is_Changing_Mode THEN
IF Protected_Data.Get.Is_In_Menu_Mode THEN
Implementation.Hide_Mouse(False, False);
Implementation.Set_Custom_Mouse(False);
ELSE
Take_Control;
END IF;
------------------
Unset_Mode_Change:
------------------
DECLARE
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Is_Changing_Mode := False;
Protected_Data.Set(Window);
END Unset_Mode_Change;
END IF;
--Render_Backend.All;
EXIT Outter WHEN OR Protected_Data.Get.Is_Done OR NOT Implementation.Handle_Events;
EXIT Inner WHEN NOT Protected_Data.Is_Initialized;
END LOOP Inner;
CASE Previous_State IS
WHEN Windowed_State =>
X := Protected_Data.Get.X;
Y := Protected_Data.Get.Y;
WHEN Multi_Monitor_State =>
Implementation.Finalize_Multi_Monitor;
WHEN others =>
NULL;
END CASE;
END LOOP Outter;
Implementation.Finalize;
Protected_Data.Set(DEFAULT_RECORD_WINDOW);
END Run;
--------------
-- Finalize --
--------------
PROCEDURE Finalize
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Is_Done := True;
Protected_Data.Set(Window);
-- Free strings
END Finalize;
---------
-- Get --
---------
FUNCTION Get
RETURN Record_Window
IS
BEGIN
RETURN Protected_Data.Get.Window;
END Get;
---------
-- Set --
---------
PROCEDURE Set(
Window : IN Record_Window)
IS
Window : Record_Window := Protected_Data.Get;
Mode_Change : Boolean := False;
BEGIN
IF Do_Enter_Menu_Mode /= Window.Is_In_Menu_Mode THEN
Mode_Change := True;
END IF;
Protected_Data.Set((
Title => Window.Title,
Icon_Path => Window.Icon_Path,
Cursor_Path => Window.Cursor_Path,
Renderer => Renderer,
State => State,
Refreshes_Per_Second => Refreshes_Per_Second,
Multi_Samples => Multi_Samples,
Gamma => Gamma,
Height => Height,
Width => Width,
X => X,
Y => Y,
Aspect_Wide => Aspect_Wide,
Aspect_Narrow => Aspect_Narrow,
Is_In_Menu_Mode => Do_Enter_Menu_Mode,
Is_Changing_Mode => Mode_Change,
Is_Iconized => Window.Is_Iconized,
Is_Done => Window.Is_Done));
Protected_Data.Set_Initialized(False);
END Set;
------------------
-- Set_Position --
------------------
PROCEDURE Set_Position(
X : IN Integer_4_Signed;
Y : IN Integer_4_Signed)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.X := X;
Window.Y := Y;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Position;
------------------
-- Set_Renderer --
------------------
PROCEDURE Set_Renderer(
Renderer : IN Enumerated_Renderer)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Renderer := Renderer;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Renderer;
---------------
-- Set_State --
---------------
PROCEDURE Set_State(
State : IN Enumerated_Window_State)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.State := State;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_State;
------------------------------
-- Set_Refreshes_Per_Second --
------------------------------
PROCEDURE Set_Refreshes_Per_Second(
Refreshes_Per_Second : IN Positive)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Refreshes_Per_Second := Refreshes_Per_Second;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Refreshes_Per_Second;
-----------------------
-- Set_Multi_Samples --
-----------------------
PROCEDURE Set_Multi_Samples(
Multi_Samples : IN Positive)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Multi_Samples := Multi_Samples;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Multi_Samples;
---------------
-- Set_Gamma --
---------------
PROCEDURE Set_Gamma(
Gamma : IN Record_Gamma)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Gamma := Gamma;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Gamma;
----------------
-- Set_Height --
----------------
PROCEDURE Set_Height(
Height : IN Positive)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Height := Height;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Height;
---------------
-- Set_Width --
---------------
PROCEDURE Set_Width(
Width : IN Positive)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Width := Width;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Width;
--------------------
-- Set_Resolution --
--------------------
PROCEDURE Set_Resolution(
Height : IN Positive;
Width : IN Positive)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Height := Height;
Window.Width := Width;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Resolution;
-----------------------------
-- Set_Narrow_Aspect_Ratio --
-----------------------------
PROCEDURE Set_Narrow_Aspect_Ratio(
Aspect_Narrow : IN Record_Aspect_Ratio)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Aspect_Narrow := Aspect_Narrow;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Narrow_Aspect_Ratio;
---------------------------
-- Set_Wide_Aspect_Ratio --
---------------------------
PROCEDURE Set_Wide_Aspect_Ratio(
Aspect_Wide : IN Record_Aspect_Ratio)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Aspect_Wide := Aspect_Wide;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
END Set_Wide_Aspect_Ratio;
-------------------
-- Set_Menu_Mode --
-------------------
PROCEDURE Set_Menu_Mode(
Do_Enter_Menu_Mode : IN Boolean)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.Is_Changing_Mode := True;
IF Do_Enter_Menu_Mode THEN
Window.Is_In_Menu_Mode := True;
Protected_Data.Set_Busy(False);
ELSE
Window.Is_In_Menu_Mode := False;
Protected_Data.Set_Busy(True);
END IF;
Protected_Data.Set(Window);
END Set_Menu_Mode;
------------------
-- Take_Control --
------------------
PROCEDURE Take_Control
IS
BEGIN
IF Protected_Data.Get.State = Windowed_State THEN
-----------------
Move_From_Hiding:
-----------------
DECLARE
Screen : Record_Window_Border := Get_Screen_Border;
Work_Area : Array_Record_Window_Border := Get_Work_Area;
BEGIN
Screen.Right := Screen.Right - Screen.Left;
Screen.Bottom := Screen.Bottom - Screen.Top;
IF Screen.Left < Work_Area.Left THEN
Screen.Left := Work_Area.Left;
ELSIF Screen.Right + Screen.Left > Work_Area.Right THEN
Screen.Left := Work_Area.Right - Screen.Right;
END IF;
IF Screen.Top < Work_Area.Top THEN
Screen.Top := Work_Area.Top;
ELSIF Screen.Bottom + Screen.Top > Work_Area.Bottom THEN
Screen.Top := Work_Area.Bottom - Screen.Bottom;
END IF;
IF
Set_Window_Position(
Window => Window,
Y => Screen.Top,
X => Screen.Left,
Width => Screen.Right,
Height => Screen.Bottom,
Insert_After => INSERT_ON_TOP_OF_APPLICATIONS,
Flags => 0) = FAILED
THEN
RAISE System_Call_Failure;
END IF;
END Move_From_Hiding;
Implementation.Move_Topmost_Windows_Out_Of_The_Way;
Implementation.Hide_Mouse(True, False);
ELSE
Implementation.Hide_Mouse(True, True);
END IF;
Protected_Data.Set_Busy(True);
END Take_Control;
------------------
-- Is_In_Border --
------------------
FUNCTION Is_In_Border(
X : IN Integer_4_Signed;
Y : IN Integer_4_Signed)
RETURN Boolean
IS
Border : Record_Window_Border := Implementation.Get_Screen_Border;
BEGIN
IF
X > Border.Left AND X < Border.Right AND
Y > Border.Top AND Y < Border.Bottom
THEN
RETURN True;
END IF;
RETURN False;
END Is_In_Border;
-------------------------
-- Handle_Finalization --
-------------------------
PROCEDURE Handle_Finalization
IS
BEGIN
Finalize;
-- Free Strings
END Handle_Finalization;
------------------------
-- Handle_Window_Move --
------------------------
PROCEDURE Handle_Window_Move(
Window_X : IN Integer_4_Signed;
Window_Y : IN Integer_4_Signed;
Screen_X : IN Integer_4_Signed;
Screen_Y : IN Integer_4_Signed)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
Window.X := Window_X;
Window.Y := Window_Y;
Protected_Data.Set(Window);
IF Protected_Data.Get.State = Windowed_State THEN
Center :=(
Screen_X + Protected_Data.Get.Width / 2,
Screen_Y + Protected_Data.Get.Height / 2);
END IF;
END Handle_Window_Move;
-------------------------
-- Handle_State_Change --
-------------------------
PROCEDURE Handle_State_Change(
Change : IN Enumerated_Window_Change)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
CASE Change IS
WHEN Iconic_Change =>
Protected_Data.Set_Busy(False);
Window.Is_Iconized := True;
Protected_Data.Set(Window);
WHEN Fullscreen_Change =>
Window.State := Fullscreen_State;
Window.Is_Iconized := False;
Protected_Data.Set(Window);
Protected_Data.Set_Initialized(False);
WHEN Windowed_Change =>
Window.Is_Iconized := False;
Protected_Data.Set(Window);
END CASE;
END Handle_State_Change;
-----------------------
-- Handle_Activation --
-----------------------
PROCEDURE Handle_Activation(
Do_Activate : IN Boolean;
Do_Detect_Click : IN Boolean;
X : IN Integer_4_Signed;
Y : IN Integer_4_Signed)
IS
Window : Record_Window := Protected_Data.Get;
BEGIN
IF Protected_Data.Is_Initialized THEN
IF Do_Activate THEN
IF Protected_Data.Get.Is_In_Menu_Mode THEN
Implementation.Set_Custom_Mouse(False);
ELSE
Implementation.Set_Custom_Mouse(True);
IF Is_In_Border(X, Y) THEN
Take_Control;
END IF;
END IF;
ELSE
Protected_Data.Set_Busy(False);
IF Protected_Data.Get.State /= Windowed_State THEN
IF Protected_Data.Get.State = Multi_Monitor_State THEN
Implementation.Finalize_Multi_Monitor;
END IF;
Implementation.Iconize;
Window.Is_Iconized := True;
END IF;
Implementation.Hide_Mouse(False);
Implementation.Set_Custom_Mouse(True);
Keys_Down := (others => False);
END IF;
Protected_Data.Set(Window);
END IF;
END Handle_Activation;
-------------------
-- Handle_Resize --
-------------------
FUNCTION Handle_Resize(
Resize_Location : IN Enumerated_Resize;
Current_Screen : IN Record_Window_Border)
RETURN Record_Window_Border
IS
Screen : Record_Window_Border := Current_Screen;
-- Window : Record_Window := Protected_Data.Get;
-- Narrow_Ratio : Float_4_Natural := Float_4_Natural(Window.Aspect_Wide.Horizontal) / Float_4_Natural(Window.Aspect_Wide.Vertical);
-- Wide_Ratio : Float_4_Natural := Float_4_Natural(Window.Aspect_Narrow.Horizontal) / Float_4_Natural(Window.Aspect_Narrow.Vertical);
-- Decoration_Width : Integer_4_Signed := Decoration_Area.Right - Decoration_Area.Left;
-- Decoration_Height : Integer_4_Signed := Decoration_Area.Bottom - Decoration_Area.Top;
-- Current_Width : Integer_4_Signed := Screen.Right - Decoration_Width - Screen.Left;
-- Current_Height : Integer_4_Signed := Screen.Bottom - Decoration_Height - Screen.top;
-- Previous_Width : Integer_4_Signed := Current_Width;
-- Previous_Height : Integer_4_Signed := Current_Height;
-- Previous_Top : Integer_4_Signed := 0;
BEGIN
-- IF Current_Width < Integer_4_Signed(Float_4_Natural(Current_Height) * Wide_Ratio) THEN
-- Current_Width := Integer_4_Signed(Float_4_Natural(Current_Height) * Wide_Ratio);
-- END IF;
-- IF Current_Width < MINIMUM_DIMENSION_X THEN
-- Current_Width := MINIMUM_DIMENSION_X;
-- END IF;
-- IF Current_Height < Integer_4_Signed(Float_4_Natural(Current_Width) / Narrow_Ratio) THEN
-- Current_Height := Integer_4_Signed(Float_4_Natural(Current_Width) / Narrow_Ratio);
-- END IF;
-- CASE Resize_Location IS
-- WHEN
-- Bottom_Resize |
-- Top_Resize =>
-- Current_Height := Previous_Height;
-- IF Float_4_Natural(Current_Width) > Narrow_Ratio * Float_4_Natural(Current_Height) THEN
-- Current_Width := Integer_4_Signed(Narrow_Ratio * Float_4_Natural(Current_Height));
-- END IF;
-- IF Current_Width < MINIMUM_DIMENSION_X THEN
-- Current_Width := MINIMUM_DIMENSION_X;
-- END IF;
-- IF Current_Height < Integer_4_Signed(Float_4_Natural(Current_Width) / Narrow_Ratio) THEN
-- Current_Height := Integer_4_Signed(Float_4_Natural(Current_Width) / Narrow_Ratio);
-- END IF;
-- IF Screen.Left <= Work_Area.Left AND Current_Width > Previous_Width THEN
-- Screen.Right := Screen.Right + (Current_Width - Previous_Width);
-- ELSIF Screen.Right >= Work_Area.Right AND Current_Width > Previous_Width THEN
-- Screen.Left := Screen.Left - (Current_Width - Previous_Width);
-- ELSE
-- Screen.Left := Screen.Left - (Current_Width - Previous_Width) / 2;
-- Screen.Right := Screen.Right + (Current_Width - Previous_Width) / 2;
-- END IF;
-- IF Resize_Location = Resize_Location THEN
-- Screen.Top := Screen.Bottom - (Current_Height + Decoration_Height);
-- ELSE
-- Screen.Bottom := Screen.Top + (Current_Height + Decoration_Height);
-- END IF;
-- WHEN
-- Left_Resize |
-- Right_Resize =>
-- Current_Width := Previous_Width;
-- IF Float_4_Natural(Current_Height) > Float_4_Natural(Current_Width) / Wide_Ratio AND
-- Current_Width > MINIMUM_DIMENSION_X THEN
-- Current_Height := Integer_4_Signed(Float_4_Natural(Current_Width) / Wide_Ratio);
-- END IF;
-- IF Current_Width < MINIMUM_DIMENSION_X THEN
-- Current_Width := MINIMUM_DIMENSION_X;
-- END IF;
-- IF Screen.Top <= Work_Area.Top AND Current_Height > Previous_Height THEN
-- Screen.Bottom := Screen.Top + Decoration_Height + Current_Height;
-- ELSIF Screen.Bottom >= Work_Area.Bottom AND Current_Height > Previous_Height THEN
-- Screen.Top := Screen.Bottom - Decoration_Height - Current_Height;
-- ELSE
-- Previous_Top := Screen.Top;
-- Screen.Top := Screen.Bottom - Decoration_Height - (Current_Height + Previous_Height) / 2;
-- Screen.Bottom := Previous_Top + Decoration_Height + (Current_Height + Previous_Height) / 2;
-- END IF;
-- IF Resize_Location = Resize_Location THEN
-- Screen.Left := Screen.Right - (Current_Width + Decoration_Width);
-- ELSE
-- Screen.Right := Screen.Left + Current_Width + Decoration_Width;
-- END IF;
-- WHEN
-- Bottom_Right_Resize |
-- Bottom_Left_Resize |
-- Top_Left_Resize |
-- Top_Right_Resize =>
-- IF Resize_Location = Bottom_Left_Resize OR Resize_Location = Bottom_Right_Resize THEN
-- Screen.Bottom := Screen.Top + Current_Height + Decoration_Height;
-- END IF;
-- IF Resize_Location = Top_Right_Resize OR Resize_Location = Top_Left_Resize THEN
-- Screen.Top := Screen.Bottom - Current_Height - Decoration_Height;
-- END IF;
-- IF Resize_Location = Bottom_Left_Resize OR Resize_Location = Top_Left_Resize THEN
-- Screen.Left := Screen.Right - Decoration_Width - Current_Width;
-- END IF;
-- IF Resize_Location = Bottom_Right_Resize OR Resize_Location = Top_Right_Resize THEN
-- Screen.Right := Screen.Left + Decoration_Width + Current_Width;
-- END IF;
-- --------------------
-- --Bound_Corner_Sizing:
-- --------------------
-- -- DECLARE
-- -- Did_Resize_Right : Boolean := False;
-- -- Did_Resize_Left : Boolean := False;
-- -- Did_Resize_Top : Boolean := False;
-- -- Did_Resize_Bottom : Boolean := False;
-- -- BEGIN
-- -- IF Resize_Location = Bottom_Left_Resize OR Resize_Location = Bottom_Right_Resize THEN
-- -- Screen.Bottom := Screen.Top + Current_Height + Decoration_Height;
-- -- IF Screen.Bottom > Work_Area.Bottom THEN
-- -- Did_Resize_Bottom := True;
-- -- Screen.Bottom := Work_Area.Bottom;
-- -- END IF;
-- -- END IF;
-- -- IF Resize_Location = Top_Right_Resize OR Resize_Location = Top_Left_Resize THEN
-- -- Screen.Top := Screen.Bottom - Current_Height - Decoration_Height;
-- -- IF Screen.Top < Work_Area.Top THEN
-- -- Did_Resize_Top := True;
-- -- Screen.Top := Work_Area.Top;
-- -- END IF;
-- -- END IF;
-- -- IF Resize_Location = Bottom_Left_Resize OR Resize_Location = Top_Left_Resize THEN
-- -- Screen.Left := Screen.Right - Decoration_Width - Current_Width;
-- -- IF Screen.Left < Work_Area.Left THEN
-- -- Did_Resize_Left := True;
-- -- Screen.Left := Work_Area.Left;
-- -- END IF;
-- -- END IF;
-- -- IF Resize_Location = Bottom_Right_Resize OR Resize_Location = Top_Right_Resize THEN
-- -- Screen.Right := Screen.Left + Decoration_Width + Current_Width;
-- -- IF Screen.Right > Work_Area.Right THEN
-- -- Did_Resize_Right := True;
-- -- Screen.Right := Work_Area.Right;
-- -- END IF;
-- -- END IF;
-- -- IF
-- -- Did_Resize_Right OR
-- -- Did_Resize_Left OR
-- -- Did_Resize_Top OR
-- -- Did_Resize_Bottom THEN
-- -- NULL;--RETURN Handle_Resize(
-- -- -- Resize_Location => Resize_Location,
-- -- -- Previous_Screen => Previous_Screen,
-- -- -- Current_Screen => Screen,
-- -- -- Work_Area => Work_Area,
-- -- -- Decoration_Area => Decoration_Area);
-- -- END IF;
-- CASE Resize_Location IS
-- WHEN Bottom_Right_Resize =>
-- IF Screen.Right > Work_Area.Right OR Screen.Bottom > Work_Area.Bottom THEN
-- Screen := Previous_Screen;
-- END IF;
-- WHEN Bottom_Left_Resize =>
-- IF Screen.Left < Work_Area.Left OR Screen.Bottom > Work_Area.Bottom THEN
-- Screen := Previous_Screen;
-- END IF;
-- WHEN Top_Left_Resize =>
-- IF Screen.Top < Work_Area.Top OR Screen.Left < Work_Area.Left THEN
-- Screen := Previous_Screen;
-- END IF;
-- WHEN Top_Right_Resize =>
-- IF Screen.Top < Work_Area.Top OR Screen.Right > Work_Area.Right THEN
-- Screen := Previous_Screen;
-- END IF;
-- WHEN others =>
-- NULL;
-- END CASE;
-- WHEN others =>
-- NULL;
-- END CASE;
-- Window.X := Screen.Left;
-- Window.Y := Screen.Top;
-- Window.Width := (Screen.Right - Screen.Left);
-- Window.Height := (Screen.Bottom - Screen.Top);
-- Protected_Data.Set(Window);
-- Center_X := Screen.Left + (Window.Width) / 2;
-- Center_Y := Screen.Top + (Window.Height) / 2;
RETURN Screen;
END Handle_Resize;
END Neo.System.Window;