Mercurial > dwindows
comparison gtk/dw.c @ 1273:dfecd7b3c81e
Fix comparison of char * in dw_container_cursor and dw_container_delete_row
Other changes due to removal of trailing spaces
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sun, 30 Oct 2011 02:10:24 +0000 |
parents | 5c200b371600 |
children | 0b34e2cf0706 |
comparison
equal
deleted
inserted
replaced
1272:5c200b371600 | 1273:dfecd7b3c81e |
---|---|
1956 #endif | 1956 #endif |
1957 | 1957 |
1958 void _init_thread(void) | 1958 void _init_thread(void) |
1959 { | 1959 { |
1960 GdkColor *foreground = malloc(sizeof(GdkColor)); | 1960 GdkColor *foreground = malloc(sizeof(GdkColor)); |
1961 | 1961 |
1962 foreground->pixel = foreground->red = foreground->green = foreground->blue = 0; | 1962 foreground->pixel = foreground->red = foreground->green = foreground->blue = 0; |
1963 pthread_setspecific(_dw_fg_color_key, foreground); | 1963 pthread_setspecific(_dw_fg_color_key, foreground); |
1964 pthread_setspecific(_dw_bg_color_key, NULL); | 1964 pthread_setspecific(_dw_bg_color_key, NULL); |
1965 } | 1965 } |
1966 | 1966 |
2097 _dw_border_height = atoi(tmp); | 2097 _dw_border_height = atoi(tmp); |
2098 | 2098 |
2099 pthread_key_create(&_dw_fg_color_key, NULL); | 2099 pthread_key_create(&_dw_fg_color_key, NULL); |
2100 pthread_key_create(&_dw_bg_color_key, NULL); | 2100 pthread_key_create(&_dw_bg_color_key, NULL); |
2101 pthread_key_create(&_dw_mutex_key, NULL); | 2101 pthread_key_create(&_dw_mutex_key, NULL); |
2102 | 2102 |
2103 _init_thread(); | 2103 _init_thread(); |
2104 | 2104 |
2105 gtk_rc_parse_string("style \"gtk-tooltips-style\" { bg[NORMAL] = \"#eeee00\" } widget \"gtk-tooltips\" style \"gtk-tooltips-style\""); | 2105 gtk_rc_parse_string("style \"gtk-tooltips-style\" { bg[NORMAL] = \"#eeee00\" } widget \"gtk-tooltips\" style \"gtk-tooltips-style\""); |
2106 | 2106 |
2107 #ifdef USE_GTKMOZEMBED | 2107 #ifdef USE_GTKMOZEMBED |
2740 return FALSE; | 2740 return FALSE; |
2741 | 2741 |
2742 fd = dwwait->data; | 2742 fd = dwwait->data; |
2743 fontname = gtk_font_selection_dialog_get_font_name(fd); | 2743 fontname = gtk_font_selection_dialog_get_font_name(fd); |
2744 if(fontname && (retfont = strdup(fontname))) | 2744 if(fontname && (retfont = strdup(fontname))) |
2745 { | 2745 { |
2746 len = strlen(fontname); | 2746 len = strlen(fontname); |
2747 /* Convert to Dynamic Windows format if we can... */ | 2747 /* Convert to Dynamic Windows format if we can... */ |
2748 if(len > 0 && isdigit(fontname[len-1])) | 2748 if(len > 0 && isdigit(fontname[len-1])) |
2749 { | 2749 { |
2750 int size; | 2750 int size; |
2751 | 2751 |
2752 x=len-1; | 2752 x=len-1; |
2753 while(x > 0 && fontname[x] != ' ') | 2753 while(x > 0 && fontname[x] != ' ') |
2754 { | 2754 { |
2755 x--; | 2755 x--; |
2756 } | 2756 } |
2797 char *font = currfont ? strdup(currfont) : NULL; | 2797 char *font = currfont ? strdup(currfont) : NULL; |
2798 char *name = font ? strchr(font, '.') : NULL; | 2798 char *name = font ? strchr(font, '.') : NULL; |
2799 int _locked_by_me = FALSE; | 2799 int _locked_by_me = FALSE; |
2800 char *retfont = NULL; | 2800 char *retfont = NULL; |
2801 DWDialog *dwwait; | 2801 DWDialog *dwwait; |
2802 | 2802 |
2803 /* Detect Dynamic Windows style font name... | 2803 /* Detect Dynamic Windows style font name... |
2804 * Format: ##.Fontname | 2804 * Format: ##.Fontname |
2805 * and convert to a Pango name | 2805 * and convert to a Pango name |
2806 */ | 2806 */ |
2807 if(name && isdigit(*font)) | 2807 if(name && isdigit(*font)) |
2808 { | 2808 { |
2827 if(font) | 2827 if(font) |
2828 { | 2828 { |
2829 gtk_font_selection_dialog_set_font_name(fd, font); | 2829 gtk_font_selection_dialog_set_font_name(fd, font); |
2830 free(font); | 2830 free(font); |
2831 } | 2831 } |
2832 | 2832 |
2833 _dw_font_active = 1; | 2833 _dw_font_active = 1; |
2834 | 2834 |
2835 dwwait = dw_dialog_new((void *)fd); | 2835 dwwait = dw_dialog_new((void *)fd); |
2836 | 2836 |
2837 g_signal_connect(G_OBJECT(fd->ok_button), "clicked", G_CALLBACK(_gtk_font_ok), dwwait); | 2837 g_signal_connect(G_OBJECT(fd->ok_button), "clicked", G_CALLBACK(_gtk_font_ok), dwwait); |
2986 { | 2986 { |
2987 pfont = pango_context_get_font_description( pcontext ); | 2987 pfont = pango_context_get_font_description( pcontext ); |
2988 if ( pfont ) | 2988 if ( pfont ) |
2989 { | 2989 { |
2990 int len, x; | 2990 int len, x; |
2991 | 2991 |
2992 font = pango_font_description_to_string( pfont ); | 2992 font = pango_font_description_to_string( pfont ); |
2993 retfont = strdup(font); | 2993 retfont = strdup(font); |
2994 len = strlen(font); | 2994 len = strlen(font); |
2995 /* Convert to Dynamic Windows format if we can... */ | 2995 /* Convert to Dynamic Windows format if we can... */ |
2996 if(len > 0 && isdigit(font[len-1])) | 2996 if(len > 0 && isdigit(font[len-1])) |
2997 { | 2997 { |
2998 int size; | 2998 int size; |
2999 | 2999 |
3000 x=len-1; | 3000 x=len-1; |
3001 while(x > 0 && font[x] != ' ') | 3001 while(x > 0 && font[x] != ' ') |
3002 { | 3002 { |
3003 x--; | 3003 x--; |
3004 } | 3004 } |
3050 } | 3050 } |
3051 | 3051 |
3052 GdkColor _get_gdkcolor(unsigned long color) | 3052 GdkColor _get_gdkcolor(unsigned long color) |
3053 { | 3053 { |
3054 GdkColor temp = _colors[0]; | 3054 GdkColor temp = _colors[0]; |
3055 | 3055 |
3056 if(color & DW_RGB_COLOR) | 3056 if(color & DW_RGB_COLOR) |
3057 { | 3057 { |
3058 temp.pixel = 0; | 3058 temp.pixel = 0; |
3059 temp.red = DW_RED_VALUE(color) << 8; | 3059 temp.red = DW_RED_VALUE(color) << 8; |
3060 temp.green = DW_GREEN_VALUE(color) << 8; | 3060 temp.green = DW_GREEN_VALUE(color) << 8; |
3061 temp.blue = DW_BLUE_VALUE(color) << 8; | 3061 temp.blue = DW_BLUE_VALUE(color) << 8; |
3062 | 3062 |
3134 { | 3134 { |
3135 int z, rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_rowcount")); | 3135 int z, rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_rowcount")); |
3136 unsigned long odd = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_oddcol")); | 3136 unsigned long odd = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_oddcol")); |
3137 unsigned long even = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_evencol")); | 3137 unsigned long even = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_evencol")); |
3138 GdkColor *backcol = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_backgdk"); | 3138 GdkColor *backcol = (GdkColor *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_backgdk"); |
3139 | 3139 |
3140 if(!backcol) | 3140 if(!backcol) |
3141 backcol = &_colors[DW_CLR_WHITE]; | 3141 backcol = &_colors[DW_CLR_WHITE]; |
3142 | 3142 |
3143 if(odd != DW_RGB_TRANSPARENT || even != DW_RGB_TRANSPARENT) | 3143 if(odd != DW_RGB_TRANSPARENT || even != DW_RGB_TRANSPARENT) |
3144 { | 3144 { |
3145 GdkColor oddcol = _get_gdkcolor(odd); | 3145 GdkColor oddcol = _get_gdkcolor(odd); |
3146 GdkColor evencol = _get_gdkcolor(even); | 3146 GdkColor evencol = _get_gdkcolor(even); |
3147 | 3147 |
3148 for(z=0;z<rowcount;z++) | 3148 for(z=0;z<rowcount;z++) |
3149 { | 3149 { |
3150 int which = z % 2; | 3150 int which = z % 2; |
3151 | 3151 |
3152 if(which) | 3152 if(which) |
3153 gtk_clist_set_background(GTK_CLIST(handle), z, odd != DW_RGB_TRANSPARENT ? &oddcol : backcol); | 3153 gtk_clist_set_background(GTK_CLIST(handle), z, odd != DW_RGB_TRANSPARENT ? &oddcol : backcol); |
3154 else if(!which) | 3154 else if(!which) |
3155 gtk_clist_set_background(GTK_CLIST(handle), z, even != DW_RGB_TRANSPARENT ? &evencol : backcol); | 3155 gtk_clist_set_background(GTK_CLIST(handle), z, even != DW_RGB_TRANSPARENT ? &evencol : backcol); |
3156 } | 3156 } |
4085 * id: An ID to be used with dw_window_from_id() or 0L. | 4085 * id: An ID to be used with dw_window_from_id() or 0L. |
4086 */ | 4086 */ |
4087 HWND dw_mle_new(unsigned long id) | 4087 HWND dw_mle_new(unsigned long id) |
4088 { | 4088 { |
4089 GtkWidget *tmp, *tmpbox; | 4089 GtkWidget *tmp, *tmpbox; |
4090 #if GTK_MAJOR_VERSION < 2 | 4090 #if GTK_MAJOR_VERSION < 2 |
4091 GtkWidget *scroller; | 4091 GtkWidget *scroller; |
4092 #endif | 4092 #endif |
4093 int _locked_by_me = FALSE; | 4093 int _locked_by_me = FALSE; |
4094 | 4094 |
4095 DW_MUTEX_LOCK; | 4095 DW_MUTEX_LOCK; |
5455 DW_MUTEX_UNLOCK; | 5455 DW_MUTEX_UNLOCK; |
5456 #endif | 5456 #endif |
5457 } | 5457 } |
5458 | 5458 |
5459 /* Internal function to update the progress bar | 5459 /* Internal function to update the progress bar |
5460 * while in an indeterminate state. | 5460 * while in an indeterminate state. |
5461 */ | 5461 */ |
5462 gboolean _dw_update_progress_bar(gpointer data) | 5462 gboolean _dw_update_progress_bar(gpointer data) |
5463 { | 5463 { |
5464 if(g_object_get_data(G_OBJECT(data), "_dw_alive")) | 5464 if(g_object_get_data(G_OBJECT(data), "_dw_alive")) |
5465 { | 5465 { |
5485 /* Check if we are indeterminate already */ | 5485 /* Check if we are indeterminate already */ |
5486 if(!gtk_object_get_data(GTK_OBJECT(handle), "_dw_alive")) | 5486 if(!gtk_object_get_data(GTK_OBJECT(handle), "_dw_alive")) |
5487 { | 5487 { |
5488 /* If not become indeterminate... and start a timer to continue */ | 5488 /* If not become indeterminate... and start a timer to continue */ |
5489 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(handle)); | 5489 gtk_progress_bar_pulse(GTK_PROGRESS_BAR(handle)); |
5490 gtk_object_set_data(GTK_OBJECT(handle), "_dw_alive", | 5490 gtk_object_set_data(GTK_OBJECT(handle), "_dw_alive", |
5491 GINT_TO_POINTER(gtk_timeout_add(100, (GtkFunction)_dw_update_progress_bar, (gpointer)handle))); | 5491 GINT_TO_POINTER(gtk_timeout_add(100, (GtkFunction)_dw_update_progress_bar, (gpointer)handle))); |
5492 } | 5492 } |
5493 } | 5493 } |
5494 else | 5494 else |
5495 { | 5495 { |
5496 int tag = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_alive")); | 5496 int tag = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(handle), "_dw_alive")); |
5497 | 5497 |
5498 if(tag) | 5498 if(tag) |
5499 { | 5499 { |
5500 /* Cancel the existing timer if one is there */ | 5500 /* Cancel the existing timer if one is there */ |
5501 gtk_timeout_remove(tag); | 5501 gtk_timeout_remove(tag); |
5502 gtk_object_set_data(GTK_OBJECT(handle), "_dw_alive", NULL); | 5502 gtk_object_set_data(GTK_OBJECT(handle), "_dw_alive", NULL); |
5503 } | 5503 } |
5504 /* Set the position like normal */ | 5504 /* Set the position like normal */ |
5505 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(handle), (gfloat)position/100); | 5505 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(handle), (gfloat)position/100); |
5506 } | 5506 } |
7479 rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount")); | 7479 rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount")); |
7480 | 7480 |
7481 for(z=0;z<rowcount;z++) | 7481 for(z=0;z<rowcount;z++) |
7482 { | 7482 { |
7483 rowdata = gtk_clist_get_row_data(GTK_CLIST(clist), z); | 7483 rowdata = gtk_clist_get_row_data(GTK_CLIST(clist), z); |
7484 if(rowdata == text) | 7484 if ( strcmp(rowdata, text) == 0 ) |
7485 { | 7485 { |
7486 gfloat pos; | 7486 gfloat pos; |
7487 GtkAdjustment *adj = gtk_clist_get_vadjustment(GTK_CLIST(clist)); | 7487 GtkAdjustment *adj = gtk_clist_get_vadjustment(GTK_CLIST(clist)); |
7488 | 7488 |
7489 _dw_unselect(clist); | 7489 _dw_unselect(clist); |
7524 rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount")); | 7524 rowcount = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(clist), "_dw_rowcount")); |
7525 | 7525 |
7526 for(z=0;z<rowcount;z++) | 7526 for(z=0;z<rowcount;z++) |
7527 { | 7527 { |
7528 rowdata = gtk_clist_get_row_data(GTK_CLIST(clist), z); | 7528 rowdata = gtk_clist_get_row_data(GTK_CLIST(clist), z); |
7529 if(rowdata == text) | 7529 if ( strcmp(rowdata, text) == 0 ) |
7530 { | 7530 { |
7531 _dw_unselect(clist); | 7531 _dw_unselect(clist); |
7532 | 7532 |
7533 gtk_clist_remove(GTK_CLIST(clist), z); | 7533 gtk_clist_remove(GTK_CLIST(clist), z); |
7534 | 7534 |
7577 static void _status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) | 7577 static void _status_translate(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) |
7578 { | 7578 { |
7579 GdkEventButton event = { 0 }; | 7579 GdkEventButton event = { 0 }; |
7580 long x, y; | 7580 long x, y; |
7581 gboolean retval; | 7581 gboolean retval; |
7582 | 7582 |
7583 dw_pointer_query_pos(&x, &y); | 7583 dw_pointer_query_pos(&x, &y); |
7584 | 7584 |
7585 event.button = button; | 7585 event.button = button; |
7586 event.x = x; | 7586 event.x = x; |
7587 event.y = y; | 7587 event.y = y; |
7588 | 7588 |
7589 g_signal_emit_by_name(G_OBJECT(user_data), "button_press_event", &event, &retval); | 7589 g_signal_emit_by_name(G_OBJECT(user_data), "button_press_event", &event, &retval); |
7590 } | 7590 } |
7591 #endif | 7591 #endif |
7592 | 7592 |
7593 /* | 7593 /* |
7609 status = gtk_status_icon_new_from_pixbuf(pixbuf); | 7609 status = gtk_status_icon_new_from_pixbuf(pixbuf); |
7610 if(bubbletext) | 7610 if(bubbletext) |
7611 gtk_status_icon_set_tooltip_text(status, bubbletext); | 7611 gtk_status_icon_set_tooltip_text(status, bubbletext); |
7612 g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status); | 7612 g_object_set_data(G_OBJECT(handle), "_dw_taskbar", status); |
7613 g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_status_translate), handle); | 7613 g_signal_connect(G_OBJECT (status), "popup-menu", G_CALLBACK (_status_translate), handle); |
7614 gtk_status_icon_set_visible(status, TRUE); | 7614 gtk_status_icon_set_visible(status, TRUE); |
7615 DW_MUTEX_UNLOCK; | 7615 DW_MUTEX_UNLOCK; |
7616 #endif | 7616 #endif |
7617 } | 7617 } |
7618 | 7618 |
7619 /* | 7619 /* |
7620 * Deletes an icon from the taskbar. | 7620 * Deletes an icon from the taskbar. |
7702 */ | 7702 */ |
7703 void dw_color_background_set(unsigned long value) | 7703 void dw_color_background_set(unsigned long value) |
7704 { | 7704 { |
7705 int _locked_by_me = FALSE; | 7705 int _locked_by_me = FALSE; |
7706 GdkColor *background = pthread_getspecific(_dw_bg_color_key); | 7706 GdkColor *background = pthread_getspecific(_dw_bg_color_key); |
7707 | 7707 |
7708 if(value == DW_CLR_DEFAULT) | 7708 if(value == DW_CLR_DEFAULT) |
7709 { | 7709 { |
7710 if(background) | 7710 if(background) |
7711 { | 7711 { |
7712 pthread_setspecific(_dw_bg_color_key, NULL); | 7712 pthread_setspecific(_dw_bg_color_key, NULL); |
7714 } | 7714 } |
7715 } | 7715 } |
7716 else | 7716 else |
7717 { | 7717 { |
7718 GdkColor color = _internal_color(value); | 7718 GdkColor color = _internal_color(value); |
7719 | 7719 |
7720 DW_MUTEX_LOCK; | 7720 DW_MUTEX_LOCK; |
7721 gdk_color_alloc(_dw_cmap, &color); | 7721 gdk_color_alloc(_dw_cmap, &color); |
7722 DW_MUTEX_UNLOCK; | 7722 DW_MUTEX_UNLOCK; |
7723 if(!background) | 7723 if(!background) |
7724 { | 7724 { |
7885 cairo_set_line_width(cr, 1); | 7885 cairo_set_line_width(cr, 1); |
7886 cairo_move_to(cr, x, y); | 7886 cairo_move_to(cr, x, y); |
7887 cairo_stroke(cr); | 7887 cairo_stroke(cr); |
7888 cairo_destroy(cr); | 7888 cairo_destroy(cr); |
7889 } | 7889 } |
7890 #endif | 7890 #endif |
7891 if(gc) | 7891 if(gc) |
7892 { | 7892 { |
7893 gdk_draw_point(handle ? handle->window : pixmap->pixmap, gc, x, y); | 7893 gdk_draw_point(handle ? handle->window : pixmap->pixmap, gc, x, y); |
7894 gdk_gc_unref(gc); | 7894 gdk_gc_unref(gc); |
7895 } | 7895 } |
7982 if(fill) | 7982 if(fill) |
7983 cairo_fill(cr); | 7983 cairo_fill(cr); |
7984 cairo_stroke(cr); | 7984 cairo_stroke(cr); |
7985 cairo_destroy(cr); | 7985 cairo_destroy(cr); |
7986 } | 7986 } |
7987 #endif | 7987 #endif |
7988 if(gc && npoints) | 7988 if(gc && npoints) |
7989 { | 7989 { |
7990 points = alloca(npoints * sizeof(GdkPoint)); | 7990 points = alloca(npoints * sizeof(GdkPoint)); |
7991 /* | 7991 /* |
7992 * should check for NULL pointer return! | 7992 * should check for NULL pointer return! |
7994 for(i = 0; i < npoints; i++) | 7994 for(i = 0; i < npoints; i++) |
7995 { | 7995 { |
7996 points[i].x = x[i]; | 7996 points[i].x = x[i]; |
7997 points[i].y = y[i]; | 7997 points[i].y = y[i]; |
7998 } | 7998 } |
7999 | 7999 |
8000 gdk_draw_polygon(handle ? handle->window : pixmap->pixmap, gc, fill, points, npoints ); | 8000 gdk_draw_polygon(handle ? handle->window : pixmap->pixmap, gc, fill, points, npoints ); |
8001 gdk_gc_unref(gc); | 8001 gdk_gc_unref(gc); |
8002 } | 8002 } |
8003 DW_MUTEX_UNLOCK; | 8003 DW_MUTEX_UNLOCK; |
8004 } | 8004 } |
8042 if(fill) | 8042 if(fill) |
8043 cairo_fill(cr); | 8043 cairo_fill(cr); |
8044 cairo_stroke(cr); | 8044 cairo_stroke(cr); |
8045 cairo_destroy(cr); | 8045 cairo_destroy(cr); |
8046 } | 8046 } |
8047 #endif | 8047 #endif |
8048 if(gc) | 8048 if(gc) |
8049 { | 8049 { |
8050 gdk_draw_rectangle(handle ? handle->window : pixmap->pixmap, gc, fill, x, y, width, height); | 8050 gdk_draw_rectangle(handle ? handle->window : pixmap->pixmap, gc, fill, x, y, width, height); |
8051 gdk_gc_unref(gc); | 8051 gdk_gc_unref(gc); |
8052 } | 8052 } |
8087 if(cr) | 8087 if(cr) |
8088 { | 8088 { |
8089 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); | 8089 GdkColor *foreground = pthread_getspecific(_dw_fg_color_key); |
8090 double a1 = atan2((y1-yorigin), (x1-xorigin)); | 8090 double a1 = atan2((y1-yorigin), (x1-xorigin)); |
8091 double a2 = atan2((y2-yorigin), (x2-xorigin)); | 8091 double a2 = atan2((y2-yorigin), (x2-xorigin)); |
8092 | 8092 |
8093 gdk_cairo_set_source_color (cr, foreground); | 8093 gdk_cairo_set_source_color (cr, foreground); |
8094 cairo_set_line_width(cr, 1); | 8094 cairo_set_line_width(cr, 1); |
8095 /* TODO: Handle ellipses */ | 8095 /* TODO: Handle ellipses */ |
8096 if(flags & DW_DRAW_FULL) | 8096 if(flags & DW_DRAW_FULL) |
8097 cairo_arc(cr, xorigin, yorigin, r, 0, M_PI*2); | 8097 cairo_arc(cr, xorigin, yorigin, r, 0, M_PI*2); |
8100 if(flags & DW_DRAW_FILL) | 8100 if(flags & DW_DRAW_FILL) |
8101 cairo_fill(cr); | 8101 cairo_fill(cr); |
8102 cairo_stroke(cr); | 8102 cairo_stroke(cr); |
8103 cairo_destroy(cr); | 8103 cairo_destroy(cr); |
8104 } | 8104 } |
8105 #endif | 8105 #endif |
8106 if(gc) | 8106 if(gc) |
8107 { | 8107 { |
8108 double radius1 = 0, radius2 = 0; | 8108 double radius1 = 0, radius2 = 0; |
8109 int alpha1, alpha2; | 8109 int alpha1, alpha2; |
8110 | 8110 |
8120 } | 8120 } |
8121 alpha1 = (int)(radius1 * 64.0); | 8121 alpha1 = (int)(radius1 * 64.0); |
8122 alpha2 = (int)((radius2 - radius1) * 64.0); | 8122 alpha2 = (int)((radius2 - radius1) * 64.0); |
8123 while (alpha2 <= 0) alpha2 += 360*64; | 8123 while (alpha2 <= 0) alpha2 += 360*64; |
8124 while (alpha1 > 360*64) alpha1 -= 360*64; | 8124 while (alpha1 > 360*64) alpha1 -= 360*64; |
8125 | 8125 |
8126 gdk_draw_arc(handle ? handle->window : pixmap->pixmap, gc, FALSE, xorigin-r, yorigin-r, 2*r,2*r, alpha1, alpha2); | 8126 gdk_draw_arc(handle ? handle->window : pixmap->pixmap, gc, FALSE, xorigin-r, yorigin-r, 2*r,2*r, alpha1, alpha2); |
8127 gdk_gc_unref(gc); | 8127 gdk_gc_unref(gc); |
8128 } | 8128 } |
8129 DW_MUTEX_UNLOCK; | 8129 DW_MUTEX_UNLOCK; |
8130 } | 8130 } |
8693 cr = cairo_create(destp->image); | 8693 cr = cairo_create(destp->image); |
8694 | 8694 |
8695 if(cr) | 8695 if(cr) |
8696 { | 8696 { |
8697 double xscale = 1, yscale = 1; | 8697 double xscale = 1, yscale = 1; |
8698 | 8698 |
8699 if(srcwidth != -1 && srcheight != -1) | 8699 if(srcwidth != -1 && srcheight != -1) |
8700 { | 8700 { |
8701 xscale = (double)width / (double)srcwidth; | 8701 xscale = (double)width / (double)srcwidth; |
8702 yscale = (double)height / (double)srcheight; | 8702 yscale = (double)height / (double)srcheight; |
8703 cairo_scale(cr, xscale, yscale); | 8703 cairo_scale(cr, xscale, yscale); |
8704 } | 8704 } |
8705 | 8705 |
8706 #if GTK_CHECK_VERSION(2,24,0) | 8706 #if GTK_CHECK_VERSION(2,24,0) |
8707 if(src) | 8707 if(src) |
8708 gdk_cairo_set_source_window (cr, gtk_widget_get_window(src), xdest -xsrc, ydest - ysrc); | 8708 gdk_cairo_set_source_window (cr, gtk_widget_get_window(src), xdest -xsrc, ydest - ysrc); |
8709 else | 8709 else |
8710 #endif | 8710 #endif |
8713 else if(srcp && srcp->pixmap && !srcp->bitmap) | 8713 else if(srcp && srcp->pixmap && !srcp->bitmap) |
8714 gdk_cairo_set_source_pixmap (cr, srcp->pixmap, (xdest - xsrc) / xscale, (ydest - ysrc) / yscale); | 8714 gdk_cairo_set_source_pixmap (cr, srcp->pixmap, (xdest - xsrc) / xscale, (ydest - ysrc) / yscale); |
8715 else if(srcp && srcp->pixmap && srcp->bitmap) | 8715 else if(srcp && srcp->pixmap && srcp->bitmap) |
8716 { | 8716 { |
8717 cairo_pattern_t *mask_pattern; | 8717 cairo_pattern_t *mask_pattern; |
8718 | 8718 |
8719 /* hack to get the mask pattern */ | 8719 /* hack to get the mask pattern */ |
8720 gdk_cairo_set_source_pixmap(cr, srcp->bitmap, xdest / xscale, ydest / yscale); | 8720 gdk_cairo_set_source_pixmap(cr, srcp->bitmap, xdest / xscale, ydest / yscale); |
8721 mask_pattern = cairo_get_source(cr); | 8721 mask_pattern = cairo_get_source(cr); |
8722 cairo_pattern_reference(mask_pattern); | 8722 cairo_pattern_reference(mask_pattern); |
8723 | 8723 |
8785 | 8785 |
8786 #if GTK_CHECK_VERSION(2,10,0) | 8786 #if GTK_CHECK_VERSION(2,10,0) |
8787 if((destp && destp->image) || (srcp && srcp->image)) | 8787 if((destp && destp->image) || (srcp && srcp->image)) |
8788 return _cairo_pixmap_bitblt(dest, destp, xdest, ydest, width, height, src, srcp, xsrc, ysrc, srcwidth, srcheight); | 8788 return _cairo_pixmap_bitblt(dest, destp, xdest, ydest, width, height, src, srcp, xsrc, ysrc, srcwidth, srcheight); |
8789 #endif | 8789 #endif |
8790 | 8790 |
8791 if((!dest && (!destp || !destp->pixmap)) || (!src && (!srcp || !srcp->pixmap))) | 8791 if((!dest && (!destp || !destp->pixmap)) || (!src && (!srcp || !srcp->pixmap))) |
8792 return retval; | 8792 return retval; |
8793 | 8793 |
8794 if((srcwidth == -1 || srcheight == -1) && srcwidth != srcheight) | 8794 if((srcwidth == -1 || srcheight == -1) && srcwidth != srcheight) |
8795 return retval; | 8795 return retval; |
8814 * draw the resulting scaled copy and free the left over pixbufs. | 8814 * draw the resulting scaled copy and free the left over pixbufs. |
8815 */ | 8815 */ |
8816 GdkPixbuf *pbdst, *pbsrc = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, srcwidth, srcheight); | 8816 GdkPixbuf *pbdst, *pbsrc = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, srcwidth, srcheight); |
8817 /* Now that with have a pixbuf with alpha, copy from the drawable to create the source */ | 8817 /* Now that with have a pixbuf with alpha, copy from the drawable to create the source */ |
8818 gdk_pixbuf_get_from_drawable(pbsrc, src ? src->window : srcp->pixmap, NULL, xsrc, ysrc, 0, 0, srcwidth, srcheight); | 8818 gdk_pixbuf_get_from_drawable(pbsrc, src ? src->window : srcp->pixmap, NULL, xsrc, ysrc, 0, 0, srcwidth, srcheight); |
8819 | 8819 |
8820 /* Scale the pixbuf to the desired size */ | 8820 /* Scale the pixbuf to the desired size */ |
8821 pbdst = gdk_pixbuf_scale_simple(pbsrc, width, height, GDK_INTERP_BILINEAR); | 8821 pbdst = gdk_pixbuf_scale_simple(pbsrc, width, height, GDK_INTERP_BILINEAR); |
8822 /* Create a new clipping mask from the scaled pixbuf */ | 8822 /* Create a new clipping mask from the scaled pixbuf */ |
8823 if( srcp && srcp->bitmap && srcp->pixbuf ) | 8823 if( srcp && srcp->bitmap && srcp->pixbuf ) |
8824 { | 8824 { |
8825 GdkBitmap *bitmap = gdk_pixmap_new(NULL, width, height, 1); | 8825 GdkBitmap *bitmap = gdk_pixmap_new(NULL, width, height, 1); |
8826 GdkPixbuf *pborig = gdk_pixbuf_scale_simple(srcp->pixbuf, width, height, GDK_INTERP_BILINEAR); | 8826 GdkPixbuf *pborig = gdk_pixbuf_scale_simple(srcp->pixbuf, width, height, GDK_INTERP_BILINEAR); |
8827 gdk_pixbuf_render_threshold_alpha(pborig, bitmap, 0, 0, 0, 0, width, height, 1); | 8827 gdk_pixbuf_render_threshold_alpha(pborig, bitmap, 0, 0, 0, 0, width, height, 1); |
8828 gdk_gc_set_clip_mask( gc, bitmap ); | 8828 gdk_gc_set_clip_mask( gc, bitmap ); |
8829 gdk_gc_set_clip_origin( gc, xdest, ydest ); | 8829 gdk_gc_set_clip_origin( gc, xdest, ydest ); |
8830 gdk_bitmap_unref(bitmap); | 8830 gdk_bitmap_unref(bitmap); |
8831 gdk_pixbuf_unref(pborig); | 8831 gdk_pixbuf_unref(pborig); |
8832 } | 8832 } |
9107 | 9107 |
9108 if(!eve) | 9108 if(!eve) |
9109 return DW_ERROR_NON_INIT; | 9109 return DW_ERROR_NON_INIT; |
9110 | 9110 |
9111 pthread_mutex_lock (&(eve->mutex)); | 9111 pthread_mutex_lock (&(eve->mutex)); |
9112 | 9112 |
9113 if(eve->posted) | 9113 if(eve->posted) |
9114 { | 9114 { |
9115 pthread_mutex_unlock (&(eve->mutex)); | 9115 pthread_mutex_unlock (&(eve->mutex)); |
9116 return DW_ERROR_NONE; | 9116 return DW_ERROR_NONE; |
9117 } | 9117 } |
9118 | 9118 |
9119 if(timeout != -1) | 9119 if(timeout != -1) |
9120 { | 9120 { |
9121 struct timeval now; | 9121 struct timeval now; |
9122 struct timespec timeo; | 9122 struct timespec timeo; |
9123 | 9123 |
9124 gettimeofday(&now, 0); | 9124 gettimeofday(&now, 0); |
9125 timeo.tv_sec = now.tv_sec + (timeout / 1000); | 9125 timeo.tv_sec = now.tv_sec + (timeout / 1000); |
9126 timeo.tv_nsec = now.tv_usec * 1000; | 9126 timeo.tv_nsec = now.tv_usec * 1000; |
9127 rc = pthread_cond_timedwait(&(eve->event), &(eve->mutex), &timeo); | 9127 rc = pthread_cond_timedwait(&(eve->event), &(eve->mutex), &timeo); |
9128 } | 9128 } |
9129 else | 9129 else |
9130 rc = pthread_cond_wait(&(eve->event), &(eve->mutex)); | 9130 rc = pthread_cond_wait(&(eve->event), &(eve->mutex)); |
9131 | 9131 |
9132 pthread_mutex_unlock (&(eve->mutex)); | 9132 pthread_mutex_unlock (&(eve->mutex)); |
9133 if(!rc) | 9133 if(!rc) |
9134 return DW_ERROR_NONE; | 9134 return DW_ERROR_NONE; |
9135 if(rc == ETIMEDOUT) | 9135 if(rc == ETIMEDOUT) |
9136 return DW_ERROR_TIMEOUT; | 9136 return DW_ERROR_TIMEOUT; |
9503 | 9503 |
9504 threadfunc = (void (*)(void *))tmp[0]; | 9504 threadfunc = (void (*)(void *))tmp[0]; |
9505 | 9505 |
9506 /* Initialize colors */ | 9506 /* Initialize colors */ |
9507 _init_thread(); | 9507 _init_thread(); |
9508 | 9508 |
9509 threadfunc(tmp[1]); | 9509 threadfunc(tmp[1]); |
9510 free(tmp); | 9510 free(tmp); |
9511 | 9511 |
9512 /* Free colors */ | 9512 /* Free colors */ |
9513 if((foreground = pthread_getspecific(_dw_fg_color_key))) | 9513 if((foreground = pthread_getspecific(_dw_fg_color_key))) |
9514 free(foreground); | 9514 free(foreground); |
9515 if((background = pthread_getspecific(_dw_bg_color_key))) | 9515 if((background = pthread_getspecific(_dw_bg_color_key))) |
9516 free(background); | 9516 free(background); |
9687 guint oldpos; | 9687 guint oldpos; |
9688 | 9688 |
9689 /* Drop out if missing table */ | 9689 /* Drop out if missing table */ |
9690 if(!cont) | 9690 if(!cont) |
9691 return; | 9691 return; |
9692 | 9692 |
9693 /* Check orientation */ | 9693 /* Check orientation */ |
9694 if(pos < 0) | 9694 if(pos < 0) |
9695 { | 9695 { |
9696 /* Horz */ | 9696 /* Horz */ |
9697 pos = -(pos + 1); | 9697 pos = -(pos + 1); |
9698 gtk_container_child_get(cont, widget, "left-attach", &oldpos, NULL); | 9698 gtk_container_child_get(cont, widget, "left-attach", &oldpos, NULL); |
9781 /* Do some sanity bounds checking */ | 9781 /* Do some sanity bounds checking */ |
9782 if(index < 0) | 9782 if(index < 0) |
9783 index = 0; | 9783 index = 0; |
9784 if(index > boxcount) | 9784 if(index > boxcount) |
9785 index = boxcount; | 9785 index = boxcount; |
9786 | 9786 |
9787 if(boxtype == DW_VERT) | 9787 if(boxtype == DW_VERT) |
9788 { | 9788 { |
9789 x = 0; | 9789 x = 0; |
9790 y = index; | 9790 y = index; |
9791 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); | 9791 gtk_table_resize(GTK_TABLE(box), boxcount + 1, 1); |
9818 } | 9818 } |
9819 } | 9819 } |
9820 else | 9820 else |
9821 { | 9821 { |
9822 GtkWidget *vbox = gtk_object_get_data(GTK_OBJECT(box), "_dw_vbox"); | 9822 GtkWidget *vbox = gtk_object_get_data(GTK_OBJECT(box), "_dw_vbox"); |
9823 | 9823 |
9824 if(!vbox) | 9824 if(!vbox) |
9825 { | 9825 { |
9826 vbox = gtk_vbox_new(FALSE, 0); | 9826 vbox = gtk_vbox_new(FALSE, 0); |
9827 gtk_object_set_data(GTK_OBJECT(box), "_dw_vbox", vbox); | 9827 gtk_object_set_data(GTK_OBJECT(box), "_dw_vbox", vbox); |
9828 gtk_container_add(GTK_CONTAINER(box), vbox); | 9828 gtk_container_add(GTK_CONTAINER(box), vbox); |
9829 gtk_widget_show(vbox); | 9829 gtk_widget_show(vbox); |
9830 } | 9830 } |
9831 | 9831 |
9832 gtk_container_set_border_width(GTK_CONTAINER(box), pad); | 9832 gtk_container_set_border_width(GTK_CONTAINER(box), pad); |
9833 | 9833 |
9834 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) | 9834 if(GTK_IS_TABLE(item) || (tmpitem && GTK_IS_TABLE(tmpitem))) |
9835 { | 9835 { |
9836 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_eventbox"); | 9836 GtkWidget *eventbox = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(item), "_dw_eventbox"); |
9873 /* | 9873 /* |
9874 * Pack windows (widgets) into a box at an arbitrary location. | 9874 * Pack windows (widgets) into a box at an arbitrary location. |
9875 * Parameters: | 9875 * Parameters: |
9876 * box: Window handle of the box to be packed into. | 9876 * box: Window handle of the box to be packed into. |
9877 * item: Window handle of the item to be back. | 9877 * item: Window handle of the item to be back. |
9878 * index: 0 based index of packed items. | 9878 * index: 0 based index of packed items. |
9879 * width: Width in pixels of the item or -1 to be self determined. | 9879 * width: Width in pixels of the item or -1 to be self determined. |
9880 * height: Height in pixels of the item or -1 to be self determined. | 9880 * height: Height in pixels of the item or -1 to be self determined. |
9881 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. | 9881 * hsize: TRUE if the window (widget) should expand horizontally to fill space given. |
9882 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | 9882 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
9883 * pad: Number of pixels of padding around the item. | 9883 * pad: Number of pixels of padding around the item. |
9898 * vsize: TRUE if the window (widget) should expand vertically to fill space given. | 9898 * vsize: TRUE if the window (widget) should expand vertically to fill space given. |
9899 * pad: Number of pixels of padding around the item. | 9899 * pad: Number of pixels of padding around the item. |
9900 */ | 9900 */ |
9901 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) | 9901 void API dw_box_pack_start(HWND box, HWND item, int width, int height, int hsize, int vsize, int pad) |
9902 { | 9902 { |
9903 /* 65536 is the table limit on GTK... | 9903 /* 65536 is the table limit on GTK... |
9904 * seems like a high enough value we will never hit it here either. | 9904 * seems like a high enough value we will never hit it here either. |
9905 */ | 9905 */ |
9906 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); | 9906 _dw_box_pack(box, item, 65536, width, height, hsize, vsize, pad, "dw_box_pack_start()"); |
9907 } | 9907 } |
9908 | 9908 |
10018 GtkWidget *mdi; | 10018 GtkWidget *mdi; |
10019 #endif | 10019 #endif |
10020 | 10020 |
10021 if(!handle) | 10021 if(!handle) |
10022 return; | 10022 return; |
10023 | 10023 |
10024 DW_MUTEX_LOCK; | 10024 DW_MUTEX_LOCK; |
10025 #if GTK_MAJOR_VERSION > 1 | 10025 #if GTK_MAJOR_VERSION > 1 |
10026 if((mdi = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) | 10026 if((mdi = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
10027 { | 10027 { |
10028 gtk_mdi_move(GTK_MDI(mdi), handle, x, y); | 10028 gtk_mdi_move(GTK_MDI(mdi), handle, x, y); |
10029 } | 10029 } |
10030 else | 10030 else |
10031 #endif | 10031 #endif |
10032 { | 10032 { |
10033 GdkWindow *window = NULL; | 10033 GdkWindow *window = NULL; |
10034 | 10034 |
10035 if(GTK_IS_WINDOW(handle)) | 10035 if(GTK_IS_WINDOW(handle)) |
10036 { | 10036 { |
10037 #if GTK_MAJOR_VERSION > 1 | 10037 #if GTK_MAJOR_VERSION > 1 |
10038 gtk_window_move(GTK_WINDOW(handle), x, y); | 10038 gtk_window_move(GTK_WINDOW(handle), x, y); |
10039 #else | 10039 #else |
10040 gtk_widget_set_uposition(handle, x, y); | 10040 gtk_widget_set_uposition(handle, x, y); |
10041 #endif | 10041 #endif |
10042 } | 10042 } |
10043 else if((window = gtk_widget_get_window(handle))) | 10043 else if((window = gtk_widget_get_window(handle))) |
10044 gdk_window_move(window, x, y); | 10044 gdk_window_move(window, x, y); |
10045 } | 10045 } |
10046 DW_MUTEX_UNLOCK; | 10046 DW_MUTEX_UNLOCK; |
10062 GtkWidget *mdi; | 10062 GtkWidget *mdi; |
10063 #endif | 10063 #endif |
10064 | 10064 |
10065 if(!handle) | 10065 if(!handle) |
10066 return; | 10066 return; |
10067 | 10067 |
10068 DW_MUTEX_LOCK; | 10068 DW_MUTEX_LOCK; |
10069 #if GTK_MAJOR_VERSION > 1 | 10069 #if GTK_MAJOR_VERSION > 1 |
10070 if((mdi = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) | 10070 if((mdi = (GtkWidget *)gtk_object_get_data(GTK_OBJECT(handle), "_dw_mdi")) && GTK_IS_MDI(mdi)) |
10071 { | 10071 { |
10072 gtk_mdi_move(GTK_MDI(mdi), handle, x, y); | 10072 gtk_mdi_move(GTK_MDI(mdi), handle, x, y); |
10079 dw_window_set_size(handle, width, height); | 10079 dw_window_set_size(handle, width, height); |
10080 #if GTK_MAJOR_VERSION > 1 | 10080 #if GTK_MAJOR_VERSION > 1 |
10081 gtk_window_move(GTK_WINDOW(handle), x, y); | 10081 gtk_window_move(GTK_WINDOW(handle), x, y); |
10082 #else | 10082 #else |
10083 gtk_widget_set_uposition(handle, x, y); | 10083 gtk_widget_set_uposition(handle, x, y); |
10084 #endif | 10084 #endif |
10085 } | 10085 } |
10086 else if(handle->window) | 10086 else if(handle->window) |
10087 { | 10087 { |
10088 gdk_window_resize(handle->window, width, height); | 10088 gdk_window_resize(handle->window, width, height); |
10089 gdk_window_move(handle->window, x, y); | 10089 gdk_window_move(handle->window, x, y); |
11522 GtkFileFilter *filter2 = NULL; | 11522 GtkFileFilter *filter2 = NULL; |
11523 gchar *button; | 11523 gchar *button; |
11524 char *filename = NULL; | 11524 char *filename = NULL; |
11525 char buf[1000]; | 11525 char buf[1000]; |
11526 char mypath[PATH_MAX+1]; | 11526 char mypath[PATH_MAX+1]; |
11527 | 11527 |
11528 switch (flags ) | 11528 switch (flags ) |
11529 { | 11529 { |
11530 case DW_DIRECTORY_OPEN: | 11530 case DW_DIRECTORY_OPEN: |
11531 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; | 11531 action = GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER; |
11532 button = GTK_STOCK_OPEN; | 11532 button = GTK_STOCK_OPEN; |
12257 HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) | 12257 HPRINT API dw_print_new(char *jobname, unsigned long flags, unsigned int pages, void *drawfunc, void *drawdata) |
12258 { | 12258 { |
12259 #if GTK_CHECK_VERSION(2,10,0) | 12259 #if GTK_CHECK_VERSION(2,10,0) |
12260 GtkPrintOperation *op; | 12260 GtkPrintOperation *op; |
12261 int _locked_by_me = FALSE; | 12261 int _locked_by_me = FALSE; |
12262 | 12262 |
12263 if(!drawfunc) | 12263 if(!drawfunc) |
12264 return NULL; | 12264 return NULL; |
12265 | 12265 |
12266 DW_MUTEX_LOCK; | 12266 DW_MUTEX_LOCK; |
12267 if((op = gtk_print_operation_new())) | 12267 if((op = gtk_print_operation_new())) |
12268 { | 12268 { |
12269 gtk_print_operation_set_n_pages(op, pages); | 12269 gtk_print_operation_set_n_pages(op, pages); |
12270 gtk_print_operation_set_job_name(op, jobname ? jobname : "Dynamic Windows Print Job"); | 12270 gtk_print_operation_set_job_name(op, jobname ? jobname : "Dynamic Windows Print Job"); |
12271 g_object_set_data(G_OBJECT(op), "_dw_drawfunc", drawfunc); | 12271 g_object_set_data(G_OBJECT(op), "_dw_drawfunc", drawfunc); |
12291 { | 12291 { |
12292 #if GTK_CHECK_VERSION(2,10,0) | 12292 #if GTK_CHECK_VERSION(2,10,0) |
12293 GtkPrintOperationResult res; | 12293 GtkPrintOperationResult res; |
12294 GtkPrintOperation *op = (GtkPrintOperation *)print; | 12294 GtkPrintOperation *op = (GtkPrintOperation *)print; |
12295 int _locked_by_me = FALSE; | 12295 int _locked_by_me = FALSE; |
12296 | 12296 |
12297 DW_MUTEX_LOCK; | 12297 DW_MUTEX_LOCK; |
12298 res = gtk_print_operation_run(op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, NULL); | 12298 res = gtk_print_operation_run(op, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, NULL, NULL); |
12299 DW_MUTEX_UNLOCK; | 12299 DW_MUTEX_UNLOCK; |
12300 return (res == GTK_PRINT_OPERATION_RESULT_ERROR ? DW_ERROR_UNKNOWN : DW_ERROR_NONE); | 12300 return (res == GTK_PRINT_OPERATION_RESULT_ERROR ? DW_ERROR_UNKNOWN : DW_ERROR_NONE); |
12301 #else | 12301 #else |
12302 return DW_ERROR_UNKNOWN; | 12302 return DW_ERROR_UNKNOWN; |
12303 #endif | 12303 #endif |
12304 } | 12304 } |
12305 | 12305 |
12306 /* | 12306 /* |
12311 void API dw_print_cancel(HPRINT print) | 12311 void API dw_print_cancel(HPRINT print) |
12312 { | 12312 { |
12313 #if GTK_CHECK_VERSION(2,10,0) | 12313 #if GTK_CHECK_VERSION(2,10,0) |
12314 int _locked_by_me = FALSE; | 12314 int _locked_by_me = FALSE; |
12315 GtkPrintOperation *op = (GtkPrintOperation *)print; | 12315 GtkPrintOperation *op = (GtkPrintOperation *)print; |
12316 | 12316 |
12317 DW_MUTEX_LOCK; | 12317 DW_MUTEX_LOCK; |
12318 gtk_print_operation_cancel(op); | 12318 gtk_print_operation_cancel(op); |
12319 DW_MUTEX_UNLOCK; | 12319 DW_MUTEX_UNLOCK; |
12320 #endif | 12320 #endif |
12321 } | 12321 } |