Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/gfxdemo/gfxdemo.c

    rd0dfbba r400a16d  
    11/*
    2  * Copyright (c) 2026 Jiri Svoboda
     2 * Copyright (c) 2021 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    3636#include <display.h>
    3737#include <fibril.h>
    38 #include <fibril_synch.h>
    3938#include <gfx/bitmap.h>
    4039#include <gfx/color.h>
     
    5251#include <ui/window.h>
    5352#include <ui/wdecor.h>
    54 #include "gfxdemo.h"
    5553
    5654static void wnd_close_event(void *);
     
    6260};
    6361
    64 static void uiwnd_resize_event(ui_window_t *, void *);
    6562static void uiwnd_close_event(ui_window_t *, void *);
    6663static void uiwnd_kbd_event(ui_window_t *, void *, kbd_event_t *);
    6764
    6865static ui_window_cb_t ui_window_cb = {
    69         .resize = uiwnd_resize_event,
    7066        .close = uiwnd_close_event,
    7167        .kbd = uiwnd_kbd_event
    7268};
    7369
    74 static void demo_kbd_event(kbd_event_t *);
    75 
    7670static bool quit = false;
    77 static FIBRIL_MUTEX_INITIALIZE(quit_lock);
    78 static FIBRIL_CONDVAR_INITIALIZE(quit_cv);
    7971static gfx_typeface_t *tface;
    8072static gfx_font_t *font;
    8173static gfx_coord_t vpad;
    82 static console_ctrl_t *con = NULL;
    83 static bool textmode;
    84 static console_gc_t *cgc = NULL;
    85 static unsigned scr_width, scr_height;
    86 static ui_t *ui;
    8774
    8875/** Determine if we are running in text mode.
    8976 *
     77 * @param w Screen width
     78 * @param h Screen height
    9079 * @return @c true iff we are running in text mode
    9180 */
    92 static bool demo_is_text(void)
    93 {
    94         return textmode;
    95 }
    96 
    97 /** Sleep until timeout or quit request.
    98  *
    99  * @param msec Number of microseconds to sleep for
    100  */
    101 static void demo_msleep(unsigned msec)
    102 {
    103         errno_t rc;
    104         usec_t usec;
    105         cons_event_t cevent;
    106         sysarg_t cols, rows;
    107 
    108         if (ui != NULL)
    109                 ui_unlock(ui);
    110         fibril_mutex_lock(&quit_lock);
    111         if (!quit) {
    112                 if (con != NULL) {
    113                         usec = (usec_t)msec * 1000;
    114                         while (usec > 0 && !quit) {
    115                                 rc = console_get_event_timeout(con, &cevent, &usec);
    116                                 if (rc == EOK) {
    117                                         if (cevent.type == CEV_KEY) {
    118                                                 fibril_mutex_unlock(&quit_lock);
    119                                                 demo_kbd_event(&cevent.ev.key);
    120                                                 fibril_mutex_lock(&quit_lock);
    121                                         } else if (cevent.type == CEV_RESIZE) {
    122                                                 rc = console_get_size(con,
    123                                                     &cols, &rows);
    124                                                 if (rc == EOK) {
    125                                                         scr_width = cols;
    126                                                         scr_height = rows;
    127                                                 }
    128                                                 rc = console_gc_resize(cgc);
    129                                                 if (rc != EOK)
    130                                                         exit(1);
    131                                         }
    132                                 }
    133                         }
    134                 } else {
    135                         (void) fibril_condvar_wait_timeout(&quit_cv, &quit_lock,
    136                             (usec_t)msec * 1000);
    137                 }
    138         }
    139         fibril_mutex_unlock(&quit_lock);
    140         if (ui != NULL)
    141                 ui_lock(ui);
     81static bool demo_is_text(gfx_coord_t w, gfx_coord_t h)
     82{
     83        // XXX Need a proper way to determine text mode
     84        return w <= 80;
    14285}
    14386
     
    195138
    196139        /* XXX Crude way of detecting text mode */
    197         if (demo_is_text()) {
     140        if (w < 256) {
    198141                /* Create dummy font for text mode */
    199142                rc = gfx_typeface_create(gc, &tface);
     
    284227
    285228        if (font != NULL) {
    286                 if (demo_is_text()) {
     229                if (demo_is_text(w, h)) {
    287230                        rc = gfx_color_new_ega(0x1e, &color);
    288231                        if (rc != EOK)
     
    295238
    296239                gfx_text_fmt_init(&fmt);
    297                 fmt.font = font;
    298240                fmt.color = color;
    299241                fmt.halign = gfx_halign_center;
     
    301243
    302244                pos.x = w / 2;
    303                 pos.y = h;
    304                 rc = gfx_puttext(&pos, &fmt, text);
     245                pos.y = h - 1;
     246                rc = gfx_puttext(font, &pos, &fmt, text);
    305247                if (rc != EOK) {
    306248                        printf("Error rendering text.\n");
     
    373315                gfx_color_delete(color);
    374316
    375                 demo_msleep(500);
     317                fibril_usleep(500 * 1000);
     318
    376319                if (quit)
    377320                        break;
     
    407350                for (j = 0; j < h; j++) {
    408351                        pixelmap_put_pixel(&pixelmap, i, j,
    409                             PIXEL(255, (i % 30) < 3 ? 255 : 0,
     352                            PIXEL(0, (i % 30) < 3 ? 255 : 0,
    410353                            (j % 30) < 3 ? 255 : 0, i / 2));
    411354                }
     
    443386                        k = i * i + j * j;
    444387                        pixelmap_put_pixel(&pixelmap, i, j,
    445                             PIXEL(255, k, k, k));
     388                            PIXEL(0, k, k, k));
    446389                }
    447390        }
     
    478421                        k = i * i + j * j;
    479422                        pixelmap_put_pixel(&pixelmap, i, j,
    480                             k < w * w / 2 ? PIXEL(255, 0, 255, 0) :
    481                             PIXEL(255, 255, 0, 255));
     423                            k < w * w / 2 ? PIXEL(0, 0, 255, 0) :
     424                            PIXEL(0, 255, 0, 255));
    482425                }
    483426        }
     
    534477                        if (rc != EOK)
    535478                                goto error;
    536 
    537                         demo_msleep(250);
     479                        fibril_usleep(250 * 1000);
     480
    538481                        if (quit)
    539482                                goto out;
     
    595538                }
    596539
    597                 demo_msleep(500);
     540                fibril_usleep(500 * 1000);
     541
    598542                if (quit)
    599543                        break;
     
    635579        params.rect.p1.y = 40;
    636580        params.flags = bmpf_color_key;
    637         params.key_color = PIXEL(255, 255, 0, 255);
     581        params.key_color = PIXEL(0, 255, 0, 255);
    638582
    639583        rc = gfx_bitmap_create(gc, &params, NULL, &bitmap);
     
    655599                }
    656600
    657                 demo_msleep(500);
     601                fibril_usleep(500 * 1000);
     602
    658603                if (quit)
    659604                        break;
     
    733678        gfx_color_delete(color);
    734679
    735         if (demo_is_text()) {
     680        if (demo_is_text(w, h)) {
    736681                rc = gfx_color_new_ega(0x1f, &color);
    737682                if (rc != EOK)
     
    744689
    745690        gfx_text_fmt_init(&fmt);
    746         fmt.font = font;
    747691        fmt.color = color;
    748692
    749693        pos.x = rect.p0.x;
    750694        pos.y = rect.p0.y;
    751         rc = gfx_puttext(&pos, &fmt, "Top left");
     695        rc = gfx_puttext(font, &pos, &fmt, "Top left");
    752696        if (rc != EOK) {
    753697                printf("Error rendering text.\n");
     
    758702        pos.y = rect.p0.y;
    759703        fmt.halign = gfx_halign_center;
    760         rc = gfx_puttext(&pos, &fmt, "Top center");
     704        rc = gfx_puttext(font, &pos, &fmt, "Top center");
    761705        if (rc != EOK)
    762706                goto error;
     
    765709        pos.y = rect.p0.y;
    766710        fmt.halign = gfx_halign_right;
    767         rc = gfx_puttext(&pos, &fmt, "Top right");
     711        rc = gfx_puttext(font, &pos, &fmt, "Top right");
    768712        if (rc != EOK)
    769713                goto error;
     
    774718        pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
    775719        fmt.halign = gfx_halign_left;
    776         rc = gfx_puttext(&pos, &fmt, "Center left");
     720        rc = gfx_puttext(font, &pos, &fmt, "Center left");
    777721        if (rc != EOK)
    778722                goto error;
     
    781725        pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
    782726        fmt.halign = gfx_halign_center;
    783         rc = gfx_puttext(&pos, &fmt, "Center");
     727        rc = gfx_puttext(font, &pos, &fmt, "Center");
    784728        if (rc != EOK)
    785729                goto error;
     
    788732        pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
    789733        fmt.halign = gfx_halign_right;
    790         rc = gfx_puttext(&pos, &fmt, "Center right");
     734        rc = gfx_puttext(font, &pos, &fmt, "Center right");
    791735        if (rc != EOK)
    792736                goto error;
     
    797741        pos.y = rect.p1.y - 1;
    798742        fmt.halign = gfx_halign_left;
    799         rc = gfx_puttext(&pos, &fmt, "Bottom left");
     743        rc = gfx_puttext(font, &pos, &fmt, "Bottom left");
    800744        if (rc != EOK)
    801745                goto error;
     
    804748        pos.y = rect.p1.y;
    805749        fmt.halign = gfx_halign_center;
    806         rc = gfx_puttext(&pos, &fmt, "Bottom center");
     750        rc = gfx_puttext(font, &pos, &fmt, "Bottom center");
    807751        if (rc != EOK)
    808752                goto error;
     
    811755        pos.y = rect.p1.y;
    812756        fmt.halign = gfx_halign_right;
    813         rc = gfx_puttext(&pos, &fmt, "Bottom right");
     757        rc = gfx_puttext(font, &pos, &fmt, "Bottom right");
    814758        if (rc != EOK)
    815759                goto error;
     
    818762
    819763        gfx_text_fmt_init(&fmt);
    820         fmt.font = font;
    821764
    822765        for (i = 0; i < 8; i++) {
    823                 if (demo_is_text()) {
     766                if (demo_is_text(w, h)) {
    824767                        rc = gfx_color_new_ega(i != 0 ? i : 0x10, &color);
    825768                        if (rc != EOK)
     
    833776
    834777                fmt.color = color;
    835                 fmt.underline = !fmt.underline;
    836778
    837779                pos.x = w / 20;
    838780                pos.y = (6 + i) * h / 15;
    839                 rc = gfx_puttext(&pos, &fmt, "The quick brown fox jumps over the lazy dog.");
     781                rc = gfx_puttext(font, &pos, &fmt, "The quick brown fox jumps over the lazy dog.");
    840782                if (rc != EOK)
    841783                        goto error;
     
    845787
    846788        for (i = 0; i < 10; i++) {
    847                 demo_msleep(500);
    848                 if (quit)
    849                         break;
    850         }
    851 
    852         return EOK;
    853 error:
    854         return rc;
    855 }
    856 
    857 /** Run text abbreviation demo on a graphic context.
    858  *
    859  * @param gc Graphic context
    860  * @param w Width
    861  * @param h Height
    862  */
    863 static errno_t demo_text_abbr(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
    864 {
    865         gfx_color_t *color = NULL;
    866         gfx_rect_t rect;
    867         gfx_coord2_t pos;
    868         gfx_text_fmt_t fmt;
    869         int i;
    870         errno_t rc;
    871 
    872         if (quit)
    873                 return EOK;
    874 
    875         rc = demo_begin(gc, w, h, "Text abbreviation");
    876         if (rc != EOK)
    877                 goto error;
    878 
    879         for (i = 0; i < 11; i++) {
    880 
    881                 rc = gfx_color_new_rgb_i16(0, 0, 0x8000, &color);
    882                 if (rc != EOK)
    883                         goto error;
    884 
    885                 rc = gfx_set_color(gc, color);
    886                 if (rc != EOK)
    887                         goto error;
    888 
    889                 rect.p0.x = w / 20;
    890                 rect.p0.y = (2 + 2 * i) * h / 25;
    891                 rect.p1.x = w - w / 20 - w * i / 12;
    892                 rect.p1.y = (3 + 2 * i) * h / 25;
    893 
    894                 rc = gfx_fill_rect(gc, &rect);
    895                 if (rc != EOK)
    896                         goto error;
    897 
    898                 gfx_color_delete(color);
    899 
    900                 if (demo_is_text()) {
    901                         rc = gfx_color_new_ega(0x1f, &color);
    902                         if (rc != EOK)
    903                                 goto error;
    904                 } else {
    905                         rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff,
    906                             &color);
    907                         if (rc != EOK)
    908                                 goto error;
    909                 }
    910 
    911                 gfx_text_fmt_init(&fmt);
    912                 fmt.font = font;
    913                 fmt.color = color;
    914                 fmt.abbreviate = true;
    915                 fmt.width = rect.p1.x - rect.p0.x;
    916 
    917                 pos.x = rect.p0.x;
    918                 pos.y = rect.p0.y;
    919                 rc = gfx_puttext(&pos, &fmt,
    920                     "The quick brow fox jumps over the lazy dog!");
    921                 if (rc != EOK) {
    922                         printf("Error rendering text.\n");
    923                         goto error;
    924                 }
    925         }
    926 
    927         for (i = 0; i < 10; i++) {
    928                 demo_msleep(500);
     789                fibril_usleep(500 * 1000);
    929790                if (quit)
    930791                        break;
     
    1023884                }
    1024885
    1025                 demo_msleep(500);
     886                fibril_usleep(500 * 1000);
     887
    1026888                if (quit)
    1027889                        break;
     
    1040902 *
    1041903 * @param gc Graphic context
    1042  */
    1043 static errno_t demo_loop(gfx_context_t *gc)
    1044 {
    1045         errno_t rc;
    1046 
    1047         (void) demo_font_init(gc, scr_width, scr_height);
     904 * @param w Width
     905 * @param h Height
     906 */
     907static errno_t demo_loop(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
     908{
     909        errno_t rc;
     910
     911        (void) demo_font_init(gc, w, h);
    1048912
    1049913        while (!quit) {
    1050                 rc = demo_rects(gc, scr_width, scr_height);
    1051                 if (rc != EOK)
    1052                         goto error;
    1053 
    1054                 rc = demo_bitmap(gc, scr_width, scr_height);
    1055                 if (rc != EOK)
    1056                         goto error;
    1057 
    1058                 rc = demo_bitmap2(gc, scr_width, scr_height);
    1059                 if (rc != EOK)
    1060                         goto error;
    1061 
    1062                 rc = demo_bitmap_kc(gc, scr_width, scr_height);
    1063                 if (rc != EOK)
    1064                         goto error;
    1065 
    1066                 rc = demo_text(gc, scr_width, scr_height);
    1067                 if (rc != EOK)
    1068                         goto error;
    1069 
    1070                 rc = demo_text_abbr(gc, scr_width, scr_height);
    1071                 if (rc != EOK)
    1072                         goto error;
    1073 
    1074                 rc = demo_clip(gc, scr_width, scr_height);
     914                rc = demo_rects(gc, w, h);
     915                if (rc != EOK)
     916                        goto error;
     917
     918                rc = demo_bitmap(gc, w, h);
     919                if (rc != EOK)
     920                        goto error;
     921
     922                rc = demo_bitmap2(gc, w, h);
     923                if (rc != EOK)
     924                        goto error;
     925
     926                rc = demo_bitmap_kc(gc, w, h);
     927                if (rc != EOK)
     928                        goto error;
     929
     930                rc = demo_text(gc, w, h);
     931                if (rc != EOK)
     932                        goto error;
     933
     934                rc = demo_clip(gc, w, h);
    1075935                if (rc != EOK)
    1076936                        goto error;
     
    1087947static errno_t demo_console(void)
    1088948{
     949        console_ctrl_t *con = NULL;
     950        console_gc_t *cgc = NULL;
    1089951        gfx_context_t *gc;
    1090         sysarg_t cols, rows;
    1091         errno_t rc;
    1092 
     952        errno_t rc;
     953
     954        printf("Init console..\n");
    1093955        con = console_init(stdin, stdout);
    1094956        if (con == NULL)
    1095957                return EIO;
    1096958
    1097         rc = console_get_size(con, &cols, &rows);
    1098         if (rc != EOK)
    1099                 return rc;
    1100 
     959        printf("Create console GC\n");
    1101960        rc = console_gc_create(con, stdout, &cgc);
    1102961        if (rc != EOK)
     
    1105964        gc = console_gc_get_ctx(cgc);
    1106965
    1107         /* Currently console is always text. */
    1108         textmode = true;
    1109 
    1110         scr_width = cols;
    1111         scr_height = rows;
    1112 
    1113         rc = demo_loop(gc);
     966        rc = demo_loop(gc, 80, 25);
    1114967        if (rc != EOK)
    1115968                return rc;
     
    1120973
    1121974        return EOK;
    1122 }
    1123 
    1124 static errno_t demo_ui_fibril(void *arg)
    1125 {
    1126         demo_ui_args_t *args = (demo_ui_args_t *)arg;
    1127         errno_t rc;
    1128 
    1129         ui_lock(args->ui);
    1130         scr_width = args->dims.x;
    1131         scr_height = args->dims.y;
    1132         rc = demo_loop(args->gc);
    1133         ui_unlock(args->ui);
    1134         ui_quit(args->ui);
    1135         return rc;
    1136975}
    1137976
     
    1139978static errno_t demo_ui(const char *display_spec)
    1140979{
     980        ui_t *ui = NULL;
    1141981        ui_wnd_params_t params;
    1142982        ui_window_t *window = NULL;
     
    1145985        gfx_rect_t wrect;
    1146986        gfx_coord2_t off;
    1147         gfx_rect_t ui_rect;
    1148         gfx_coord2_t dims;
    1149         demo_ui_args_t args;
    1150         fid_t fid;
    1151         errno_t rc;
     987        errno_t rc;
     988
     989        printf("Init UI..\n");
    1152990
    1153991        rc = ui_create(display_spec, &ui);
    1154992        if (rc != EOK) {
    1155993                printf("Error initializing UI (%s)\n", display_spec);
    1156                 goto error;
    1157         }
    1158 
    1159         rc = ui_get_rect(ui, &ui_rect);
    1160         if (rc != EOK) {
    1161                 printf("Error getting display size.\n");
    1162994                goto error;
    1163995        }
     
    11711003        params.caption = "GFX Demo";
    11721004
    1173         /* Do not decorate the window in fullscreen mode */
    1174         if (ui_is_fullscreen(ui)) {
    1175                 params.style &= ~ui_wds_decorated;
    1176                 params.placement = ui_wnd_place_full_screen;
    1177         }
    1178 
    11791005        /*
    11801006         * Compute window rectangle such that application area corresponds
    11811007         * to rect
    11821008         */
    1183         ui_wdecor_rect_from_app(ui, params.style, &rect, &wrect);
     1009        ui_wdecor_rect_from_app(params.style, &rect, &wrect);
    11841010        off = wrect.p0;
    11851011        gfx_rect_rtranslate(&off, &wrect, &params.rect);
    1186 
    1187         gfx_rect_dims(&ui_rect, &dims);
    1188 
    1189         /* Make sure window is not larger than the entire screen */
    1190         if (params.rect.p1.x > dims.x)
    1191                 params.rect.p1.x = dims.x;
    1192         if (params.rect.p1.y > dims.y)
    1193                 params.rect.p1.y = dims.y;
    11941012
    11951013        rc = ui_window_create(ui, &params, &window);
     
    12071025        }
    12081026
    1209         ui_window_get_app_rect(window, &rect);
    1210         gfx_rect_dims(&rect, &dims);
    1211 
    1212         if (!ui_is_fullscreen(ui))
    1213                 task_retval(0);
    1214 
    1215         textmode = ui_is_textmode(ui);
    1216 
    1217         args.gc = gc;
    1218         args.dims = dims;
    1219         args.ui = ui;
    1220 
    1221         fid = fibril_create(demo_ui_fibril, (void *)&args);
    1222         if (fid == 0) {
    1223                 rc = ENOMEM;
    1224                 goto error;
    1225         }
    1226 
    1227         fibril_add_ready(fid);
    1228 
    1229         ui_run(ui);
     1027        task_retval(0);
     1028
     1029        rc = demo_loop(gc, rect.p1.x, rect.p1.y);
     1030        if (rc != EOK)
     1031                goto error;
     1032
    12301033        ui_window_destroy(window);
    12311034        ui_destroy(ui);
     
    12491052        errno_t rc;
    12501053
     1054        printf("Init display..\n");
     1055
    12511056        rc = display_open(display_svc, &display);
    12521057        if (rc != EOK) {
     
    12601065        params.rect.p1.x = 400;
    12611066        params.rect.p1.y = 300;
    1262         params.caption = "GFX Demo";
    12631067
    12641068        rc = display_window_create(display, &params, &wnd_cb, NULL, &window);
     
    12761080        task_retval(0);
    12771081
    1278         /* FIXME Assuming display service is not text mode. */
    1279         textmode = false;
    1280 
    1281         scr_width = 400;
    1282         scr_height = 300;
    1283         rc = demo_loop(gc);
     1082        rc = demo_loop(gc, 400, 300);
    12841083        if (rc != EOK)
    12851084                return rc;
     
    12951094}
    12961095
    1297 static void demo_quit(void)
    1298 {
    1299         fibril_mutex_lock(&quit_lock);
     1096static void wnd_close_event(void *arg)
     1097{
     1098        printf("Close event\n");
    13001099        quit = true;
    1301         fibril_mutex_unlock(&quit_lock);
    1302         fibril_condvar_broadcast(&quit_cv);
    1303 }
    1304 
    1305 static void wnd_close_event(void *arg)
    1306 {
    1307         demo_quit();
    1308 }
    1309 
    1310 static void demo_kbd_event(kbd_event_t *event)
    1311 {
    1312         if (event->type == KEY_PRESS) {
    1313                 /* Ctrl-Q */
    1314                 if ((event->mods & KM_CTRL) != 0 &&
    1315                     (event->mods & KM_ALT) == 0 &&
    1316                     (event->mods & KM_SHIFT) == 0 &&
    1317                     event->key == KC_Q) {
    1318                         demo_quit();
    1319                 }
    1320 
    1321                 /* Escape */
    1322                 if ((event->mods & KM_CTRL) == 0 &&
    1323                     (event->mods & KM_ALT) == 0 &&
    1324                     (event->mods & KM_SHIFT) == 0 &&
    1325                     event->key == KC_ESCAPE) {
    1326                         demo_quit();
    1327                 }
    1328         }
    13291100}
    13301101
    13311102static void wnd_kbd_event(void *arg, kbd_event_t *event)
    13321103{
    1333         (void)arg;
    1334         demo_kbd_event(event);
    1335 }
    1336 
    1337 static void uiwnd_resize_event(ui_window_t *window, void *arg)
    1338 {
    1339         gfx_rect_t rect;
    1340         gfx_coord2_t dims;
    1341 
    1342         ui_window_get_app_rect(window, &rect);
    1343         gfx_rect_dims(&rect, &dims);
    1344         scr_width = dims.x;
    1345         scr_height = dims.y;
     1104        printf("Keyboard event type=%d key=%d\n", event->type, event->key);
     1105        if (event->type == KEY_PRESS)
     1106                quit = true;
    13461107}
    13471108
    13481109static void uiwnd_close_event(ui_window_t *window, void *arg)
    13491110{
    1350         demo_quit();
     1111        printf("Close event\n");
     1112        quit = true;
    13511113}
    13521114
    13531115static void uiwnd_kbd_event(ui_window_t *window, void *arg, kbd_event_t *event)
    13541116{
    1355         (void)window;
    1356         (void)arg;
    1357         demo_kbd_event(event);
     1117        printf("Keyboard event type=%d key=%d\n", event->type, event->key);
     1118        if (event->type == KEY_PRESS)
     1119                quit = true;
    13581120}
    13591121
     
    13671129        errno_t rc;
    13681130        const char *display_svc = DISPLAY_DEFAULT;
    1369         const char *ui_display_spec = UI_ANY_DEFAULT;
    13701131        int i;
    13711132
     
    13801141                        }
    13811142
    1382                         display_svc = ui_display_spec = argv[i++];
     1143                        display_svc = argv[i++];
    13831144                } else {
    13841145                        printf("Invalid option '%s'.\n", argv[i]);
     
    13881149        }
    13891150
    1390         if (i >= argc || str_cmp(argv[i], "ui") == 0) {
    1391                 rc = demo_ui(ui_display_spec);
     1151        if (i >= argc || str_cmp(argv[i], "display") == 0) {
     1152                rc = demo_display(display_svc);
    13921153                if (rc != EOK)
    13931154                        return 1;
     
    13961157                if (rc != EOK)
    13971158                        return 1;
    1398         } else if (str_cmp(argv[i], "display") == 0) {
    1399                 rc = demo_display(display_svc);
     1159        } else if (str_cmp(argv[i], "ui") == 0) {
     1160                rc = demo_ui(display_svc);
    14001161                if (rc != EOK)
    14011162                        return 1;
Note: See TracChangeset for help on using the changeset viewer.