本文整理汇总了C++中GDK_THREADS_LEAVE函数的典型用法代码示例。如果您正苦于以下问题:C++ GDK_THREADS_LEAVE函数的具体用法?C++ GDK_THREADS_LEAVE怎么用?C++ GDK_THREADS_LEAVE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GDK_THREADS_LEAVE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _gail_combo_button_release
static gint
_gail_combo_button_release (gpointer data)
{
GtkCombo *combo;
GtkWidget *action_widget;
GdkEvent tmp_event;
GDK_THREADS_ENTER ();
combo = GTK_COMBO (data);
if (combo->current_button == 0)
{
GDK_THREADS_LEAVE ();
return FALSE;
}
tmp_event.button.type = GDK_BUTTON_RELEASE;
tmp_event.button.button = 1;
tmp_event.button.window = combo->list->window;
tmp_event.button.time = GDK_CURRENT_TIME;
gdk_window_set_user_data (combo->list->window, combo->button);
action_widget = combo->list;
gtk_widget_event (action_widget, &tmp_event);
GDK_THREADS_LEAVE ();
return FALSE;
}
示例2: scroll_row_timeout
/* Scroll function taken/adapted from gtktreeview.c */
static gint
scroll_row_timeout (gpointer data)
{
GtkTreeView *tree_view = data;
GdkRectangle visible_rect;
gint y, x;
gint offset;
gfloat value;
GtkAdjustment* vadj;
RbTreeDndData *priv_data;
GDK_THREADS_ENTER ();
priv_data = g_object_get_data (G_OBJECT (tree_view), RB_TREE_DND_STRING);
g_return_val_if_fail(priv_data != NULL, TRUE);
gdk_window_get_pointer (gtk_tree_view_get_bin_window (tree_view), &x, &y, NULL);
gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y, &x, &y);
gtk_tree_view_convert_bin_window_to_tree_coords (tree_view, x, y, &x, &y);
gtk_tree_view_get_visible_rect (tree_view, &visible_rect);
/* see if we are near the edge. */
if (x < visible_rect.x && x > visible_rect.x + visible_rect.width)
{
GDK_THREADS_LEAVE ();
priv_data->scroll_timeout = 0;
return FALSE;
}
offset = y - (visible_rect.y + 2 * SCROLL_EDGE_SIZE);
if (offset > 0)
{
offset = y - (visible_rect.y + visible_rect.height - 2 * SCROLL_EDGE_SIZE);
if (offset < 0)
{
GDK_THREADS_LEAVE ();
priv_data->scroll_timeout = 0;
return FALSE;
}
}
vadj = gtk_tree_view_get_vadjustment (tree_view);
value = CLAMP (vadj->value + offset, vadj->lower, vadj->upper - vadj->page_size);
gtk_adjustment_set_value (vadj, value);
/* don't remove it if we're on the edge and not scrolling */
if (ABS (vadj->value - value) > 0.0001)
remove_select_on_drag_timeout(tree_view);
GDK_THREADS_LEAVE ();
return TRUE;
}
示例3: populate_files
gboolean populate_files (gpointer data) //TODO:: show an spinner while loading
{
FilebrowserBackend *filebackend= FILEBROWSER_BACKEND(data);
FilebrowserBackendDetails *directory = FILEBROWSER_BACKEND_GET_PRIVATE(filebackend);
GDK_THREADS_ENTER();
if (g_cancellable_is_cancelled (directory->cancellable)){
GDK_THREADS_LEAVE();
return FALSE; /* remove source */
}
GError *error=NULL;
GFileInfo *info = g_file_enumerator_next_file (directory->enumerator, directory->cancellable, &error);
if (info){
const gchar *mime= g_file_info_get_content_type (info);
if (!g_file_info_get_is_hidden (info) && !g_file_info_get_is_backup (info)){
if (MIME_ISDIR(mime)){
//if has dot in name pos 0 don't process
const gchar *folder=g_file_info_get_display_name(info);
if(folder[0]!='.'){
FOLDERFILE *current;
current=new_folderfile();
current->mime=g_strdup(mime);
GIcon *icon =g_file_info_get_icon(info);
current->icon= g_icon_to_string (icon);
current->display_name=g_strdup(folder);
/* add to list */
directory->filesinfolder = g_slist_append(directory->filesinfolder, current);
}
} else {
if (IS_TEXT(mime) && !IS_APPLICATION(mime)){
//files
FOLDERFILE *current;
current=new_folderfile();
current->mime=g_strdup(mime);
GIcon *icon =g_file_info_get_icon(info);
current->icon= g_icon_to_string (icon);
current->display_name=g_strdup(g_file_info_get_display_name(info));
/* add to list */
directory->filesinfolder = g_slist_append(directory->filesinfolder, current);
}
}
}
g_object_unref(info);
} else {
if (error){
g_print(_("Error::%s"),error->message);
g_error_free (error);
}
GDK_THREADS_LEAVE();
return FALSE; /* remove source */
}
GDK_THREADS_LEAVE();
return TRUE;
}
示例4: bst_choice_modal
guint
bst_choice_modal (GtkWidget *choice,
guint mouse_button,
guint32 time)
{
gpointer data = GUINT_TO_POINTER (0);
if (GTK_IS_MENU (choice))
{
GtkMenu *menu = GTK_MENU (choice);
gtk_object_set_data (GTK_OBJECT (menu), "BstChoice", data);
if (bst_choice_selectable (choice))
{
modal_loop_quit_on_menu_item_activate = TRUE;
modal_loop_running = TRUE;
current_popup_menu = GTK_WIDGET (menu);
gtk_menu_popup (menu, NULL, NULL, NULL, NULL, mouse_button, time);
while (modal_loop_running)
{
GDK_THREADS_LEAVE ();
g_main_iteration (TRUE);
GDK_THREADS_ENTER ();
}
current_popup_menu = NULL;
modal_loop_quit_on_menu_item_activate = FALSE;
}
data = gtk_object_get_data (GTK_OBJECT (menu), "BstChoice");
}
else if (GXK_IS_DIALOG (choice))
{
gtk_object_set_data (GTK_OBJECT (choice), "BstChoice", data);
if (bst_choice_selectable (choice))
{
gtk_widget_show (choice);
while (GTK_WIDGET_VISIBLE (choice))
{
GDK_THREADS_LEAVE ();
g_main_iteration (TRUE);
GDK_THREADS_ENTER ();
}
}
data = gtk_object_get_data (GTK_OBJECT (choice), "BstChoice");
}
return GPOINTER_TO_UINT (data);
}
示例5: interface_gtk_start
int interface_gtk_start(Playlist *playlist, int argc, char **argv)
{
char path[256];
char *home;
the_coreplayer = playlist->GetCorePlayer();
g_thread_init(NULL);
if (!g_thread_supported()) {
alsaplayer_error("Sorry - this interface requires working threads.\n");
return 1;
}
// Scope functions
scopes = new AlsaSubscriber();
scopes->Subscribe(the_coreplayer->GetNode(), POS_END);
scopes->EnterStream(scope_feeder_func, the_coreplayer);
gtk_set_locale();
gtk_init(&argc, &argv);
gdk_rgb_init();
home = getenv("HOME");
if (home) {
snprintf(path, 255, "%s/.gtkrc", home);
gtk_rc_parse(path);
}
if (playlist->Length())
playlist->UnPause();
// Scope addons
gdk_flush();
GDK_THREADS_ENTER();
init_main_window(playlist);
load_scope_addons();
gdk_flush();
gtk_main();
gdk_flush();
GDK_THREADS_LEAVE();
unload_scope_addons();
destroy_scopes_window();
GDK_THREADS_ENTER();
gdk_flush();
GDK_THREADS_LEAVE();
playlist->Pause();
dl_close_scopes();
return 0;
}
示例6: the_fftscope
static void the_fftscope(void)
{
guchar *loc;
guchar bits [256 * 129];
int i, h;
running = 1;
while (running) {
guint val;
gint j;
gint k;
memset(bits, 0, 256 * 128);
for (i=0; i < BARS; i++) {
val = 0;
for (j = xranges[i]; j < xranges[i + 1]; j++) {
/* k = (guint)(sqrt(fftout[j]) * fftmult); */
k = (fft_buf[j] + fft_buf[256+j]) / 256;
val += k;
}
if(val > 127) val = 127;
if (val > (guint)maxbar[ i ])
maxbar[ i ] = val;
else {
k = maxbar[ i ] - (4 + (8 / (128 - maxbar[ i ])));
val = k > 0 ? k : 0;
maxbar[ i ] = val;
}
loc = bits + 256 * 128;
for (h = val; h > 0; h--) {
for (j = (256 / BARS) * i + 0; j < (256 / BARS) * i + ((256 / BARS) - 1); j++) {
*(loc + j) = val-h;
}
loc -=256;
}
}
GDK_THREADS_ENTER();
gdk_draw_indexed_image(area->window, area->style->white_gc,
0,0,256,128, GDK_RGB_DITHER_NONE, bits, 256, color_map);
gdk_flush();
GDK_THREADS_LEAVE();
dosleep(SCOPE_SLEEP);
}
GDK_THREADS_ENTER();
fftscope_hide();
GDK_THREADS_LEAVE();
}
示例7: xt_event_check
static gboolean
xt_event_check (GSource* source_data)
{
GDK_THREADS_ENTER ();
if (xt_event_poll_fd.revents & G_IO_IN) {
int mask;
mask = XPending(xtdisplay);
GDK_THREADS_LEAVE ();
return (gboolean)mask;
}
GDK_THREADS_LEAVE ();
return FALSE;
}
示例8: draw_func
static gint draw_func(gpointer data)
{
gint i;
if(!window)
{
timeout_tag = 0;
return FALSE;
}
GDK_THREADS_ENTER();
gdk_draw_rectangle(draw_pixmap,gc,TRUE,0,0,WIDTH,HEIGHT);
for(i = 0; i < NUM_BANDS; i++)
{
/*if(bar_heights[i] > 4)
bar_heights[i] -= 4;
else
bar_heights[i] = 0;*/
gdk_draw_pixmap(draw_pixmap,gc,bar, 0,HEIGHT - 1 - bar_heights[i], i * (WIDTH / NUM_BANDS), HEIGHT - 1 - bar_heights[i], (WIDTH / NUM_BANDS) - 1, bar_heights[i]);
}
gdk_window_clear(area->window);
GDK_THREADS_LEAVE();
return TRUE;
}
示例9: select_on_drag_timeout
static gboolean
select_on_drag_timeout (gpointer data)
{
GtkTreeView *tree_view = data;
GtkTreeSelection *selection;
RbTreeDndData *priv_data;
GDK_THREADS_ENTER ();
priv_data = g_object_get_data (G_OBJECT (tree_view), RB_TREE_DND_STRING);
g_return_val_if_fail(priv_data != NULL, FALSE);
g_return_val_if_fail(priv_data->previous_dest_path != NULL, FALSE);
selection = gtk_tree_view_get_selection(tree_view);
if (!gtk_tree_selection_path_is_selected(selection,priv_data->previous_dest_path)) {
rb_debug("Changing selection because of drag timeout");
gtk_tree_view_set_cursor(tree_view,priv_data->previous_dest_path,NULL,FALSE);
}
priv_data->select_on_drag_timeout = 0;
gtk_tree_path_free(priv_data->previous_dest_path);
priv_data->previous_dest_path = NULL;
GDK_THREADS_LEAVE ();
return FALSE;
}
示例10: vfs_mime_type_reload
static gboolean vfs_mime_type_reload( gpointer user_data )
{
GList* l;
/* FIXME: process mime database reloading properly. */
/* Remove all items in the hash table */
GDK_THREADS_ENTER();
g_static_rw_lock_writer_lock( &mime_hash_lock );
g_hash_table_foreach_remove ( mime_hash, ( GHRFunc ) gtk_true, NULL );
g_static_rw_lock_writer_unlock( &mime_hash_lock );
g_source_remove( reload_callback_id );
reload_callback_id = 0;
/* g_debug( "reload mime-types" ); */
/* call all registered callbacks */
for( l = reload_cb; l; l = l->next )
{
VFSMimeReloadCbEnt* ent = (VFSMimeReloadCbEnt*)l->data;
ent->cb( ent->user_data );
}
GDK_THREADS_LEAVE();
return FALSE;
}
示例11: show_selection_ascii
void show_selection_ascii(struct selectRange *srange)
{
g_usleep(1);
GDK_THREADS_ENTER();
int start, end;
start = srange->start;
end = srange->end;
GtkTextView *textview3 =
(GtkTextView *) gtk_builder_get_object(builder, "textview3");
GtkTextBuffer *buffer3 =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview3));
int line1, line2;
line1 = start / 16;
start = start - 16 * line1;
line2 = end / 16;
end = end - 16 * line2;
GtkTextIter iter1, iter2;
gtk_text_buffer_get_iter_at_line_offset(buffer3, &iter1, line1, start);
gtk_text_buffer_get_iter_at_line_offset(buffer3, &iter2, line2, end);
gtk_text_buffer_select_range(buffer3, &iter1, &iter2);
GDK_THREADS_LEAVE();
}
示例12: clock_timer_callback
static gint clock_timer_callback(gpointer data){
Clock *clock = (Clock *)data;
GDK_THREADS_ENTER ();
clock_gen_str(clock);
GDK_THREADS_LEAVE ();
return TRUE;
}
示例13: on_pad_buffer
static gboolean
on_pad_buffer (GstPad *pad,
GstBuffer *buf)
{
gint64 timestamp;
GDK_THREADS_ENTER ();
timestamp = GST_BUFFER_TIMESTAMP (buf);
if (buffer)
gst_buffer_unref (buffer);
buffer = buf;
gst_buffer_ref (buf);
GDK_THREADS_LEAVE ();
if (start_time == 0)
start_time = get_time ();
else {
gint64 time_left = (timestamp / 1000) - (get_time () - start_time);
time_left -= 1000000 / 25;
if (time_left > 2000)
usleep (time_left);
}
return TRUE;
}
示例14: thunar_uca_provider_child_watch
static void
thunar_uca_provider_child_watch (GPid pid,
gint status,
gpointer user_data)
{
ThunarUcaProvider *uca_provider = THUNAR_UCA_PROVIDER (user_data);
ThunarVfsMonitor *monitor;
ThunarVfsPath *path;
GDK_THREADS_ENTER ();
/* verify that we still have a valid child_watch_path */
if (G_LIKELY (uca_provider->child_watch_path != NULL))
{
/* determine the corresponding ThunarVfsPath */
path = thunar_vfs_path_new (uca_provider->child_watch_path, NULL);
if (G_LIKELY (path != NULL))
{
/* schedule a changed notification on the path */
monitor = thunar_vfs_monitor_get_default ();
thunar_vfs_monitor_feed (monitor, THUNAR_VFS_MONITOR_EVENT_CHANGED, path);
g_object_unref (G_OBJECT (monitor));
/* release the ThunarVfsPath */
thunar_vfs_path_unref (path);
}
}
/* need to cleanup */
g_spawn_close_pid (pid);
GDK_THREADS_LEAVE ();
}
示例15: xt_event_dispatch
static gboolean
xt_event_dispatch (GSource* source_data,
GSourceFunc call_back,
gpointer user_data)
{
XEvent event;
XtAppContext ac;
int i = 0;
ac = XtDisplayToApplicationContext(xtdisplay);
GDK_THREADS_ENTER ();
/* Process only real X traffic here. We only look for data on the
* pipe, limit it to XTBIN_MAX_EVENTS and only call
* XtAppProcessEvent so that it will look for X events. There's no
* timer processing here since we already have a timer callback that
* does it. */
for (i=0; i < XTBIN_MAX_EVENTS && XPending(xtdisplay); i++) {
XtAppProcessEvent(ac, XtIMXEvent);
}
GDK_THREADS_LEAVE ();
return TRUE;
}