Use gdk_window_get_root_origin to get the window positions for session

managment.

A few cosmetic fixes to the script-fu dialog.


--Sven
This commit is contained in:
Sven Neumann 1998-11-09 15:23:29 +00:00
parent c1d5c563ec
commit 7f0ea3f587
6 changed files with 100 additions and 88 deletions

View File

@ -1,3 +1,11 @@
Mon Nov 9 16:20:33 MET 1998 Sven Neumann <sven@gimp.org>
* app/session.c: use gdk_window_get_root_origin to get the window
position
* plug-ins/script-fu/script-fu-scripts.c
* plug-ins/script-fu/scripts/test-sphere.scm: small cosmetic fixes
Sun Nov 8 17:51:52 PST 1998 Manish Singh <yosh@gimp.org>
* Makefile.am

View File

@ -30,10 +30,6 @@
openend images is planned, but I'm still not sure how to deal with dirty
images.
There is a problem with the offset introduced by the window-manager adding
decorations to the windows. This is annoying and should be fixed somehow.
( Update: I was promised that this will be fixed in gtk. )
Dialogs are now reopened if the gimp is called with the command-line-option
--restore-session or if the related entry is set in gimprc.
Probably there should alternatively be a list of dialogs in the preferences
@ -92,14 +88,9 @@ session_get_window_info (GtkWidget *window,
if ( !save_session_info || info == NULL || window->window == NULL )
return;
gdk_window_get_origin (window->window, &info->x, &info->y);
gdk_window_get_root_origin (window->window, &info->x, &info->y);
gdk_window_get_size (window->window, &info->width, &info->height);
/* This is a very ugly hack to work against the offset
introduced by window decorations.
The problem should be handled in gtk ... */
info->y += -20;
if ( we_are_exiting )
info->open = GTK_WIDGET_VISIBLE (window);

View File

@ -30,10 +30,6 @@
openend images is planned, but I'm still not sure how to deal with dirty
images.
There is a problem with the offset introduced by the window-manager adding
decorations to the windows. This is annoying and should be fixed somehow.
( Update: I was promised that this will be fixed in gtk. )
Dialogs are now reopened if the gimp is called with the command-line-option
--restore-session or if the related entry is set in gimprc.
Probably there should alternatively be a list of dialogs in the preferences
@ -92,14 +88,9 @@ session_get_window_info (GtkWidget *window,
if ( !save_session_info || info == NULL || window->window == NULL )
return;
gdk_window_get_origin (window->window, &info->x, &info->y);
gdk_window_get_root_origin (window->window, &info->x, &info->y);
gdk_window_get_size (window->window, &info->width, &info->height);
/* This is a very ugly hack to work against the offset
introduced by window decorations.
The problem should be handled in gtk ... */
info->y += -20;
if ( we_are_exiting )
info->open = GTK_WIDGET_VISIBLE (window);

View File

@ -197,30 +197,29 @@ static void script_fu_about_dialog_close (GtkWidget *widget,
static gint script_fu_about_dialog_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void script_fu_pattern_preview (gchar *name,
gint width,
gint height,
gint bytes,
gchar * mask_data,
gint closing,
gpointer udata);
static void script_fu_pattern_preview (gchar *name,
gint width,
gint height,
gint bytes,
gchar * mask_data,
gint closing,
gpointer udata);
static void script_fu_gradient_preview (gchar *name,
gint width,
gdouble * mask_data,
gint closing,
gpointer udata);
static void script_fu_brush_preview (char *, /* Name */
gdouble, /* opacity */
gint, /* spacing */
gint, /* paint_mode */
gint, /* width */
gint, /* height */
gchar *, /* mask data */
gint, /* dialog closing */
gpointer /* user data */);
static void script_fu_gradient_preview (gchar *name,
gint width,
gdouble * mask_data,
gint closing,
gpointer udata);
static void script_fu_brush_preview (char *, /* Name */
gdouble, /* opacity */
gint, /* spacing */
gint, /* paint_mode */
gint, /* width */
gint, /* height */
gchar *, /* mask data */
gint, /* dialog closing */
gpointer /* user data */);
/*
@ -1274,7 +1273,7 @@ script_fu_interface (SFScript *script)
&script->arg_values[i].sfa_pattern);
break;
case SF_GRADIENT:
script->args_widgets[i] = gimp_gradient_select_widget("Script-fu Pattern Selection",
script->args_widgets[i] = gimp_gradient_select_widget("Script-Fu Gradient Selection",
script->arg_values[i].sfa_gradient,
script_fu_gradient_preview,
&script->arg_values[i].sfa_gradient);
@ -1282,7 +1281,7 @@ script_fu_interface (SFScript *script)
case SF_BRUSH:
script->args_widgets[i] =
gimp_brush_select_widget("Script-fu brush Selection",
gimp_brush_select_widget("Script-Fu Brush Selection",
script->arg_values[i].sfa_brush.name,
script->arg_values[i].sfa_brush.opacity,
script->arg_values[i].sfa_brush.spacing,
@ -1397,13 +1396,13 @@ script_fu_color_preview (GtkWidget *preview,
static void
script_fu_pattern_preview(gchar *name,
gint width,
gint height,
gint bytes,
gchar * mask_data,
gint closing,
gpointer udata)
script_fu_pattern_preview (gchar *name,
gint width,
gint height,
gint bytes,
gchar * mask_data,
gint closing,
gpointer udata)
{
gchar ** pname = (gchar **) udata;
g_free(*pname);
@ -2075,7 +2074,7 @@ script_fu_file_preview_callback (GtkWidget *widget,
if (!file->dialog)
{
file->dialog = gtk_file_selection_new ("Script-Fu File Selector");
file->dialog = gtk_file_selection_new ("Script-Fu File Selection");
fs = GTK_FILE_SELECTION (file->dialog);
gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
@ -2146,7 +2145,7 @@ script_fu_font_preview_callback (GtkWidget *widget,
if (!font->dialog)
{
font->dialog = gtk_font_selection_dialog_new ("Script-Fu Font Selector");
font->dialog = gtk_font_selection_dialog_new ("Script-Fu Font Selection");
fsd = GTK_FONT_SELECTION_DIALOG (font->dialog);
gtk_signal_connect (GTK_OBJECT (fsd->ok_button), "clicked",
@ -2227,3 +2226,8 @@ script_fu_about_dialog_delete (GtkWidget *widget,
return TRUE;
}

View File

@ -197,30 +197,29 @@ static void script_fu_about_dialog_close (GtkWidget *widget,
static gint script_fu_about_dialog_delete (GtkWidget *widget,
GdkEvent *event,
gpointer data);
static void script_fu_pattern_preview (gchar *name,
gint width,
gint height,
gint bytes,
gchar * mask_data,
gint closing,
gpointer udata);
static void script_fu_pattern_preview (gchar *name,
gint width,
gint height,
gint bytes,
gchar * mask_data,
gint closing,
gpointer udata);
static void script_fu_gradient_preview (gchar *name,
gint width,
gdouble * mask_data,
gint closing,
gpointer udata);
static void script_fu_brush_preview (char *, /* Name */
gdouble, /* opacity */
gint, /* spacing */
gint, /* paint_mode */
gint, /* width */
gint, /* height */
gchar *, /* mask data */
gint, /* dialog closing */
gpointer /* user data */);
static void script_fu_gradient_preview (gchar *name,
gint width,
gdouble * mask_data,
gint closing,
gpointer udata);
static void script_fu_brush_preview (char *, /* Name */
gdouble, /* opacity */
gint, /* spacing */
gint, /* paint_mode */
gint, /* width */
gint, /* height */
gchar *, /* mask data */
gint, /* dialog closing */
gpointer /* user data */);
/*
@ -1274,7 +1273,7 @@ script_fu_interface (SFScript *script)
&script->arg_values[i].sfa_pattern);
break;
case SF_GRADIENT:
script->args_widgets[i] = gimp_gradient_select_widget("Script-fu Pattern Selection",
script->args_widgets[i] = gimp_gradient_select_widget("Script-Fu Gradient Selection",
script->arg_values[i].sfa_gradient,
script_fu_gradient_preview,
&script->arg_values[i].sfa_gradient);
@ -1282,7 +1281,7 @@ script_fu_interface (SFScript *script)
case SF_BRUSH:
script->args_widgets[i] =
gimp_brush_select_widget("Script-fu brush Selection",
gimp_brush_select_widget("Script-Fu Brush Selection",
script->arg_values[i].sfa_brush.name,
script->arg_values[i].sfa_brush.opacity,
script->arg_values[i].sfa_brush.spacing,
@ -1397,13 +1396,13 @@ script_fu_color_preview (GtkWidget *preview,
static void
script_fu_pattern_preview(gchar *name,
gint width,
gint height,
gint bytes,
gchar * mask_data,
gint closing,
gpointer udata)
script_fu_pattern_preview (gchar *name,
gint width,
gint height,
gint bytes,
gchar * mask_data,
gint closing,
gpointer udata)
{
gchar ** pname = (gchar **) udata;
g_free(*pname);
@ -2075,7 +2074,7 @@ script_fu_file_preview_callback (GtkWidget *widget,
if (!file->dialog)
{
file->dialog = gtk_file_selection_new ("Script-Fu File Selector");
file->dialog = gtk_file_selection_new ("Script-Fu File Selection");
fs = GTK_FILE_SELECTION (file->dialog);
gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
@ -2146,7 +2145,7 @@ script_fu_font_preview_callback (GtkWidget *widget,
if (!font->dialog)
{
font->dialog = gtk_font_selection_dialog_new ("Script-Fu Font Selector");
font->dialog = gtk_font_selection_dialog_new ("Script-Fu Font Selection");
fsd = GTK_FONT_SELECTION_DIALOG (font->dialog);
gtk_signal_connect (GTK_OBJECT (fsd->ok_button), "clicked",
@ -2227,3 +2226,8 @@ script_fu_about_dialog_delete (GtkWidget *widget,
return TRUE;
}

View File

@ -76,10 +76,23 @@
; The vaule returned when the script is invoked is a string containing the
; gradient name. If the above selection was not altered the string would
; contain "Deep_Sea"
;
; ----------------------------------------------------------------------
;
; SF-FILENAME
; Only useful in interactive mode. It will create a widget in the control
; dialog. The widget consists of a button containing the name of a file.
; If the button is pressed a file selection dialog will popup.
;
; Usage:-
; SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg"
;
; The vaule returned when the script is invoked is a string containing the
; filename.
;
(define (script-fu-test-sphere radius light shadow bg-color sphere-color brush text pattern gradient font size)
(define (script-fu-test-sphere radius light shadow bg-color sphere-color brush text pattern gradient font size filename)
(let* ((width (* radius 3.75))
(height (* radius 2.5))
(img (car (gimp-image-new width height RGB)))
@ -157,6 +170,7 @@
SF-PATTERN "Pattern" "Maple Leaves"
SF-GRADIENT "Gradient" "Deep_Sea"
SF-FONT "Font" "-freefont-agate-normal-r-normal-*-24-*-*-*-p-*-*-*"
SF-ADJUSTMENT "Font size (in pixels)" '(50 1 1000 1 10 0 1))
SF-ADJUSTMENT "Font size (in pixels)" '(50 1 1000 1 10 0 1)
SF-FILENAME "Environment Map" (string-append "" gimp-data-dir "/scripts/beavis.jpg"))