int DirWatcher::shutdown() { int r = 0; if (NULL == loop) { RX_WARNING("Asking to shutdown, but loop is NULL. Did you call init()?"); return -1; } /* stop listening for dir changes.*/ r = uv_fs_event_stop(&fs_event); if (0 != r) { RX_ERROR("Error while trying to stop the fs_event: %s", uv_strerror(r)); } directory.clear(); loop = NULL; user = NULL; on_rename = NULL; return 0; }
static void on_dir_change(uv_fs_event_t* handle, const char* fname, int events, int status) { if (UV_RENAME != events) { return ; } DirWatcher* watch = static_cast<DirWatcher*>(handle->data); if (NULL == watch) { RX_ERROR("No data member set on the fs_event handle, not supposed to happend!"); return; } /* call callback */ if (NULL == watch->on_rename) { RX_WARNING("Got an dir change event but no on_rename callback set."); return; } /* we get a UV_RENAME event when an image is added and/or removed, we need to figure out what it was */ if (false == rx_file_exists(watch->directory +"/" +fname)) { return; } watch->on_rename(watch->directory, fname, watch->user); }
void KankerApp::switchState(int newstate) { if (newstate == state) { RX_VERBOSE("warning: trying to switch to the same state? %d", state); } state = newstate; switch (state) { case KSTATE_CHAR_INPUT_TITLE: { title_font.write("Type a character to record:"); break; } case KSTATE_CHAR_INPUT_DRAWING: { info_font.write("Drag with the mouse to add points to the character. " "Press backspace to restart. Space when happy with the character."); verbose_font.write((char)kanker_glyph->charcode); break; } case KSTATE_CHAR_EDIT: { info_font.write("Position the origin (dot) and set advance-x. Press space when ready."); if (kanker_glyph) { if (kanker_glyph->advance_x == 0.0f) { /* Auto calc advance x. (just the width). */ advance_x = kanker_glyph->min_x + kanker_glyph->width; advance_x = CLAMP(advance_x, gui_width, painter.width() - gui_width); } else { advance_x = gui_width + kanker_glyph->advance_x; } /* Set the initial (or loaded) advance_x on the glyph. */ kanker_glyph->advance_x = (advance_x - gui_width); kanker_glyph->origin_x = origin_x; } break; } case KSTATE_CHAR_PREVIEW: { if (kanker_glyph) { if (0.0f == kanker_glyph->advance_x) { RX_ERROR("The glyph advance_x is 0.0 expect incorrect results.."); } KankerGlyph copy = *kanker_glyph; preview_drawer.updateVertices(copy); } else { RX_WARNING("Changing to preview state, but the glyph is NULL."); } break; } case KSTATE_CHAR_OVERVIEW: { glyph_dx = -1; onKeyRelease(GLFW_KEY_RIGHT, 0, 0); info_font.write("Press left and right arrows to switch character."); break; } default: { break; } } }
WebmScreenRecorder::WebmScreenRecorder() :webm(&ebml), nbytes_per_video_frame(0) { RX_WARNING(("@todo - implement the pbos")); }