+++ /dev/null
-#include <string.h>
-#include <Ecore_X.h>
-#include "border.h"
-#include "logger.h"
-
-#define BOUNDS_CHANGED "object:bounds-changed"
-#define WIDTH 720
-#define HEIGHT 1280
-
-static Evas_Object *r1 = NULL;
-static Evas_Object *r2 = NULL;
-static Evas_Object *r3 = NULL;
-static Evas_Object *r4 = NULL;
-static Evas_Object *win = NULL;
-static AtspiAccessible *source = NULL;
-static AtspiEventListener *listener = NULL;
-static AtspiEventListener *listener2 = NULL;
-static char *registered_event = NULL;
-static Eina_Bool initialized = EINA_FALSE;
-
-Ecore_X_Window _get_win_below(int x, int y)
-{
- int num;
- Ecore_X_Window win = ecore_x_window_at_xy_get(x, y);
- ecore_x_window_ignore_set(win, 1);
- Ecore_X_Window *skip = ecore_x_window_ignore_list(&num);
- //fprintf(stderr, "win_below:%d\n", ecore_x_window_at_xy_with_skip_get(x, y, skip, num));
- //fprintf(stderr, "win_top:%d\n", win);
- return ecore_x_window_at_xy_with_skip_get(x, y, skip, num);
-}
-
-Eina_Bool _mouse_up(void *data,
- int type,
- void *event)
-{
- Ecore_Event_Mouse_Button *ev = event;
- ecore_x_mouse_up_send(_get_win_below(ev->x, ev->y), ev->x, ev->y, 1);
- fprintf(stderr, "mouse_up\n");
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool _mouse_down(void *data,
- int type,
- void *event)
-{
- Ecore_Event_Mouse_Button *ev = event;
- ecore_x_mouse_down_send(_get_win_below(ev->x, ev->y), ev->x, ev->y, 1);
- fprintf(stderr, "mouse_down\n");
- return ECORE_CALLBACK_PASS_ON;
-}
-
-static Eina_Bool _mouse_move(void *data,
- int type,
- void *event)
-{
- Ecore_Event_Mouse_Button *ev = event;
- ecore_x_mouse_move_send(_get_win_below(ev->x, ev->y), ev->x, ev->y);
- //fprintf(stderr, "mouse_move\n");
- return ECORE_CALLBACK_PASS_ON;
-}
-
-
-static Eina_Bool draw_border(AtspiAccessible *w)
-{
- if(!w)
- return EINA_FALSE;
-
- GError *error = NULL;
- AtspiComponent *comp = atspi_accessible_get_component(w);
- AtspiRect *r = atspi_component_get_extents(comp, ATSPI_COORD_TYPE_SCREEN, &error);
-
- if(error)
- return EINA_FALSE;
-
- evas_object_line_xy_set(r1, r->x, r->y, r->x+r->width, r->y);
- evas_object_line_xy_set(r2, r->x + r->width, r->y, r->x + r->width, r->y + r->height);
- evas_object_line_xy_set(r3, r->x + r->width, r->y + r->height, r->x, r->y + r->height);
- evas_object_line_xy_set(r4, r->x, r->y + r->height, r->x, r->y);
-
- return EINA_TRUE;
-}
-
-static void _bounds_changed(const AtspiEvent *event, void *user_data)
-{
- if(source == event->source)
- draw_border(event->source);
-}
-
-Eina_Bool border_init(void)
-{
- GError *error = NULL;
- if(initialized)
- return EINA_TRUE;
-
- win = elm_win_add(NULL, "highlight", ELM_WIN_BASIC);
-
- elm_win_alpha_set(win, EINA_TRUE);
- elm_win_override_set(win, EINA_TRUE);
- elm_win_title_set(win, "do not focus this stupid window");
- evas_object_name_set(win, "WINDOW");
- evas_object_resize(win, WIDTH, HEIGHT);
- evas_object_move(win, 0, 0);
- evas_object_layer_set(win, EVAS_LAYER_MAX);
- Evas *evas = evas_object_evas_get(win);
- r1 = evas_object_line_add(evas);
- r2 = evas_object_line_add(evas);
- r3 = evas_object_line_add(evas);
- r4 = evas_object_line_add(evas);
- evas_object_color_set(r1, 255, 255, 0, 255);
- evas_object_color_set(r2, 255, 255, 0, 255);
- evas_object_color_set(r3, 255, 255, 0, 255);
- evas_object_color_set(r4, 255, 255, 0, 255);
- evas_object_show(r1);
- evas_object_show(r2);
- evas_object_show(r3);
- evas_object_show(r4);
- evas_object_show(win);
-
- ecore_event_init();
- ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _mouse_down, NULL);
- ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _mouse_up, NULL);
- ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _mouse_move, NULL);
-
- listener = atspi_event_listener_new (_bounds_changed, NULL, NULL);
- atspi_event_listener_register (listener, BOUNDS_CHANGED, &error);
-
- if(error)
- return EINA_FALSE;
-
- initialized = EINA_TRUE;
- return EINA_TRUE;
-}
-
-void border_shutdown(void)
-{
- if(!initialized)
- return;
-
- if(listener)
- atspi_event_listener_deregister (listener, BOUNDS_CHANGED, NULL);
-
- if(r1) {
- evas_object_del(r1);
- r1 = NULL;
- }
- if(r2) {
- evas_object_del(r2);
- r2 = NULL;
- }
- if(r3) {
- evas_object_del(r3);
- r3 = NULL;
- }
- if(r4) {
- evas_object_del(r4);
- r4 = NULL;
- }
-
- initialized = EINA_FALSE;
-}
-
-Eina_Bool border_set(AtspiAccessible *widget)
-{
- if(!initialized)
- return EINA_FALSE;
-
- if(!widget)
- return EINA_FALSE;
-
- if(source != widget)
- source = widget;
-
- draw_border(widget);
-
- return EINA_TRUE;
-}
-
-static void _on_event(const AtspiEvent *event, void *user_data)
-{
- border_set(event->source);
-}
-
-void border_set_on_event(const char *event)
-{
- if(registered_event) {
- atspi_event_listener_deregister (listener2, registered_event, NULL);
- free(registered_event);
- registered_event = NULL;
- }
-
- if(!event)
- return;
-
- registered_event = strdup(event);
- listener2 = atspi_event_listener_new (_on_event, NULL, NULL);
- atspi_event_listener_register (listener2, registered_event, NULL);
-}
#include <Ecore_X.h>
+#include <math.h>
#include "logger.h"
#include "navigator.h"
#include "gesture_tracker.h"
#include "window_tracker.h"
#include "keyboard_tracker.h"
-#include "border.h"
#define QUICKPANEL_DOWN TRUE
#define QUICKPANEL_UP FALSE
if(current_widget)
{
current_obj = current_widget;
- border_set(current_obj);
+ AtspiComponent *focus_component = atspi_accessible_get_component(current_widget);
+
+ if (atspi_component_grab_highlight(focus_component, NULL))
+ ERROR("Highlighted\n");
+
}
}
if (atspi_component_grab_focus(focus_component, NULL) == TRUE)
ERROR("Focus was changed\n");
+ if (atspi_component_grab_highlight(focus_component, NULL))
+ ERROR("Highlighted\n");
+
}
return current_widget;
}
ERROR("Focus was changed\n");
ERROR("Focused widget role: %s\n", roleName);
}
+ if (atspi_component_grab_highlight(focus_component, NULL))
+ ERROR("Highlighted\n");
}
return current_widget;
static void _focus_next(void)
{
current_obj = _focused_next_widget();
- if(current_obj)
- border_set(current_obj);
}
static void _focus_prev(void)
{
current_obj = _focused_prev_widget();
- if(current_obj)
- border_set(current_obj);
}
static void _value_inc_widget(void)
// register on active_window
window_tracker_register(on_window_activate, NULL);
window_tracker_active_window_request();
- border_init();
//keyboard_tracker_init();
//keyboard_tracker_register(on_keyboard, NULL);
}
void navigator_shutdown(void)
{
- keyboard_tracker_shutdown();
+ if (atspi_component_clear_highlight(atspi_accessible_get_component(current_obj), NULL))
+ ERROR("UnHighlighted\n");
+ //keyboard_tracker_shutdown();
}