diff options
author | Ashish Gupta <ashmew2@gmail.com> | 2017-04-05 21:39:01 +0200 |
---|---|---|
committer | Ashish Gupta <ashmew2@gmail.com> | 2017-06-10 08:24:39 +0200 |
commit | 6fd280bb5b27842a0ef2977798566c37bd4e1d0e (patch) | |
tree | 8e5dd8aa1adf8c6550b955d130c81c36b3db9ea5 /frontends/kolibrios/kolibri_button.h | |
parent | 9bf5ecfa87d022645e986249270c5a89e27f46fe (diff) | |
download | netsurf-6fd280bb5b27842a0ef2977798566c37bd4e1d0e.tar.gz netsurf-6fd280bb5b27842a0ef2977798566c37bd4e1d0e.tar.bz2 |
Add kolibrios/ dir : Step 1 towards porting this to Kolibri OS
Diffstat (limited to 'frontends/kolibrios/kolibri_button.h')
-rw-r--r-- | frontends/kolibrios/kolibri_button.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/frontends/kolibrios/kolibri_button.h b/frontends/kolibrios/kolibri_button.h new file mode 100644 index 000000000..fa5a86820 --- /dev/null +++ b/frontends/kolibrios/kolibri_button.h @@ -0,0 +1,46 @@ +#ifndef KOLIBRI_BUTTON_H +#define KOLIBRI_BUTTON_H + +struct kolibri_button { + unsigned int x65536sizex; + unsigned int y65536sizey; + unsigned int color; + unsigned int identifier; + unsigned int XY; +}; + +struct kolibri_button *kolibri_new_button(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey, + unsigned int identifier, unsigned int color) +{ + struct kolibri_button* new_button = (struct kolibri_button *)malloc(sizeof(struct kolibri_button)); + new_button -> x65536sizex = (tlx << 16) + sizex; + new_button -> y65536sizey = (tly << 16) + sizey; + new_button -> color = color; + new_button -> identifier = identifier; + new_button -> XY = 0; +} + +void draw_button(struct kolibri_button *some_button) +{ + define_button(some_button -> x65536sizex, some_button -> y65536sizey, some_button -> identifier, some_button -> color); +} + +unsigned int kolibri_button_get_identifier(void) +{ + unsigned int identifier; + + __asm__ __volatile__( + "int $0x40" + :"=a"(identifier) + :"a"(17) + ); + /* If no button pressed, returns 1 */ + /* Otherwise, returns identifier of button */ + + if(identifier != 1) /* Button was detected indeed */ + return identifier>>8; + else + return identifier; /* No button detected */ +} + +#endif /* KOLIBRI_BUTTON_H */ |