Skip to content
Snippets Groups Projects
Commit cb7438d6 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Add min_height and min_width, remove the transparent attribute.

It's expected that transparency will be handled by special values.
parent 0270d786
No related branches found
No related tags found
No related merge requests found
Pipeline #5440 passed
...@@ -45,13 +45,14 @@ attributes[] = { ...@@ -45,13 +45,14 @@ attributes[] = {
{"locked", "bool", attr_impl_root, 0}, {"locked", "bool", attr_impl_root, 0},
{"locked_by_me", "bool", attr_impl_root, 1}, {"locked_by_me", "bool", attr_impl_root, 1},
{"lowerpeer", "NewIfcObj", attr_impl_global, 1}, {"lowerpeer", "NewIfcObj", attr_impl_global, 1},
{"min_height", "uint16_t", attr_impl_global, 1},
{"min_width", "uint16_t", attr_impl_global, 1},
{"parent", "NewIfcObj", attr_impl_global, 1}, {"parent", "NewIfcObj", attr_impl_global, 1},
{"root", "NewIfcObj", attr_impl_global, 1}, {"root", "NewIfcObj", attr_impl_global, 1},
{"show_help", "bool", attr_impl_object, 0}, {"show_help", "bool", attr_impl_object, 0},
{"show_title", "bool", attr_impl_object, 0}, {"show_title", "bool", attr_impl_object, 0},
{"title", "const char *", attr_impl_object, 0}, {"title", "const char *", attr_impl_object, 0},
{"topchild", "NewIfcObj", attr_impl_global, 1}, {"topchild", "NewIfcObj", attr_impl_global, 1},
{"transparent", "bool", attr_impl_object, 0},
{"type", "enum NewIfc_object", attr_impl_global, 1}, {"type", "enum NewIfc_object", attr_impl_global, 1},
{"width", "uint16_t", attr_impl_global, 0}, {"width", "uint16_t", attr_impl_global, 0},
{"xpos", "uint16_t", attr_impl_global, 0}, {"xpos", "uint16_t", attr_impl_global, 0},
...@@ -159,6 +160,8 @@ main(int argc, char **argv) ...@@ -159,6 +160,8 @@ main(int argc, char **argv)
" NI_err last_error;\n" " NI_err last_error;\n"
" uint16_t height;\n" " uint16_t height;\n"
" uint16_t width;\n" " uint16_t width;\n"
" uint16_t min_height;\n"
" uint16_t min_width;\n"
" uint16_t xpos;\n" " uint16_t xpos;\n"
" uint16_t ypos;\n" " uint16_t ypos;\n"
" uint16_t child_height;\n" " uint16_t child_height;\n"
......
...@@ -23,7 +23,6 @@ struct root_window { ...@@ -23,7 +23,6 @@ struct root_window {
size_t title_sz; size_t title_sz;
pthread_mutex_t mtx; pthread_mutex_t mtx;
unsigned locks; unsigned locks;
unsigned transparent:1;
unsigned show_title:1; unsigned show_title:1;
unsigned help:1; unsigned help:1;
unsigned dirty:1; unsigned dirty:1;
...@@ -82,9 +81,6 @@ rw_set(NewIfcObj obj, int attr, ...) ...@@ -82,9 +81,6 @@ rw_set(NewIfcObj obj, int attr, ...)
rw->api.last_error = NewIfc_error_none; rw->api.last_error = NewIfc_error_none;
va_start(ap, attr); va_start(ap, attr);
switch (attr) { switch (attr) {
case NewIfc_transparent:
SET_BOOL(rw, transparent);
break;
case NewIfc_show_title: case NewIfc_show_title:
SET_BOOL(rw, show_title); SET_BOOL(rw, show_title);
break; break;
...@@ -155,9 +151,6 @@ rw_get(NewIfcObj obj, int attr, ...) ...@@ -155,9 +151,6 @@ rw_get(NewIfcObj obj, int attr, ...)
rw->api.last_error = NewIfc_error_none; rw->api.last_error = NewIfc_error_none;
va_start(ap, attr); va_start(ap, attr);
switch (attr) { switch (attr) {
case NewIfc_transparent:
GET_BOOL(rw, transparent);
break;
case NewIfc_show_title: case NewIfc_show_title:
GET_BOOL(rw, show_title); GET_BOOL(rw, show_title);
break; break;
...@@ -245,9 +238,10 @@ NewIFC_root_window(NewIfcObj *newobj) ...@@ -245,9 +238,10 @@ NewIFC_root_window(NewIfcObj *newobj)
(*newrw)->api.child_ypos = 1; (*newrw)->api.child_ypos = 1;
(*newrw)->api.child_width = 80; (*newrw)->api.child_width = 80;
(*newrw)->api.child_height = 23; (*newrw)->api.child_height = 23;
(*newrw)->api.min_height = 2;
(*newrw)->api.min_width = 40;
// TODO: This is only needed by the unit tests... // TODO: This is only needed by the unit tests...
(*newrw)->api.root = *newobj; (*newrw)->api.root = *newobj;
(*newrw)->transparent = false;
(*newrw)->show_title = true; (*newrw)->show_title = true;
(*newrw)->help = true; (*newrw)->help = true;
(*newrw)->title_sz = 0; (*newrw)->title_sz = 0;
...@@ -280,7 +274,8 @@ void test_root_window(CuTest *ct) ...@@ -280,7 +274,8 @@ void test_root_window(CuTest *ct)
CuAssertTrue(ct, obj->last_error == NewIfc_error_none); CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
CuAssertTrue(ct, obj->width == 80); CuAssertTrue(ct, obj->width == 80);
CuAssertTrue(ct, obj->height == 25); CuAssertTrue(ct, obj->height == 25);
CuAssertTrue(ct, obj->get(obj, NewIfc_transparent, &b) == NewIfc_error_none && !b); CuAssertTrue(ct, obj->min_width == 40);
CuAssertTrue(ct, obj->min_height == 2);
CuAssertTrue(ct, obj->last_error == NewIfc_error_none); CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
CuAssertTrue(ct, obj->get(obj, NewIfc_show_title, &b) == NewIfc_error_none && b); CuAssertTrue(ct, obj->get(obj, NewIfc_show_title, &b) == NewIfc_error_none && b);
CuAssertTrue(ct, obj->last_error == NewIfc_error_none); CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
...@@ -294,7 +289,6 @@ void test_root_window(CuTest *ct) ...@@ -294,7 +289,6 @@ void test_root_window(CuTest *ct)
CuAssertTrue(ct, obj->get(obj, NewIfc_locked_by_me, &b) == NewIfc_error_none && !b); CuAssertTrue(ct, obj->get(obj, NewIfc_locked_by_me, &b) == NewIfc_error_none && !b);
CuAssertTrue(ct, obj->last_error == NewIfc_error_none); CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
CuAssertTrue(ct, obj->set(obj, NewIfc_transparent, true) == NewIfc_error_none);
CuAssertTrue(ct, obj->last_error == NewIfc_error_none); CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
CuAssertTrue(ct, obj->set(obj, NewIfc_show_title, false) == NewIfc_error_none); CuAssertTrue(ct, obj->set(obj, NewIfc_show_title, false) == NewIfc_error_none);
CuAssertTrue(ct, obj->last_error == NewIfc_error_none); CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
...@@ -309,8 +303,6 @@ void test_root_window(CuTest *ct) ...@@ -309,8 +303,6 @@ void test_root_window(CuTest *ct)
CuAssertTrue(ct, obj->set(obj, NewIfc_locked_by_me, &b) == NewIfc_error_not_implemented); CuAssertTrue(ct, obj->set(obj, NewIfc_locked_by_me, &b) == NewIfc_error_not_implemented);
CuAssertTrue(ct, obj->last_error == NewIfc_error_not_implemented); CuAssertTrue(ct, obj->last_error == NewIfc_error_not_implemented);
CuAssertTrue(ct, obj->get(obj, NewIfc_transparent, &b) == NewIfc_error_none && b);
CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
CuAssertTrue(ct, obj->get(obj, NewIfc_show_title, &b) == NewIfc_error_none && !b); CuAssertTrue(ct, obj->get(obj, NewIfc_show_title, &b) == NewIfc_error_none && !b);
CuAssertTrue(ct, obj->last_error == NewIfc_error_none); CuAssertTrue(ct, obj->last_error == NewIfc_error_none);
CuAssertTrue(ct, obj->get(obj, NewIfc_show_help, &b) == NewIfc_error_none && !b); CuAssertTrue(ct, obj->get(obj, NewIfc_show_help, &b) == NewIfc_error_none && !b);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment