new apps are spawned in center
This commit is contained in:
parent
2e5a9568e7
commit
7672ae61d5
1 changed files with 7 additions and 2 deletions
|
|
@ -446,6 +446,8 @@ unsigned app_border_size(void) {
|
|||
|
||||
static void app_component_redraw(void *self, struct Component *cpnt, bool border);
|
||||
|
||||
extern struct app_template app_launcher_template;
|
||||
|
||||
bool app_push(struct app_template *template, void *arg) {
|
||||
ASSERT(template != NULL);
|
||||
struct AppCreation creation = template->create();
|
||||
|
|
@ -466,6 +468,11 @@ bool app_push(struct app_template *template, void *arg) {
|
|||
component_focus_undraw(instance_root->app, instance_root->in_focus);
|
||||
}
|
||||
|
||||
// move to center
|
||||
if (template != &app_launcher_template) {
|
||||
rect_translate(&dim, (fb_width() - RECT_WIDTH(dim))/2, (fb_height() - RECT_HEIGHT(dim))/2);
|
||||
}
|
||||
|
||||
// TODO this structure should be locked
|
||||
struct app_instance *new_instance = slab_cache_alloc(&instance_slab_cache);
|
||||
ASSERT(new_instance != NULL);
|
||||
|
|
@ -543,8 +550,6 @@ void app_translate(struct app_instance *ins, int dx, int dy) {
|
|||
fb_damage(ins->pos);
|
||||
}
|
||||
|
||||
extern struct app_template app_launcher_template;
|
||||
|
||||
void app_key_event_listener(struct key_event event) {
|
||||
struct app_instance *ins = instance_root;
|
||||
if (ins == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue