callin'convention fix
git-svn-id: svn://kolibrios.org@6395 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b4322cddd9
commit
191083b6c3
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
/* Load all libraries, initialize global tables like system color table and
|
/* Load all libraries, initialize global tables like system color table and
|
||||||
operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails
|
operations table. kolibri_gui_init() will EXIT with mcall -1 if it fails
|
||||||
to do it's job. This is all you need to call and all libraries and GUI
|
to do it's job. This is all you need to call and all libraries and GUI
|
||||||
elements can be used after a successful call to this function
|
elements can be used after a successful call to this function
|
||||||
@ -16,13 +16,13 @@ int main()
|
|||||||
struct check_box *checkbox = kolibri_new_check_box(20, 40, 12, 12, "Append BOARDMSG to entered message.");
|
struct check_box *checkbox = kolibri_new_check_box(20, 40, 12, 12, "Append BOARDMSG to entered message.");
|
||||||
struct edit_box *textbox = kolibri_new_edit_box(20, 55, 40);
|
struct edit_box *textbox = kolibri_new_edit_box(20, 55, 40);
|
||||||
struct kolibri_button *button = kolibri_new_button(310, 55, 24, 14, 0x21, kolibri_color_table.color_work_button);
|
struct kolibri_button *button = kolibri_new_button(310, 55, 24, 14, 0x21, kolibri_color_table.color_work_button);
|
||||||
|
|
||||||
kolibri_window_add_element(main_window, KOLIBRI_EDIT_BOX, textbox);
|
kolibri_window_add_element(main_window, KOLIBRI_EDIT_BOX, textbox);
|
||||||
kolibri_window_add_element(main_window, KOLIBRI_CHECK_BOX, checkbox);
|
kolibri_window_add_element(main_window, KOLIBRI_CHECK_BOX, checkbox);
|
||||||
kolibri_window_add_element(main_window, KOLIBRI_BUTTON, button);
|
kolibri_window_add_element(main_window, KOLIBRI_BUTTON, button);
|
||||||
|
|
||||||
volatile unsigned press_key2;
|
volatile unsigned press_key;
|
||||||
|
|
||||||
do /* Start of main activity loop */
|
do /* Start of main activity loop */
|
||||||
{
|
{
|
||||||
if(gui_event == KOLIBRI_EVENT_REDRAW)
|
if(gui_event == KOLIBRI_EVENT_REDRAW)
|
||||||
@ -30,12 +30,13 @@ int main()
|
|||||||
kolibri_handle_event_redraw(main_window);
|
kolibri_handle_event_redraw(main_window);
|
||||||
}
|
}
|
||||||
else if(gui_event == KOLIBRI_EVENT_KEY)
|
else if(gui_event == KOLIBRI_EVENT_KEY)
|
||||||
{
|
{
|
||||||
|
/* siemargl commented out because keys stealed from textinput
|
||||||
key = get_key();
|
key = get_key();
|
||||||
switch (key.code)
|
switch (key.code)
|
||||||
{
|
{
|
||||||
case 13:
|
case 13:
|
||||||
if(checkbox -> flags & CHECKBOX_IS_SET) /* Append BoardMsg checkbox is set */
|
if(checkbox -> flags & CHECKBOX_IS_SET) /* Append BoardMsg checkbox is set * /
|
||||||
debug_board_write_str("BOARDMSG: ");
|
debug_board_write_str("BOARDMSG: ");
|
||||||
|
|
||||||
debug_board_write_str(textbox->text);
|
debug_board_write_str(textbox->text);
|
||||||
@ -43,6 +44,7 @@ int main()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
press_key = key.val;
|
press_key = key.val;
|
||||||
|
*/
|
||||||
kolibri_handle_event_key(main_window);
|
kolibri_handle_event_key(main_window);
|
||||||
}
|
}
|
||||||
else if(gui_event == KOLIBRI_EVENT_BUTTON)
|
else if(gui_event == KOLIBRI_EVENT_BUTTON)
|
||||||
|
@ -9,7 +9,7 @@ struct kolibri_button {
|
|||||||
unsigned int XY;
|
unsigned int XY;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct kolibri_button *kolibri_new_button(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey,
|
struct kolibri_button *kolibri_new_button(unsigned int tlx, unsigned int tly, unsigned int sizex, unsigned int sizey,
|
||||||
unsigned int identifier, unsigned int color)
|
unsigned int identifier, unsigned int color)
|
||||||
{
|
{
|
||||||
struct kolibri_button* new_button = (struct kolibri_button *)malloc(sizeof(struct kolibri_button));
|
struct kolibri_button* new_button = (struct kolibri_button *)malloc(sizeof(struct kolibri_button));
|
||||||
@ -18,6 +18,7 @@ struct kolibri_button *kolibri_new_button(unsigned int tlx, unsigned int tly, un
|
|||||||
new_button -> color = color;
|
new_button -> color = color;
|
||||||
new_button -> identifier = identifier;
|
new_button -> identifier = identifier;
|
||||||
new_button -> XY = 0;
|
new_button -> XY = 0;
|
||||||
|
return new_button;
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw_button(struct kolibri_button *some_button)
|
void draw_button(struct kolibri_button *some_button)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef KOLIBRI_DEBUG_H
|
#ifndef KOLIBRI_DEBUG_H
|
||||||
#define KOLIBRI_DEBUG_H
|
#define KOLIBRI_DEBUG_H
|
||||||
|
|
||||||
/* Write a printf() like function (variable argument list) for
|
/* Write a printf() like function (variable argument list) for
|
||||||
writing to debug board */
|
writing to debug board */
|
||||||
|
|
||||||
inline void debug_board_write_byte(const char ch){
|
inline void debug_board_write_byte(const char ch){
|
||||||
@ -10,8 +10,9 @@ inline void debug_board_write_byte(const char ch){
|
|||||||
:
|
:
|
||||||
:"a"(63), "b"(1), "c"(ch));
|
:"a"(63), "b"(1), "c"(ch));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void debug_board_write_str(const char* str){
|
//added noninline because incofortabre stepping in in debugger
|
||||||
|
void __attribute__ ((noinline)) debug_board_write_str(const char* str){
|
||||||
while(*str)
|
while(*str)
|
||||||
debug_board_write_byte(*str++);
|
debug_board_write_byte(*str++);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef KOLIBRI_GUI_H
|
#ifndef KOLIBRI_GUI_H
|
||||||
#define KOLIBRI_GUI_H
|
#define KOLIBRI_GUI_H
|
||||||
|
|
||||||
#include "stdlib.h" /* for malloc() */
|
#include <stdlib.h> /* for malloc() */
|
||||||
#include <kos32sys.h>
|
#include <kos32sys.h>
|
||||||
|
|
||||||
#include "kolibri_debug.h" /* work with debug board */
|
#include "kolibri_debug.h" /* work with debug board */
|
||||||
@ -25,34 +25,37 @@ void kolibri_handle_event_redraw(struct kolibri_window* some_window)
|
|||||||
|
|
||||||
BeginDraw();
|
BeginDraw();
|
||||||
|
|
||||||
DrawWindow(some_window->topleftx, some_window->toplefty,
|
DrawWindow(some_window->topleftx, some_window->toplefty,
|
||||||
some_window->sizex, some_window->sizey,
|
some_window->sizex, some_window->sizey,
|
||||||
some_window->window_title,
|
some_window->window_title,
|
||||||
kolibri_color_table.color_work_area, some_window->XY);
|
kolibri_color_table.color_work_area, some_window->XY);
|
||||||
|
|
||||||
/* Enumerate and draw all window elements here */
|
/* Enumerate and draw all window elements here */
|
||||||
if(some_window->elements) /* Draw all elements added to window */
|
if(some_window->elements) /* Draw all elements added to window */
|
||||||
{
|
{
|
||||||
struct kolibri_window_element* current_element = some_window -> elements;
|
struct kolibri_window_element* current_element = some_window -> elements;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* The redraw_fn serves as draw_fn on initial draw */
|
/* The redraw_fn serves as draw_fn on initial draw */
|
||||||
if(kolibri_gui_op_table[current_element -> type].redraw_fn)
|
if(kolibri_gui_op_table[current_element -> type].redraw_fn)
|
||||||
kolibri_gui_op_table[current_element -> type].redraw_fn(current_element -> element);
|
kolibri_gui_op_table[current_element -> type].redraw_fn(current_element -> element);
|
||||||
|
|
||||||
|
//sie after fixing calling conventions no more needed
|
||||||
|
/*
|
||||||
switch(current_element -> type)
|
switch(current_element -> type)
|
||||||
{
|
{
|
||||||
case KOLIBRI_EDIT_BOX:
|
case KOLIBRI_EDIT_BOX:
|
||||||
case KOLIBRI_CHECK_BOX:
|
case KOLIBRI_CHECK_BOX:
|
||||||
__asm__ volatile("push $0x13371337"::); /* Random value pushed to balance stack */
|
__asm__ volatile("push $0x13371337"::); / * Random value pushed to balance stack * /
|
||||||
/* otherwise edit_box_draw leaves stack unbalanced */
|
/ * otherwise edit_box_draw leaves stack unbalanced * /
|
||||||
/* and GCC jumps like a crazy motha' fucka' */
|
/ * and GCC jumps like a crazy motha' fucka' * /
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
current_element = current_element -> next;
|
current_element = current_element -> next;
|
||||||
|
|
||||||
} while(current_element != some_window->elements); /* Have we covered all elements? */
|
} while(current_element != some_window->elements); /* Have we covered all elements? */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -60,16 +63,16 @@ void kolibri_handle_event_redraw(struct kolibri_window* some_window)
|
|||||||
void kolibri_handle_event_key(struct kolibri_window* some_window)
|
void kolibri_handle_event_key(struct kolibri_window* some_window)
|
||||||
{
|
{
|
||||||
/* Enumerate and trigger key handling functions of window elements here */
|
/* Enumerate and trigger key handling functions of window elements here */
|
||||||
if(some_window->elements)
|
if(some_window->elements)
|
||||||
{
|
{
|
||||||
struct kolibri_window_element *current_element = some_window -> elements;
|
struct kolibri_window_element *current_element = some_window -> elements;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* Only execute if the function pointer isn't NULL */
|
/* Only execute if the function pointer isn't NULL */
|
||||||
if(kolibri_gui_op_table[current_element -> type].key_fn)
|
if(kolibri_gui_op_table[current_element -> type].key_fn)
|
||||||
kolibri_gui_op_table[current_element -> type].key_fn(current_element -> element);
|
kolibri_gui_op_table[current_element -> type].key_fn(current_element -> element);
|
||||||
|
|
||||||
current_element = current_element -> next;
|
current_element = current_element -> next;
|
||||||
} while(current_element != some_window->elements); /* Have we covered all elements? */
|
} while(current_element != some_window->elements); /* Have we covered all elements? */
|
||||||
}
|
}
|
||||||
@ -78,17 +81,17 @@ void kolibri_handle_event_key(struct kolibri_window* some_window)
|
|||||||
void kolibri_handle_event_mouse(struct kolibri_window* some_window)
|
void kolibri_handle_event_mouse(struct kolibri_window* some_window)
|
||||||
{
|
{
|
||||||
/* Enumerate and trigger mouse handling functions of window elements here */
|
/* Enumerate and trigger mouse handling functions of window elements here */
|
||||||
if(some_window->elements)
|
if(some_window->elements)
|
||||||
{
|
{
|
||||||
struct kolibri_window_element *current_element = some_window -> elements;
|
struct kolibri_window_element *current_element = some_window -> elements;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
||||||
if(kolibri_gui_op_table[current_element -> type].mouse_fn)
|
if(kolibri_gui_op_table[current_element -> type].mouse_fn)
|
||||||
kolibri_gui_op_table[current_element -> type].mouse_fn(current_element -> element);
|
kolibri_gui_op_table[current_element -> type].mouse_fn(current_element -> element);
|
||||||
|
|
||||||
current_element = current_element -> next;
|
current_element = current_element -> next;
|
||||||
|
|
||||||
} while(current_element != some_window->elements); /* Have we covered all elements? */
|
} while(current_element != some_window->elements); /* Have we covered all elements? */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -102,9 +105,9 @@ int kolibri_gui_init(void)
|
|||||||
{
|
{
|
||||||
int boxlib_init_status = kolibri_boxlib_init();
|
int boxlib_init_status = kolibri_boxlib_init();
|
||||||
|
|
||||||
if(boxlib_init_status == 0)
|
if(boxlib_init_status == 0)
|
||||||
debug_board_write_str("ashmew2 is happy: Kolibri GUI Successfully Initialized.\n");
|
debug_board_write_str("ashmew2 is happy: Kolibri GUI Successfully Initialized.\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
debug_board_write_str("ashmew2 is sad: Kolibri GUI Failed to initialize.\n");
|
debug_board_write_str("ashmew2 is sad: Kolibri GUI Failed to initialize.\n");
|
||||||
kolibri_exit();
|
kolibri_exit();
|
||||||
@ -120,10 +123,12 @@ int kolibri_gui_init(void)
|
|||||||
/* Set up system events for buttons, mouse and keyboard and redraw */
|
/* Set up system events for buttons, mouse and keyboard and redraw */
|
||||||
/* Also set filters so that window receives mouse events only when active
|
/* Also set filters so that window receives mouse events only when active
|
||||||
and mouse inside window */
|
and mouse inside window */
|
||||||
__asm__ volatile("int $0x40"::"a"(40), "b"(0xC0000027));
|
__asm__ volatile("int $0x40"::"a"(40), "b"(0xC0000027));
|
||||||
|
|
||||||
|
return boxlib_init_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: The current implementation tries to automatically colors
|
/* Note: The current implementation tries to automatically colors
|
||||||
GUI elements with system theme */
|
GUI elements with system theme */
|
||||||
|
|
||||||
#endif /* KOLIBRI_GUI_H */
|
#endif /* KOLIBRI_GUI_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user