Subversion Repositories HelenOS

Rev

Rev 2618 | Rev 2621 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2618 Rev 2619
Line 275... Line 275...
275
        clrscr();
275
        clrscr();
276
        style = &conn->screenbuffer.style;
276
        style = &conn->screenbuffer.style;
277
 
277
 
278
        for (j = 0; j < conn->screenbuffer.size_y; j++)
278
        for (j = 0; j < conn->screenbuffer.size_y; j++)
279
            for (i = 0; i < conn->screenbuffer.size_x; i++) {
279
            for (i = 0; i < conn->screenbuffer.size_x; i++) {
280
                field = get_field_at(&conn->screenbuffer, i,
280
                field = get_field_at(&conn->screenbuffer, i, j);
281
                    j);
-
 
282
                if (!style_same(*style, field->style))
281
                if (!style_same(*style, field->style))
283
                    set_style(&field->style);
282
                    set_style(&field->style);
284
                style = &field->style;
283
                style = &field->style;
285
                if ((field->character == ' ') &&
284
                if ((field->character == ' ') &&
286
                    (style_same(field->style,
285
                    (style_same(field->style,
Line 347... Line 346...
347
            }
346
            }
348
           
347
           
349
            /* if client is awaiting key, send it */
348
            /* if client is awaiting key, send it */
350
            if (conn->keyrequest_counter > 0) {    
349
            if (conn->keyrequest_counter > 0) {    
351
                conn->keyrequest_counter--;
350
                conn->keyrequest_counter--;
352
                ipc_answer_fast(fifo_pop(conn->keyrequests), 0,
351
                ipc_answer_1(fifo_pop(conn->keyrequests), EOK,
353
                    c, 0);
352
                    c);
354
                break;
353
                break;
355
            }
354
            }
356
           
355
           
357
            keybuffer_push(&conn->keybuffer, c);
356
            keybuffer_push(&conn->keybuffer, c);
358
            retval = 0;
357
            retval = 0;
359
           
358
           
360
            break;
359
            break;
361
        default:
360
        default:
362
            retval = ENOENT;
361
            retval = ENOENT;
363
        }
362
        }
364
        ipc_answer_fast(callid, retval, 0, 0);
363
        ipc_answer_0(callid, retval);
365
    }
364
    }
366
}
365
}
367
 
366
 
368
/** Default thread for new connections */
367
/** Default thread for new connections */
369
static void client_connection(ipc_callid_t iid, ipc_call_t *icall)
368
static void client_connection(ipc_callid_t iid, ipc_call_t *icall)
Line 373... Line 372...
373
    int consnum;
372
    int consnum;
374
    ipcarg_t arg1, arg2;
373
    ipcarg_t arg1, arg2;
375
    connection_t *conn;
374
    connection_t *conn;
376
 
375
 
377
    if ((consnum = find_free_connection()) == -1) {
376
    if ((consnum = find_free_connection()) == -1) {
378
        ipc_answer_fast(iid, ELIMIT, 0, 0);
377
        ipc_answer_0(iid, ELIMIT);
379
        return;
378
        return;
380
    }
379
    }
381
    conn = &connections[consnum];
380
    conn = &connections[consnum];
382
    conn->used = 1;
381
    conn->used = 1;
383
   
382
   
Line 385... Line 384...
385
    gcons_notify_connect(consnum);
384
    gcons_notify_connect(consnum);
386
    conn->client_phone = IPC_GET_ARG3(call);
385
    conn->client_phone = IPC_GET_ARG3(call);
387
    screenbuffer_clear(&conn->screenbuffer);
386
    screenbuffer_clear(&conn->screenbuffer);
388
   
387
   
389
    /* Accept the connection */
388
    /* Accept the connection */
390
    ipc_answer_fast(iid, 0, 0, 0);
389
    ipc_answer_0(iid, EOK);
391
 
390
 
392
    while (1) {
391
    while (1) {
393
        async_serialize_end();
392
        async_serialize_end();
394
        callid = async_get_call(&call);
393
        callid = async_get_call(&call);
395
        async_serialize_start();
394
        async_serialize_start();
Line 401... Line 400...
401
            gcons_notify_disconnect(consnum);
400
            gcons_notify_disconnect(consnum);
402
           
401
           
403
            /* Answer all pending requests */
402
            /* Answer all pending requests */
404
            while (conn->keyrequest_counter > 0) {     
403
            while (conn->keyrequest_counter > 0) {     
405
                conn->keyrequest_counter--;
404
                conn->keyrequest_counter--;
406
                ipc_answer_fast(fifo_pop(conn->keyrequests),
405
                ipc_answer_0(fifo_pop(conn->keyrequests),
407
                    ENOENT, 0, 0);
406
                    ENOENT);
408
                break;
407
                break;
409
            }
408
            }
410
            conn->used = 0;
409
            conn->used = 0;
411
            return;
410
            return;
412
        case CONSOLE_PUTCHAR:
411
        case CONSOLE_PUTCHAR:
Line 462... Line 461...
462
                } else {
461
                } else {
463
                    /*
462
                    /*
464
                     * No key available and too many
463
                     * No key available and too many
465
                     * requests => fail.
464
                     * requests => fail.
466
                    */
465
                    */
467
                    ipc_answer_fast(callid, ELIMIT, 0, 0);
466
                    ipc_answer_0(callid, ELIMIT);
468
                }
467
                }
469
                continue;
468
                continue;
470
            }
469
            }
471
            keybuffer_pop(&conn->keybuffer, (int *) &arg1);
470
            keybuffer_pop(&conn->keybuffer, (int *) &arg1);
472
            break;
471
            break;
473
        }
472
        }
474
        ipc_answer_fast(callid, 0, arg1, arg2);
473
        ipc_answer_2(callid, EOK, arg1, arg2);
475
    }
474
    }
476
}
475
}
477
 
476
 
478
int main(int argc, char *argv[])
477
int main(int argc, char *argv[])
479
{
478
{