PRIVATE GdkFilterReturn monitor_icon_event(GdkXEvent* xevent, GdkEvent* event, GdkWindow* wrapper) { XEvent* xev = xevent; if (xev->type == DestroyNotify) { if (_deepin_tray == wrapper ) { destroy_wrapper(_deepin_tray); _deepin_tray = NULL; _deepin_tray_width = 0; _update_fcitx_try_position(); } else if (_fcitx_tray == wrapper) { destroy_wrapper(_fcitx_tray); _fcitx_tray = NULL; _fcitx_tray_width = 0; _update_notify_area_width(); } else { g_hash_table_remove(_icons, wrapper); destroy_wrapper(wrapper); _update_notify_area_width(); } return GDK_FILTER_CONTINUE; } else if (xev->type == ConfigureNotify) { XConfigureEvent* xev = (XConfigureEvent*)xevent; int new_width = ((XConfigureEvent*)xev)->width; if (wrapper == _deepin_tray) { _deepin_tray_width = CLAMP_WIDTH(new_width); _update_deepin_try_position(); } else if (wrapper == _fcitx_tray) { _fcitx_tray_width = CLAMP_WIDTH(new_width); _update_fcitx_try_position(); } else if (wrapper != _deepin_tray && wrapper != _fcitx_tray) { int new_height = ((XConfigureEvent*)xev)->height; g_hash_table_insert(_icons, wrapper, GINT_TO_POINTER(CLAMP_WIDTH((new_width * 1.0 / new_height * DEFAULT_HEIGHT)))); _update_notify_area_width(); } return GDK_FILTER_REMOVE; } else if (xev->type == GenericEvent) { GdkWindow* parent = gdk_window_get_parent(wrapper); XGenericEvent* ge = xevent; if (ge->evtype == EnterNotify) { g_object_set_data(G_OBJECT(wrapper), "is_mouse_in", GINT_TO_POINTER(TRUE)); gdk_window_invalidate_rect(parent, NULL, TRUE); } else if (ge->evtype == LeaveNotify) { g_object_set_data(G_OBJECT(wrapper), "is_mouse_in", GINT_TO_POINTER(FALSE)); gdk_window_invalidate_rect(parent, NULL, TRUE); } return GDK_FILTER_REMOVE; } return GDK_FILTER_CONTINUE; }
void VoodooI2CHIDDevice::stop(IOService* device) { IOLog("I2C HID Device is stopping\n"); destroy_wrapper(); if (hid_device->timerSource){ hid_device->timerSource->cancelTimeout(); hid_device->timerSource->release(); hid_device->timerSource = NULL; } //hid_device->workLoop->removeEventSource(hid_device->interruptSource); //hid_device->interruptSource->disable(); hid_device->interruptSource = NULL; hid_device->workLoop->release(); hid_device->workLoop = NULL; i2c_hid_free_buffers(ihid, HID_MIN_BUFFER_SIZE); IOFree(ihid, sizeof(i2c_hid)); IOFree(hid_device, sizeof(I2CDevice)); //hid_device->provider->close(this); }
void VoodooI2CHIDDevice::initialize_wrapper(void) { destroy_wrapper(); IOLog("VoodooI2C: %s, line %d\n", __FILE__, __LINE__); _wrapper = new VoodooHIDWrapper; if (_wrapper->init()) { IOLog("VoodooI2C: %s, line %d\n", __FILE__, __LINE__); _wrapper->attach(this); _wrapper->start(this); } else { IOLog("VoodooI2C: %s, line %d\n", __FILE__, __LINE__); _wrapper->release(); _wrapper = NULL; } }