Skip to content

Commit 47f28fc

Browse files
committed
libgws: Centralize the container window for the messagebox/dialogbox
1 parent 71478d2 commit 47f28fc

File tree

3 files changed

+40
-7
lines changed

3 files changed

+40
-7
lines changed

apps/api/libs/libgws/gws.c

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4536,6 +4536,21 @@ int gws_dialog_box(int fd, int parent_wid, const char *message, int type)
45364536
int fInvalidParentWindow = FALSE;
45374537
int fClose = FALSE;
45384538

4539+
unsigned long dialog_l = 0;
4540+
unsigned long dialog_t = 0;
4541+
unsigned long dialog_w = 0;
4542+
unsigned long dialog_h = 0;
4543+
unsigned long screen_w = gws_get_system_metrics(1);
4544+
unsigned long screen_h = gws_get_system_metrics(2);
4545+
4546+
// Desired dialog size
4547+
4548+
dialog_w = 240;
4549+
dialog_h = 120;
4550+
// Center coordinates
4551+
dialog_l = (screen_w - dialog_w) / 2;
4552+
dialog_t = (screen_h - dialog_h) / 2;
4553+
45394554
// Parameters validation
45404555
// Make sure we don't proceed with invalid inputs.
45414556
if (fd < 0)
@@ -4619,7 +4634,7 @@ int gws_dialog_box(int fd, int parent_wid, const char *message, int type)
46194634
WINDOW_STATUS_ACTIVE,
46204635
WINDOW_STATE_NULL,
46214636
"DialogBox",
4622-
100, 100, 240, 120,
4637+
dialog_l, dialog_t, dialog_w, dialog_h,
46234638
__pw_wid,
46244639
0,
46254640
bg_color,
@@ -4783,9 +4798,24 @@ int gws_message_box(int fd, int parent_wid, const char *message, int type)
47834798
int Type = type;
47844799
int __pw_wid = parent_wid;
47854800
int fInvalidParentWindow = FALSE;
4786-
47874801
int fClose = FALSE;
47884802

4803+
unsigned long dialog_l = 0;
4804+
unsigned long dialog_t = 0;
4805+
unsigned long dialog_w = 0;
4806+
unsigned long dialog_h = 0;
4807+
unsigned long screen_w = gws_get_system_metrics(1);
4808+
unsigned long screen_h = gws_get_system_metrics(2);
4809+
4810+
// Desired dialog size
4811+
4812+
dialog_w = 240;
4813+
dialog_h = 120;
4814+
// Center coordinates
4815+
dialog_l = (screen_w - dialog_w) / 2;
4816+
dialog_t = (screen_h - dialog_h) / 2;
4817+
4818+
47894819
// Parameters validation
47904820
// Make sure we don't proceed with invalid inputs.
47914821
if (fd < 0)
@@ -4871,7 +4901,7 @@ int gws_message_box(int fd, int parent_wid, const char *message, int type)
48714901
WINDOW_STATUS_ACTIVE,
48724902
WINDOW_STATE_NULL,
48734903
"MessageBox",
4874-
100, 100, 240, 120,
4904+
dialog_l, dialog_t, dialog_w, dialog_h,
48754905
__pw_wid,
48764906
0,
48774907
bg_color,

apps/menuapp/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ menuappProcedure(
182182
rv =
183183
(int) gws_message_box(fd, main_window, "My message box",MSGBOX_INFO);
184184
printf ("Return value = %d\n",rv);
185+
__paint_worker(fd);
185186
}
186187
if ((int) long1 == MyMenuInfo.item3_wid)
187188
{
@@ -194,6 +195,8 @@ menuappProcedure(
194195
printf("YES\n");
195196
if (rv == 0)
196197
printf("NO\n");
198+
199+
__paint_worker(fd);
197200
}
198201
break;
199202

init/src/inittask/inittask.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ xxxProcessEvent (
253253
//#debug
254254
//printf("init.bin: 4002, from {%d}\n",caller_tid);
255255
memset(__filename_local_buffer,0,64);
256-
sprintf(__filename_local_buffer,"#dbox.bin");
257-
//sprintf(__filename_local_buffer,"#launch.bin");
256+
//sprintf(__filename_local_buffer,"#dbox.bin");
257+
sprintf(__filename_local_buffer,"#launch.bin");
258258
//sprintf(__filename_local_buffer,"#power.bin");
259259
rtl_clone_and_execute(__filename_local_buffer);
260260
return 0;
@@ -273,8 +273,8 @@ xxxProcessEvent (
273273
//#debug
274274
//printf("init.bin: 4003, from {%d}\n",caller_tid);
275275
memset(__filename_local_buffer,0,64);
276-
sprintf(__filename_local_buffer,"#mbox.bin");
277-
//sprintf(__filename_local_buffer,"#menuapp.bin");
276+
//sprintf(__filename_local_buffer,"#mbox.bin");
277+
sprintf(__filename_local_buffer,"#menuapp.bin");
278278
//sprintf(__filename_local_buffer,"#memory.bin");
279279
rtl_clone_and_execute(__filename_local_buffer);
280280
return 0;

0 commit comments

Comments
 (0)