annotate src/frame-gtk.c @ 665:fdefd0186b75

[xemacs-hg @ 2001-09-20 06:28:42 by ben] The great integral types renaming. The purpose of this is to rationalize the names used for various integral types, so that they match their intended uses and follow consist conventions, and eliminate types that were not semantically different from each other. The conventions are: -- All integral types that measure quantities of anything are signed. Some people disagree vociferously with this, but their arguments are mostly theoretical, and are vastly outweighed by the practical headaches of mixing signed and unsigned values, and more importantly by the far increased likelihood of inadvertent bugs: Because of the broken "viral" nature of unsigned quantities in C (operations involving mixed signed/unsigned are done unsigned, when exactly the opposite is nearly always wanted), even a single error in declaring a quantity unsigned that should be signed, or even the even more subtle error of comparing signed and unsigned values and forgetting the necessary cast, can be catastrophic, as comparisons will yield wrong results. -Wsign-compare is turned on specifically to catch this, but this tends to result in a great number of warnings when mixing signed and unsigned, and the casts are annoying. More has been written on this elsewhere. -- All such quantity types just mentioned boil down to EMACS_INT, which is 32 bits on 32-bit machines and 64 bits on 64-bit machines. This is guaranteed to be the same size as Lisp objects of type `int', and (as far as I can tell) of size_t (unsigned!) and ssize_t. The only type below that is not an EMACS_INT is Hashcode, which is an unsigned value of the same size as EMACS_INT. -- Type names should be relatively short (no more than 10 characters or so), with the first letter capitalized and no underscores if they can at all be avoided. -- "count" == a zero-based measurement of some quantity. Includes sizes, offsets, and indexes. -- "bpos" == a one-based measurement of a position in a buffer. "Charbpos" and "Bytebpos" count text in the buffer, rather than bytes in memory; thus Bytebpos does not directly correspond to the memory representation. Use "Membpos" for this. -- "Char" refers to internal-format characters, not to the C type "char", which is really a byte. -- For the actual name changes, see the script below. I ran the following script to do the conversion. (NOTE: This script is idempotent. You can safely run it multiple times and it will not screw up previous results -- in fact, it will do nothing if nothing has changed. Thus, it can be run repeatedly as necessary to handle patches coming in from old workspaces, or old branches.) There are two tags, just before and just after the change: `pre-integral-type-rename' and `post-integral-type-rename'. When merging code from the main trunk into a branch, the best thing to do is first merge up to `pre-integral-type-rename', then apply the script and associated changes, then merge from `post-integral-type-change' to the present. (Alternatively, just do the merging in one operation; but you may then have a lot of conflicts needing to be resolved by hand.) Script `fixtypes.sh' follows: ----------------------------------- cut ------------------------------------ files="*.[ch] s/*.h m/*.h config.h.in ../configure.in Makefile.in.in ../lib-src/*.[ch] ../lwlib/*.[ch]" gr Memory_Count Bytecount $files gr Lstream_Data_Count Bytecount $files gr Element_Count Elemcount $files gr Hash_Code Hashcode $files gr extcount bytecount $files gr bufpos charbpos $files gr bytind bytebpos $files gr memind membpos $files gr bufbyte intbyte $files gr Extcount Bytecount $files gr Bufpos Charbpos $files gr Bytind Bytebpos $files gr Memind Membpos $files gr Bufbyte Intbyte $files gr EXTCOUNT BYTECOUNT $files gr BUFPOS CHARBPOS $files gr BYTIND BYTEBPOS $files gr MEMIND MEMBPOS $files gr BUFBYTE INTBYTE $files gr MEMORY_COUNT BYTECOUNT $files gr LSTREAM_DATA_COUNT BYTECOUNT $files gr ELEMENT_COUNT ELEMCOUNT $files gr HASH_CODE HASHCODE $files ----------------------------------- cut ------------------------------------ `fixtypes.sh' is a Bourne-shell script; it uses 'gr': ----------------------------------- cut ------------------------------------ #!/bin/sh # Usage is like this: # gr FROM TO FILES ... # globally replace FROM with TO in FILES. FROM and TO are regular expressions. # backup files are stored in the `backup' directory. from="$1" to="$2" shift 2 echo ${1+"$@"} | xargs global-replace "s/$from/$to/g" ----------------------------------- cut ------------------------------------ `gr' in turn uses a Perl script to do its real work, `global-replace', which follows: ----------------------------------- cut ------------------------------------ : #-*- Perl -*- ### global-modify --- modify the contents of a file by a Perl expression ## Copyright (C) 1999 Martin Buchholz. ## Copyright (C) 2001 Ben Wing. ## Authors: Martin Buchholz <martin@xemacs.org>, Ben Wing <ben@xemacs.org> ## Maintainer: Ben Wing <ben@xemacs.org> ## Current Version: 1.0, May 5, 2001 # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with XEmacs; see the file COPYING. If not, write to the Free # Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. eval 'exec perl -w -S $0 ${1+"$@"}' if 0; use strict; use FileHandle; use Carp; use Getopt::Long; use File::Basename; (my $myName = $0) =~ s@.*/@@; my $usage=" Usage: $myName [--help] [--backup-dir=DIR] [--line-mode] [--hunk-mode] PERLEXPR FILE ... Globally modify a file, either line by line or in one big hunk. Typical usage is like this: [with GNU print, GNU xargs: guaranteed to handle spaces, quotes, etc. in file names] find . -name '*.[ch]' -print0 | xargs -0 $0 's/\bCONST\b/const/g'\n [with non-GNU print, xargs] find . -name '*.[ch]' -print | xargs $0 's/\bCONST\b/const/g'\n The file is read in, either line by line (with --line-mode specified) or in one big hunk (with --hunk-mode specified; it's the default), and the Perl expression is then evalled with \$_ set to the line or hunk of text, including the terminating newline if there is one. It should destructively modify the value there, storing the changed result in \$_. Files in which any modifications are made are backed up to the directory specified using --backup-dir, or to `backup' by default. To disable this, use --backup-dir= with no argument. Hunk mode is the default because it is MUCH MUCH faster than line-by-line. Use line-by-line only when it matters, e.g. you want to do a replacement only once per line (the default without the `g' argument). Conversely, when using hunk mode, *ALWAYS* use `g'; otherwise, you will only make one replacement in the entire file! "; my %options = (); $Getopt::Long::ignorecase = 0; &GetOptions ( \%options, 'help', 'backup-dir=s', 'line-mode', 'hunk-mode', ); die $usage if $options{"help"} or @ARGV <= 1; my $code = shift; die $usage if grep (-d || ! -w, @ARGV); sub SafeOpen { open ((my $fh = new FileHandle), $_[0]); confess "Can't open $_[0]: $!" if ! defined $fh; return $fh; } sub SafeClose { close $_[0] or confess "Can't close $_[0]: $!"; } sub FileContents { my $fh = SafeOpen ("< $_[0]"); my $olddollarslash = $/; local $/ = undef; my $contents = <$fh>; $/ = $olddollarslash; return $contents; } sub WriteStringToFile { my $fh = SafeOpen ("> $_[0]"); binmode $fh; print $fh $_[1] or confess "$_[0]: $!\n"; SafeClose $fh; } foreach my $file (@ARGV) { my $changed_p = 0; my $new_contents = ""; if ($options{"line-mode"}) { my $fh = SafeOpen $file; while (<$fh>) { my $save_line = $_; eval $code; $changed_p = 1 if $save_line ne $_; $new_contents .= $_; } } else { my $orig_contents = $_ = FileContents $file; eval $code; if ($_ ne $orig_contents) { $changed_p = 1; $new_contents = $_; } } if ($changed_p) { my $backdir = $options{"backup-dir"}; $backdir = "backup" if !defined ($backdir); if ($backdir) { my ($name, $path, $suffix) = fileparse ($file, ""); my $backfulldir = $path . $backdir; my $backfile = "$backfulldir/$name"; mkdir $backfulldir, 0755 unless -d $backfulldir; print "modifying $file (original saved in $backfile)\n"; rename $file, $backfile; } WriteStringToFile ($file, $new_contents); } } ----------------------------------- cut ------------------------------------ In addition to those programs, I needed to fix up a few other things, particularly relating to the duplicate definitions of types, now that some types merged with others. Specifically: 1. in lisp.h, removed duplicate declarations of Bytecount. The changed code should now look like this: (In each code snippet below, the first and last lines are the same as the original, as are all lines outside of those lines. That allows you to locate the section to be replaced, and replace the stuff in that section, verifying that there isn't anything new added that would need to be kept.) --------------------------------- snip ------------------------------------- /* Counts of bytes or chars */ typedef EMACS_INT Bytecount; typedef EMACS_INT Charcount; /* Counts of elements */ typedef EMACS_INT Elemcount; /* Hash codes */ typedef unsigned long Hashcode; /* ------------------------ dynamic arrays ------------------- */ --------------------------------- snip ------------------------------------- 2. in lstream.h, removed duplicate declaration of Bytecount. Rewrote the comment about this type. The changed code should now look like this: --------------------------------- snip ------------------------------------- #endif /* The have been some arguments over the what the type should be that specifies a count of bytes in a data block to be written out or read in, using Lstream_read(), Lstream_write(), and related functions. Originally it was long, which worked fine; Martin "corrected" these to size_t and ssize_t on the grounds that this is theoretically cleaner and is in keeping with the C standards. Unfortunately, this practice is horribly error-prone due to design flaws in the way that mixed signed/unsigned arithmetic happens. In fact, by doing this change, Martin introduced a subtle but fatal error that caused the operation of sending large mail messages to the SMTP server under Windows to fail. By putting all values back to be signed, avoiding any signed/unsigned mixing, the bug immediately went away. The type then in use was Lstream_Data_Count, so that it be reverted cleanly if a vote came to that. Now it is Bytecount. Some earlier comments about why the type must be signed: This MUST BE SIGNED, since it also is used in functions that return the number of bytes actually read to or written from in an operation, and these functions can return -1 to signal error. Note that the standard Unix read() and write() functions define the count going in as a size_t, which is UNSIGNED, and the count going out as an ssize_t, which is SIGNED. This is a horrible design flaw. Not only is it highly likely to lead to logic errors when a -1 gets interpreted as a large positive number, but operations are bound to fail in all sorts of horrible ways when a number in the upper-half of the size_t range is passed in -- this number is unrepresentable as an ssize_t, so code that checks to see how many bytes are actually written (which is mandatory if you are dealing with certain types of devices) will get completely screwed up. --ben */ typedef enum lstream_buffering --------------------------------- snip ------------------------------------- 3. in dumper.c, there are four places, all inside of switch() statements, where XD_BYTECOUNT appears twice as a case tag. In each case, the two case blocks contain identical code, and you should *REMOVE THE SECOND* and leave the first.
author ben
date Thu, 20 Sep 2001 06:31:11 +0000
parents 183866b06e0b
children 943eaba38521
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1 /* Functions for the X window system.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
2 Copyright (C) 1989, 1992-5, 1997 Free Software Foundation, Inc.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
3 Copyright (C) 1995, 1996 Ben Wing.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
4
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
5 This file is part of XEmacs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
6
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
10 later version.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
11
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
15 for more details.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
16
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
21
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
22 /* Synched up with: Not synched with FSF. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
23
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
24 /* Substantially rewritten for XEmacs. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
25 /* Revamped to use Gdk/Gtk by William Perry */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
26
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
27 #include <config.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
28 #include "lisp.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
29
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
30 #include "console-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
31 #include "ui-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
32 #include "glyphs-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
33 #include "objects-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
34 #include "scrollbar-gtk.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
35
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
36 #include "gtk-xemacs.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
37
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
38 #include "buffer.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
39 #include "events.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
40 #include "extents.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
41 #include "faces.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
42 #include "frame.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
43 #include "window.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
44
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
45 #ifdef HAVE_GNOME
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
46 #include <libgnomeui/libgnomeui.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
47 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
48
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
49 #ifdef HAVE_DRAGNDROP
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
50 #include "dragdrop.h"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
51 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
52
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
53 #define BORDER_WIDTH 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
54 #define INTERNAL_BORDER_WIDTH 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
55
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
56 #define TRANSIENT_DATA_IDENTIFIER "xemacs::transient_for"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
57 #define FRAME_DATA_IDENTIFIER "xemacs::frame"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
58 #define UNMAPPED_DATA_IDENTIFIER "xemacs::initially_unmapped"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
59
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
60 #define STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
61
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
62 #ifdef STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
63 #include <gdk/gdkx.h>
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
64 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
65
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
66 /* Default properties to use when creating frames. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
67 Lisp_Object Vdefault_gtk_frame_plist;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
68
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
69 Lisp_Object Qwindow_id;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
70 Lisp_Object Qdetachable_menubar;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
71 Lisp_Object Qtext_widget;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
72 Lisp_Object Qcontainer_widget;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
73 Lisp_Object Qshell_widget;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
74
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
75 #ifdef STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
76 EXFUN (Fgtk_window_id, 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
77 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
78
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
79 #ifdef HAVE_DRAGNDROP
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
80 enum {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
81 TARGET_TYPE_STRING,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
82 TARGET_TYPE_URI_LIST,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
83 };
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
84
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
85 static GtkTargetEntry dnd_target_table[] = {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
86 { "STRING", 0, TARGET_TYPE_STRING },
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
87 { "text/plain", 0, TARGET_TYPE_STRING },
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
88 { "text/uri-list", 0, TARGET_TYPE_URI_LIST },
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
89 { "_NETSCAPE_URL", 0, TARGET_TYPE_STRING }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
90 };
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
91
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
92 static guint dnd_n_targets = sizeof(dnd_target_table) / sizeof(dnd_target_table[0]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
93
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
94 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
95
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
96
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
97 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
98 /* helper functions */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
99 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
100
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
101 /* Return the Emacs frame-object corresponding to an X window */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
102 struct frame *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
103 gtk_window_to_frame (struct device *d, GdkWindow *wdesc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
104 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
105 Lisp_Object tail, frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
106 struct frame *f;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
107
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
108 /* This function was previously written to accept only a window argument
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
109 (and to loop over all devices looking for a matching window), but
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
110 that is incorrect because window ID's are not unique across displays. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
111
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
112 for (tail = DEVICE_FRAME_LIST (d); CONSP (tail); tail = XCDR (tail))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
113 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
114 frame = XCAR (tail);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
115 if (!FRAMEP (frame))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
116 continue;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
117 f = XFRAME (frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
118 if (FRAME_GTK_P (f) && GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)) == wdesc)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
119 return f;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
120 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
121 return 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
122 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
123
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
124 /* Like gtk_window_to_frame but also compares the window with the widget's
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
125 windows */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
126 struct frame *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
127 gtk_any_window_to_frame (struct device *d, GdkWindow *w)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
128 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
129 do
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
130 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
131 Lisp_Object frmcons;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
132
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
133 DEVICE_FRAME_LOOP (frmcons, d)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
134 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
135 struct frame *fr = XFRAME (XCAR (frmcons));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
136 if ((w == GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (fr))) ||
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
137 (w == GET_GTK_WIDGET_WINDOW (FRAME_GTK_CONTAINER_WIDGET (fr))) ||
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
138 #ifdef HAVE_MENUBARS
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
139 (w == GET_GTK_WIDGET_WINDOW (FRAME_GTK_MENUBAR_WIDGET (fr))) ||
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
140 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
141 (w == GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (fr))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
142 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
143 return (fr);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
144 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
145 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
146 w = gdk_window_get_parent (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
147 } while (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
148
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
149 return (0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
150 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
151
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
152 struct frame *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
153 gtk_any_widget_or_parent_to_frame (struct device *d, GtkWidget *widget)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
154 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
155 return (gtk_any_window_to_frame (d, GET_GTK_WIDGET_WINDOW (widget)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
156 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
157
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
158 struct device *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
159 gtk_any_window_to_device (GdkWindow *w)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
160 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
161 struct device *d = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
162 Lisp_Object devcons, concons;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
163
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
164 DEVICE_LOOP_NO_BREAK (devcons, concons)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
165 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
166 d = XDEVICE (XCAR (devcons));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
167 if (!DEVICE_GTK_P (d)) continue;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
168 if (gtk_any_window_to_frame (d, w))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
169 return (d);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
170 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
171 return (NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
172 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
173
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
174 struct frame *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
175 decode_gtk_frame (Lisp_Object frame)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
176 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
177 if (NILP (frame))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
178 XSETFRAME (frame, selected_frame ());
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
179 CHECK_LIVE_FRAME (frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
180 /* this will also catch dead frames, but putting in the above check
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
181 results in a more useful error */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
182 CHECK_GTK_FRAME (frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
183 return XFRAME (frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
184 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
185
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
186
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
187 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
188 /* window-manager interactions */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
189 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
190 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
191 gtk_frame_iconified_p (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
192 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
193 return (f->iconified);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
194 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
195
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
196
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
197 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
198 /* frame properties */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
199 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
200
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
201 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
202 gtk_frame_property (struct frame *f, Lisp_Object property)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
203 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
204 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
205
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
206 if (EQ (Qleft, property) || EQ (Qtop, property))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
207 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
208 gint x, y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
209 if (!GET_GTK_WIDGET_WINDOW(shell))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
210 return Qzero;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
211 gdk_window_get_deskrelative_origin (GET_GTK_WIDGET_WINDOW (shell), &x, &y);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
212 if (EQ (Qleft, property)) return make_int (x);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
213 if (EQ (Qtop, property)) return make_int (y);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
214 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
215 if (EQ (Qshell_widget, property))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
216 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
217 return (FRAME_GTK_LISP_WIDGETS (f)[0]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
218 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
219 if (EQ (Qcontainer_widget, property))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
220 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
221 return (FRAME_GTK_LISP_WIDGETS (f)[1]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
222 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
223 if (EQ (Qtext_widget, property))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
224 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
225 return (FRAME_GTK_LISP_WIDGETS (f)[2]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
226 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
227 #ifdef STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
228 if (EQ (Qwindow_id, property))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
229 return Fgtk_window_id (make_frame (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
230 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
231
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
232 return Qunbound;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
233 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
234
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
235 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
236 gtk_internal_frame_property_p (struct frame *f, Lisp_Object property)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
237 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
238 return EQ (property, Qleft)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
239 || EQ (property, Qtop)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
240 || EQ (Qshell_widget, property)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
241 || EQ (Qcontainer_widget, property)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
242 || EQ (Qtext_widget, property)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
243 || EQ (property, Qwindow_id)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
244 || STRINGP (property);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
245 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
246
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
247 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
248 gtk_frame_properties (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
249 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
250 Lisp_Object props = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
251 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
252 gint x, y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
253
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
254 props = cons3 (Qshell_widget, FRAME_GTK_LISP_WIDGETS (f)[0], props);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
255 props = cons3 (Qcontainer_widget, FRAME_GTK_LISP_WIDGETS (f)[1], props);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
256 props = cons3 (Qtext_widget, FRAME_GTK_LISP_WIDGETS (f)[2], props);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
257
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
258 #ifdef STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
259 props = cons3 (Qwindow_id, Fgtk_window_id (make_frame (f)), props);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
260 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
261
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
262 if (!GET_GTK_WIDGET_WINDOW (shell))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
263 x = y = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
264 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
265 gdk_window_get_deskrelative_origin (GET_GTK_WIDGET_WINDOW (shell), &x, &y);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
266
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
267 props = cons3 (Qtop, make_int (y), props);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
268 props = cons3 (Qleft, make_int (x), props);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
269
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
270 return props;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
271 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
272
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
273
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
274 /* Functions called only from `gtk_set_frame_properties' to set
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
275 individual properties. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
276
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
277 static void
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
278 gtk_set_frame_text_value (struct frame *f, Intbyte *value,
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
279 void (*func) (gpointer, gchar *),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
280 gpointer arg)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
281 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
282 gchar *the_text = (gchar *) value;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
283
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
284 /* Programmer fuckup or window is not realized yet. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
285 if (!func || !arg) return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
286
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
287 #ifdef MULE
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
288 {
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
289 Intbyte *ptr;
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
290
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
291 /* Optimize for common ASCII case */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
292 for (ptr = value; *ptr; ptr++)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
293 if (!BYTE_ASCII_P (*ptr))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
294 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
295 char *tmp;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
296 C_STRING_TO_EXTERNAL (value, tmp, Qctext);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
297 the_text = tmp;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
298 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
299 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
300 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
301 #endif /* MULE */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
302
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
303 (*func) (arg, (gchar *) the_text);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
304 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
305
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
306 static void
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
307 gtk_set_title_from_intbyte (struct frame *f, Intbyte *name)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
308 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
309 if (GTK_IS_WINDOW (FRAME_GTK_SHELL_WIDGET (f)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
310 gtk_set_frame_text_value (f, name,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
311 (void (*)(gpointer, gchar *))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
312 gtk_window_set_title, FRAME_GTK_SHELL_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
313 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
314
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
315 static void
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
316 gtk_set_icon_name_from_intbyte (struct frame *f, Intbyte *name)
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
317 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
318 gtk_set_frame_text_value (f, name,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
319 (void (*)(gpointer, gchar *))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
320 gdk_window_set_icon_name, FRAME_GTK_SHELL_WIDGET (f)->window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
321 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
322
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
323 /* Set the initial frame size as specified. This function is used
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
324 when the frame's widgets have not yet been realized.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
325 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
326 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
327 gtk_set_initial_frame_size (struct frame *f, int x, int y,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
328 unsigned int w, unsigned int h)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
329 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
330 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
331 GdkGeometry geometry;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
332 GdkWindowHints geometry_mask = 0x00;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
333
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
334 if (GTK_IS_WINDOW (shell))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
335 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
336 /* Deal with the cell size */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
337 default_face_height_and_width (make_frame (f), &geometry.height_inc, &geometry.width_inc);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
338 geometry_mask |= GDK_HINT_RESIZE_INC;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
339
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
340 gtk_window_set_geometry_hints (GTK_WINDOW (shell),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
341 FRAME_GTK_TEXT_WIDGET (f), &geometry, geometry_mask);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
342 gdk_window_set_hints (GET_GTK_WIDGET_WINDOW (shell), x, y, 0, 0, 0, 0, GDK_HINT_POS);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
343 gtk_window_set_policy (GTK_WINDOW (shell), TRUE, TRUE, FALSE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
344 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
345
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
346 FRAME_HEIGHT (f) = h;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
347 FRAME_WIDTH (f) = w;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
348
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
349 change_frame_size (f, h, w, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
350 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
351 GtkRequisition req;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
352
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
353 gtk_widget_size_request (FRAME_GTK_SHELL_WIDGET (f), &req);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
354 gtk_widget_set_usize (FRAME_GTK_SHELL_WIDGET (f), req.width, req.height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
355 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
356 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
357
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
358 /* Report that a frame property of frame S is being set or changed.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
359 If the property is not specially recognized, do nothing.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
360 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
361
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
362 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
363 gtk_set_frame_properties (struct frame *f, Lisp_Object plist)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
364 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
365 gint x, y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
366 gint width = 0, height = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
367 gboolean width_specified_p = FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
368 gboolean height_specified_p = FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
369 gboolean x_position_specified_p = FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
370 gboolean y_position_specified_p = FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
371 Lisp_Object tail;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
372
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
373 for (tail = plist; !NILP (tail); tail = Fcdr (Fcdr (tail)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
374 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
375 Lisp_Object prop = Fcar (tail);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
376 Lisp_Object val = Fcar (Fcdr (tail));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
377
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
378 if (SYMBOLP (prop))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
379 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
380 if (EQ (prop, Qfont))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
381 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
382 /* If the value is not a string we silently ignore it. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
383 if (STRINGP (val))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
384 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
385 Lisp_Object frm, font_spec;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
386
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
387 XSETFRAME (frm, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
388 font_spec = Fget (Fget_face (Qdefault), Qfont, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
389
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
390 Fadd_spec_to_specifier (font_spec, val, frm, Qnil, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
391 update_frame_face_values (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
392 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
393 continue;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
394 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
395 else if (EQ (prop, Qwidth))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
396 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
397 CHECK_INT (val);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
398 width = XINT (val);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
399 width_specified_p = TRUE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
400 continue;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
401 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
402 else if (EQ (prop, Qheight))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
403 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
404 CHECK_INT (val);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
405 height = XINT (val);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
406 height_specified_p = TRUE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
407 continue;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
408 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
409 /* Further kludge the x/y. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
410 else if (EQ (prop, Qx))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
411 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
412 CHECK_INT (val);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
413 x = (gint) XINT (val);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
414 x_position_specified_p = TRUE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
415 continue;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
416 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
417 else if (EQ (prop, Qy))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
418 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
419 CHECK_INT (val);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
420 y = (gint) XINT (val);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
421 y_position_specified_p = TRUE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
422 continue;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
423 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
424 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
425 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
426
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
427 /* Kludge kludge kludge. We need to deal with the size and position
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
428 specially. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
429 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
430 int size_specified_p = width_specified_p || height_specified_p;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
431 int position_specified_p = x_position_specified_p || y_position_specified_p;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
432
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
433 if (!width_specified_p)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
434 width = 80;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
435 if (!height_specified_p)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
436 height = 30;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
437
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
438 /* Kludge kludge kludge kludge. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
439 if (position_specified_p &&
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
440 (!x_position_specified_p || !y_position_specified_p))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
441 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
442 gint dummy;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
443 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
444 gdk_window_get_deskrelative_origin (GET_GTK_WIDGET_WINDOW (shell),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
445 (x_position_specified_p ? &dummy : &x),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
446 (y_position_specified_p ? &dummy : &y));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
447 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
448
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
449 if (!f->init_finished)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
450 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
451 if (size_specified_p || position_specified_p)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
452 gtk_set_initial_frame_size (f, x, y, width, height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
453 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
454 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
455 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
456 if (size_specified_p)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
457 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
458 Lisp_Object frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
459 XSETFRAME (frame, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
460 Fset_frame_size (frame, make_int (width), make_int (height), Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
461 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
462 if (position_specified_p)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
463 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
464 Lisp_Object frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
465 XSETFRAME (frame, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
466 Fset_frame_position (frame, make_int (x), make_int (y));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
467 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
468 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
469 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
470 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
471
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
472
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
473 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
474 /* widget creation */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
475 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
476 /* Figure out what size the shell widget should initially be,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
477 and set it. Should be called after the default font has been
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
478 determined but before the widget has been realized. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
479
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
480 extern Lisp_Object Vgtk_initial_geometry;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
481
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
482 #ifndef HAVE_GNOME
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
483 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
484 get_number (const char **geometry)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
485 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
486 int value = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
487 int mult = 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
488
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
489 if (**geometry == '-'){
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
490 mult = -1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
491 (*geometry)++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
492 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
493 while (**geometry && isdigit (**geometry)){
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
494 value = value * 10 + (**geometry - '0');
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
495 (*geometry)++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
496 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
497 return value * mult;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
498 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
499
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
500 /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
501 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
502
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
503 /**
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
504 * gnome_parse_geometry
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
505 * @geometry: geometry string to be parsed
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
506 * @xpos: X position geometry component
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
507 * @ypos: Y position geometry component
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
508 * @width: pixel width geometry component
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
509 * @height: pixel height geometry component
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
510 *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
511 * Description:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
512 * Parses the geometry string passed in @geometry, and fills
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
513 * @xpos, @ypos, @width, and @height with
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
514 * the corresponding values upon completion of the parse.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
515 * If the parse fails, it should be assumed that @xpos, @ypos, @width,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
516 * and @height contain undefined values.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
517 *
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
518 * Returns:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
519 * %TRUE if the geometry was successfully parsed, %FALSE otherwise.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
520 **/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
521
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
522 static gboolean
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
523 gnome_parse_geometry (const gchar *geometry, gint *xpos,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
524 gint *ypos, gint *width, gint *height)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
525 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
526 int subtract;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
527
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
528 g_return_val_if_fail (xpos != NULL, FALSE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
529 g_return_val_if_fail (ypos != NULL, FALSE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
530 g_return_val_if_fail (width != NULL, FALSE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
531 g_return_val_if_fail (height != NULL, FALSE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
532
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
533 *xpos = *ypos = *width = *height = -1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
534
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
535 if (!geometry)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
536 return FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
537
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
538 if (*geometry == '=')
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
539 geometry++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
540 if (!*geometry)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
541 return FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
542 if (isdigit (*geometry))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
543 *width = get_number (&geometry);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
544 if (!*geometry)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
545 return TRUE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
546 if (*geometry == 'x' || *geometry == 'X'){
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
547 geometry++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
548 *height = get_number (&geometry);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
549 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
550 if (!*geometry)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
551 return 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
552 if (*geometry == '+'){
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
553 subtract = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
554 geometry++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
555 } else if (*geometry == '-'){
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
556 subtract = gdk_screen_width ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
557 geometry++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
558 } else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
559 return FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
560 *xpos = get_number (&geometry);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
561 if (subtract)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
562 *xpos = subtract - *xpos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
563 if (!*geometry)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
564 return TRUE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
565 if (*geometry == '+'){
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
566 subtract = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
567 geometry++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
568 } else if (*geometry == '-'){
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
569 subtract = gdk_screen_height ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
570 geometry++;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
571 } else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
572 return FALSE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
573 *ypos = get_number (&geometry);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
574 if (subtract)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
575 *ypos = subtract - *ypos;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
576 return TRUE;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
577 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
578 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
579
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
580 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
581 gtk_initialize_frame_size (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
582 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
583 gint x = 10, y = 10, w = 80, h = 30;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
584
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
585 if (STRINGP (Vgtk_initial_geometry))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
586 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
587 if (!gnome_parse_geometry (XSTRING_DATA (Vgtk_initial_geometry), &x,&y,&w,&h))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
588 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
589 x = y = 10;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
590 w = 80;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
591 h = 30;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
592 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
593 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
594
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
595 /* set the position of the frame's root window now. When the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
596 frame was created, the position was initialized to (0,0). */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
597 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
598 struct window *win = XWINDOW (f->root_window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
599
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
600 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
601 WINDOW_TOP (win) = FRAME_TOP_BORDER_END (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
602
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
603 if (!NILP (f->minibuffer_window))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
604 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
605 win = XWINDOW (f->minibuffer_window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
606 WINDOW_LEFT (win) = FRAME_LEFT_BORDER_END (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
607 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
608 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
609
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
610 gtk_set_initial_frame_size (f, x, y, w, h);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
611 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
612
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
613 static gboolean
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
614 resize_event_cb (GtkWidget *w, GtkAllocation *allocation, gpointer user_data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
615 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
616 struct frame *f = (struct frame *) user_data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
617
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
618 f->pixwidth = allocation->width;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
619 f->pixheight = allocation->height;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
620
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
621 if (FRAME_GTK_TEXT_WIDGET (f)->window)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
622 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
623 Lisp_Object frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
624 XSETFRAME (frame, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
625 Fredraw_frame (frame, Qt);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
626 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
627
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
628 return (FALSE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
629 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
630
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
631 static gboolean
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
632 delete_event_cb (GtkWidget *w, GdkEvent *ev, gpointer user_data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
633 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
634 struct frame *f = (struct frame *) user_data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
635 Lisp_Object frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
636
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
637 XSETFRAME (frame, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
638 enqueue_misc_user_event (frame, Qeval, list3 (Qdelete_frame, frame, Qt));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
639
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
640 /* See if tickling the event queue helps us with our delays when
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
641 clicking 'close' */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
642 signal_fake_event ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
643
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
644 return (TRUE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
645 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
646
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
647 extern gboolean emacs_shell_event_handler (GtkWidget *wid, GdkEvent *event, gpointer closure);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
648 extern Lisp_Object build_gtk_object (GtkObject *obj);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
649
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
650 #ifndef GNOME_IS_APP
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
651 #define GNOME_IS_APP(x) 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
652 #define gnome_app_set_contents(x,y) 0
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
653 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
654
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
655 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
656 cleanup_deleted_frame (gpointer data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
657 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
658 struct frame *f = (struct frame *) data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
659 Lisp_Object frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
660
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
661 XSETFRAME (frame, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
662 Fdelete_frame (frame, Qt);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
663 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
664
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
665 #ifdef HAVE_DRAGNDROP
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
666 extern void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
667 dragndrop_data_received (GtkWidget *widget,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
668 GdkDragContext *context,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
669 gint x,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
670 gint y,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
671 GtkSelectionData *data,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
672 guint info,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
673 guint time);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
674
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
675 extern gboolean
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
676 dragndrop_dropped (GtkWidget *widget,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
677 GdkDragContext *drag_context,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
678 gint x,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
679 gint y,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
680 guint time,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
681 gpointer user_data);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
682
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
683 Lisp_Object Vcurrent_drag_object;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
684
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
685 #define DRAG_SELECTION_DATA_ERROR "Error converting drag data to external format"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
686 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
687 dragndrop_get_drag (GtkWidget *widget,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
688 GdkDragContext *drag_context,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
689 GtkSelectionData *data,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
690 guint info,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
691 guint time,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
692 gpointer user_data)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
693 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
694 gtk_selection_data_set (data, GDK_SELECTION_TYPE_STRING, 8,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
695 DRAG_SELECTION_DATA_ERROR,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
696 strlen (DRAG_SELECTION_DATA_ERROR));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
697
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
698 switch (info)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
699 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
700 case TARGET_TYPE_STRING:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
701 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
702 Lisp_Object string = Vcurrent_drag_object;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
703
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
704 if (!STRINGP (Vcurrent_drag_object))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
705 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
706 string = Fprin1_to_string (string, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
707 /* Convert to a string */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
708 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
709
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
710 gtk_selection_data_set (data, GDK_SELECTION_TYPE_STRING,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
711 8, XSTRING_DATA (string), XSTRING_LENGTH (string));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
712 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
713 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
714 case TARGET_TYPE_URI_LIST:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
715 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
716 default:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
717 break;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
718 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
719 Vcurrent_drag_object = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
720 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
721
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
722 DEFUN ("gtk-start-drag-internal", Fgtk_start_drag_internal, 2, 3, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
723 Start a GTK drag from a buffer.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
724 First arg is the event that started the drag,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
725 second arg should be some string, and the third
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
726 is the type of the data (this should be a MIME type as a string (ie: text/plain)).
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
727 The type defaults to text/plain.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
728 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
729 (event, data, dtyp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
730 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
731 if (EVENTP(event))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
732 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
733 struct frame *f = decode_gtk_frame (Fselected_frame (Qnil));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
734 GtkWidget *wid = FRAME_GTK_TEXT_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
735 struct Lisp_Event *lisp_event = XEVENT(event);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
736 GdkAtom dnd_typ;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
737 GtkTargetList *tl = gtk_target_list_new (dnd_target_table, dnd_n_targets);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
738
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
739 /* only drag if this is really a press */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
740 if (EVENT_TYPE(lisp_event) != button_press_event)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
741 return Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
742
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
743 /* get the desired type */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
744 if (!NILP (dtyp) && STRINGP (dtyp))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
745 dnd_typ = gdk_atom_intern (XSTRING_DATA (dtyp), FALSE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
746
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
747 gtk_drag_begin (wid, tl, GDK_ACTION_COPY, lisp_event->event.button.button, NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
748
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
749 Vcurrent_drag_object = data;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
750
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
751 gtk_target_list_unref (tl);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
752 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
753 return Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
754 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
755 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
756
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
757 /* Creates the widgets for a frame.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
758 lisp_window_id is a Lisp description of an X window or Xt
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
759 widget to parse.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
760
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
761 This function does not map the windows. (That is
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
762 done by gtk_popup_frame().)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
763 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
764 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
765 gtk_create_widgets (struct frame *f, Lisp_Object lisp_window_id, Lisp_Object parent)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
766 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
767 const char *name;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
768 GtkWidget *text, *container, *shell;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
769 gboolean embedded_p = !NILP (lisp_window_id);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
770 #ifdef HAVE_MENUBARS
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
771 int menubar_visible;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
772 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
773
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
774 if (STRINGP (f->name))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
775 TO_EXTERNAL_FORMAT (LISP_STRING, f->name, C_STRING_ALLOCA, name, Qctext);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
776 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
777 name = "emacs";
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
778
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
779 FRAME_GTK_TOP_LEVEL_FRAME_P (f) = 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
780
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
781 if (embedded_p)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
782 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
783 CHECK_GTK_OBJECT (lisp_window_id);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
784
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
785 if (!GTK_IS_CONTAINER (XGTK_OBJECT (lisp_window_id)->object))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
786 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
787 invalid_argument ("Window ID must be a GtkContainer subclass", lisp_window_id);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
788 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
789
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
790 shell = gtk_vbox_new (FALSE, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
791
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
792 gtk_object_weakref (GTK_OBJECT (shell), cleanup_deleted_frame, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
793 gtk_container_add (GTK_CONTAINER (XGTK_OBJECT (lisp_window_id)->object), shell);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
794 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
795 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
796 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
797 #ifdef HAVE_GNOME
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
798 shell = GTK_WIDGET (gnome_app_new ("XEmacs", "XEmacs/GNOME"));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
799 #else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
800 shell = GTK_WIDGET (gtk_window_new (GTK_WINDOW_TOPLEVEL));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
801 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
802 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
803
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
804 if (!NILP (parent))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
805 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
806 /* If this is a transient window, keep the parent info around */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
807 GtkWidget *parentwid = FRAME_GTK_SHELL_WIDGET (XFRAME (parent));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
808 gtk_object_set_data (GTK_OBJECT (shell), TRANSIENT_DATA_IDENTIFIER, parentwid);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
809 gtk_window_set_transient_for (GTK_WINDOW (shell), GTK_WINDOW (parentwid));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
810 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
811
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
812 gtk_container_set_border_width (GTK_CONTAINER (shell), 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
813
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
814 gtk_object_set_data (GTK_OBJECT (shell), FRAME_DATA_IDENTIFIER, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
815
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
816 FRAME_GTK_SHELL_WIDGET (f) = shell;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
817
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
818 text = GTK_WIDGET (gtk_xemacs_new (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
819
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
820 if (!GNOME_IS_APP (shell))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
821 container = GTK_WIDGET (gtk_vbox_new (FALSE, INTERNAL_BORDER_WIDTH));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
822 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
823 container = shell;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
824
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
825 FRAME_GTK_CONTAINER_WIDGET (f) = container;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
826 FRAME_GTK_TEXT_WIDGET (f) = text;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
827
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
828 #ifdef HAVE_DRAGNDROP
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
829 gtk_drag_dest_set (text, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
830 dnd_target_table, dnd_n_targets,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
831 GDK_ACTION_COPY | GDK_ACTION_LINK | GDK_ACTION_ASK);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
832 gtk_signal_connect (GTK_OBJECT (text), "drag_drop",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
833 GTK_SIGNAL_FUNC (dragndrop_dropped), text);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
834 gtk_signal_connect (GTK_OBJECT (text), "drag_data_received",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
835 GTK_SIGNAL_FUNC (dragndrop_data_received), text);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
836 gtk_signal_connect (GTK_OBJECT (text), "drag_data_get",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
837 GTK_SIGNAL_FUNC (dragndrop_get_drag), NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
838 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
839
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
840 #ifdef HAVE_MENUBARS
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
841 /* Create the initial menubar widget. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
842 menubar_visible = gtk_initialize_frame_menubar (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
843
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
844 if (menubar_visible)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
845 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
846 gtk_widget_show_all (FRAME_GTK_MENUBAR_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
847 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
848 #endif /* HAVE_MENUBARS */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
849
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
850 if (GNOME_IS_APP (shell))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
851 gnome_app_set_contents (GNOME_APP (shell), text);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
852 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
853 /* Now comes the drawing area, which should fill the rest of the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
854 ** frame completely.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
855 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
856 gtk_box_pack_end (GTK_BOX (container), text, TRUE, TRUE, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
857
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
858 /* Connect main event handler */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
859 gtk_signal_connect (GTK_OBJECT (shell), "delete-event", GTK_SIGNAL_FUNC (delete_event_cb), f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
860
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
861 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
862 static char *events_to_frob[] = { "focus-in-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
863 "focus-out-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
864 "enter-notify-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
865 "leave-notify-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
866 "map-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
867 "unmap-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
868 "property-notify-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
869 "selection-clear-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
870 "selection-request-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
871 "selection-notify-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
872 "client-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
873 /* "configure-event", */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
874 "visibility-notify-event",
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
875 NULL };
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
876 int i;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
877
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
878 for (i = 0; events_to_frob[i]; i++)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
879 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
880 gtk_signal_connect (GTK_OBJECT (shell), events_to_frob[i],
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
881 GTK_SIGNAL_FUNC (emacs_shell_event_handler), f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
882 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
883 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
884
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
885 gtk_signal_connect (GTK_OBJECT (shell), "size-allocate", GTK_SIGNAL_FUNC (resize_event_cb), f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
886
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
887 /* This might be safe to call now... */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
888 /* gtk_signal_connect (GTK_OBJECT (shell), "event", GTK_SIGNAL_FUNC (emacs_shell_event_handler), f); */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
889
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
890 /* Let's make sure we get all the events we can */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
891 gtk_widget_set_events (text, GDK_ALL_EVENTS_MASK);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
892
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
893 if (shell != container)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
894 gtk_container_add (GTK_CONTAINER (shell), container);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
895
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
896 gtk_widget_set_name (shell, "XEmacs::shell");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
897 gtk_widget_set_name (container, "XEmacs::container");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
898 gtk_widget_set_name (text, "XEmacs::text");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
899
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
900 FRAME_GTK_LISP_WIDGETS(f)[0] = build_gtk_object (GTK_OBJECT (shell));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
901 FRAME_GTK_LISP_WIDGETS(f)[1] = build_gtk_object (GTK_OBJECT (container));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
902 FRAME_GTK_LISP_WIDGETS(f)[2] = build_gtk_object (GTK_OBJECT (text));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
903
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
904 gtk_widget_realize (shell);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
905 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
906
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
907 /* create the windows for the specified frame and display them.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
908 Note that the widgets have already been created, and any
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
909 necessary geometry calculations have already been done. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
910 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
911 gtk_popup_frame (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
912 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
913 /* */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
914
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
915 if (gtk_object_get_data (GTK_OBJECT (FRAME_GTK_SHELL_WIDGET (f)), UNMAPPED_DATA_IDENTIFIER))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
916 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
917 FRAME_GTK_TOTALLY_VISIBLE_P (f) = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
918 f->visible = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
919 gtk_widget_realize (FRAME_GTK_SHELL_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
920 gtk_widget_realize (FRAME_GTK_TEXT_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
921 gtk_widget_hide_all (FRAME_GTK_SHELL_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
922 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
923 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
924 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
925 gtk_widget_show_all (FRAME_GTK_SHELL_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
926 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
927 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
928
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
929 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
930 allocate_gtk_frame_struct (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
931 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
932 /* zero out all slots. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
933 f->frame_data = xnew_and_zero (struct gtk_frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
934
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
935 /* yeah, except the lisp ones */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
936 FRAME_GTK_ICON_PIXMAP (f) = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
937 FRAME_GTK_ICON_PIXMAP_MASK (f) = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
938 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
939
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
940
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
941 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
942 /* Lisp functions */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
943 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
944
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
945 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
946 gtk_init_frame_1 (struct frame *f, Lisp_Object props)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
947 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
948 /* This function can GC */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
949 Lisp_Object initially_unmapped;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
950 Lisp_Object device = FRAME_DEVICE (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
951 Lisp_Object lisp_window_id = Fplist_get (props, Qwindow_id, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
952 Lisp_Object popup = Fplist_get (props, Qpopup, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
953
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
954 if (!NILP (popup))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
955 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
956 if (EQ (popup, Qt))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
957 popup = Fselected_frame (device);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
958 CHECK_LIVE_FRAME (popup);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
959 if (!EQ (device, FRAME_DEVICE (XFRAME (popup))))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
960 invalid_argument_2 ("Parent must be on same device as frame",
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
961 device, popup);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
962 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
963
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
964 initially_unmapped = Fplist_get (props, Qinitially_unmapped, Qnil);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
965
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
966 /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
967 * Previously we set this only if NILP (DEVICE_SELECTED_FRAME (d))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
968 * to make sure that messages were displayed as soon as possible
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
969 * if we're creating the first frame on a device. But it is
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
970 * better to just set this all the time, so that when a new frame
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
971 * is created that covers the selected frame, echo area status
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
972 * messages can still be seen. f->visible is reset later if the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
973 * initially-unmapped property is found to be non-nil in the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
974 * frame properties.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
975 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
976 f->visible = 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
977
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
978 allocate_gtk_frame_struct (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
979 gtk_create_widgets (f, lisp_window_id, popup);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
980
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
981 if (!NILP (initially_unmapped))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
982 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
983 gtk_object_set_data (GTK_OBJECT (FRAME_GTK_SHELL_WIDGET (f)),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
984 UNMAPPED_DATA_IDENTIFIER, (gpointer) 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
985 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
986 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
987
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
988 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
989 gtk_init_frame_2 (struct frame *f, Lisp_Object props)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
990 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
991 /* Set up the values of the widget/frame. A case could be made for putting
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
992 this inside of the widget's initialize method. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
993
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
994 update_frame_face_values (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
995 gtk_initialize_frame_size (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
996 /* Kyle:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
997 * update_frame_title() can't be done here, because some of the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
998 * modeline specs depend on the frame's device having a selected
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
999 * frame, and that may not have been set up yet. The redisplay
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1000 * will update the frame title anyway, so nothing is lost.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1001 * JV:
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1002 * It turns out it gives problems with FVWMs name based mapping.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1003 * We'll just need to be carefull in the modeline specs.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1004 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1005 update_frame_title (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1006 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1007
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1008 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1009 gtk_init_frame_3 (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1010 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1011 /* Pop up the frame. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1012 gtk_popup_frame (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1013 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1014
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1015 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1016 gtk_mark_frame (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1017 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1018 mark_object (FRAME_GTK_ICON_PIXMAP (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1019 mark_object (FRAME_GTK_ICON_PIXMAP_MASK (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1020 mark_object (FRAME_GTK_LISP_WIDGETS (f)[0]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1021 mark_object (FRAME_GTK_LISP_WIDGETS (f)[1]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1022 mark_object (FRAME_GTK_LISP_WIDGETS (f)[2]);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1023 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1024
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1025 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1026 gtk_set_frame_icon (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1027 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1028 GdkPixmap *gtk_pixmap = NULL, *gtk_mask = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1029
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1030 if (IMAGE_INSTANCEP (f->icon)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1031 && IMAGE_INSTANCE_PIXMAP_TYPE_P (XIMAGE_INSTANCE (f->icon)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1032 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1033 gtk_pixmap = XIMAGE_INSTANCE_GTK_PIXMAP (f->icon);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1034 gtk_mask = XIMAGE_INSTANCE_GTK_MASK (f->icon);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1035 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1036 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1037 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1038 gtk_pixmap = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1039 gtk_mask = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1040 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1041
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1042 gdk_window_set_icon (GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f)), NULL, gtk_pixmap, gtk_mask);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1043 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1044
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1045 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1046 gtk_set_frame_pointer (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1047 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1048 GtkWidget *w = FRAME_GTK_TEXT_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1049 GdkCursor *c = XIMAGE_INSTANCE_GTK_CURSOR (f->pointer);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1050
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1051 if (POINTER_IMAGE_INSTANCEP (f->pointer))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1052 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1053 gdk_window_set_cursor (GET_GTK_WIDGET_WINDOW (w), c);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1054 gdk_flush ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1055 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1056 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1057 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1058 /* abort()? */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1059 stderr_out ("POINTER_IMAGE_INSTANCEP (f->pointer) failed!\n");
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1060 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1061 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1062
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1063 static Lisp_Object
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1064 gtk_get_frame_parent (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1065 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1066 GtkWidget *parentwid = gtk_object_get_data (GTK_OBJECT (FRAME_GTK_SHELL_WIDGET (f)),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1067 TRANSIENT_DATA_IDENTIFIER);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1068
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1069 /* find the frame whose wid is parentwid */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1070 if (parentwid)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1071 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1072 Lisp_Object frmcons;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1073 DEVICE_FRAME_LOOP (frmcons, XDEVICE (FRAME_DEVICE (f)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1074 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1075 Lisp_Object frame = XCAR (frmcons);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1076 if (FRAME_GTK_SHELL_WIDGET (XFRAME (frame)) == parentwid)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1077 return frame;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1078 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1079 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1080 return Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1081 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1082
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1083 #ifdef STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1084 DEFUN ("gtk-window-id", Fgtk_window_id, 0, 1, 0, /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1085 Get the ID of the Gtk window.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1086 This gives us a chance to manipulate the Emacs window from within a
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1087 different program. Since the ID is an unsigned long, we return it as
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1088 a string.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1089 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1090 (frame))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1091 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1092 char str[255];
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1093 struct frame *f = decode_gtk_frame (frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1094
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1095 /* Arrrrggghhh... this defeats the whole purpose of using Gdk... do we really need this? */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1096 sprintf (str, "%lu", GDK_WINDOW_XWINDOW( GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f))));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1097 return build_string (str);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1098 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1099 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1100
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1101
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1102 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1103 /* manipulating the X window */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1104 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1105
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1106 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1107 gtk_set_frame_position (struct frame *f, int xoff, int yoff)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1108 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1109 gtk_widget_set_uposition (FRAME_GTK_SHELL_WIDGET (f), xoff, yoff);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1110 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1111
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1112 /* Call this to change the size of frame S's x-window. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1113
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1114 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1115 gtk_set_frame_size (struct frame *f, int cols, int rows)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1116 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1117 GtkWidget *shell = FRAME_GTK_SHELL_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1118 GdkGeometry geometry;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1119 GdkWindowHints geometry_mask = 0x00;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1120
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1121 if (GTK_IS_WINDOW (shell))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1122 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1123 /* Update the cell size */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1124 default_face_height_and_width (make_frame (f), &geometry.height_inc, &geometry.width_inc);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1125 geometry_mask |= GDK_HINT_RESIZE_INC;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1126
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1127 gtk_window_set_geometry_hints (GTK_WINDOW (shell),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1128 FRAME_GTK_TEXT_WIDGET (f), &geometry, geometry_mask);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1129 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1130
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1131 change_frame_size (f, rows, cols, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1132
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1133 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1134 GtkRequisition req;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1135
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1136 gtk_widget_size_request (FRAME_GTK_SHELL_WIDGET (f), &req);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1137 gtk_widget_set_usize (FRAME_GTK_SHELL_WIDGET (f), req.width, req.height);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1138 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1139 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1140
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1141 #ifdef STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1142 /* There is NO equivalent to XWarpPointer under Gtk */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1143 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1144 gtk_set_mouse_position (struct window *w, int x, int y)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1145 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1146 struct frame *f = XFRAME (w->frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1147 Display *display = GDK_DISPLAY ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1148 XWarpPointer (display, None,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1149 GDK_WINDOW_XWINDOW (GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f))),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1150 0, 0, 0, 0, w->pixel_left + x, w->pixel_top + y);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1151 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1152 #endif /* STUPID_X_SPECIFIC_GTK_STUFF */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1153
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1154 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1155 gtk_get_mouse_position (struct device *d, Lisp_Object *frame, int *x, int *y)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1156 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1157 /* Returns the pixel position within the editor text widget */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1158 gint win_x, win_y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1159 GdkWindow *w = gdk_window_at_pointer (&win_x, &win_y);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1160 struct frame *f = NULL;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1161
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1162 if (!w) return (0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1163
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1164 /* At this point, w is the innermost GdkWindow containing the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1165 ** pointer and win_x and win_y are the coordinates of that window.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1166 */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1167 f = gtk_any_window_to_frame (d, w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1168
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1169 if (!f) return (0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1170
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1171 XSETFRAME (*frame, f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1172
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1173 gdk_window_get_pointer (GET_GTK_WIDGET_WINDOW (FRAME_GTK_TEXT_WIDGET (f)),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1174 &win_x, &win_y, NULL);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1175
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1176 *x = win_x;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1177 *y = win_y;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1178
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1179 return (1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1180 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1181
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1182 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1183 gtk_cant_notify_wm_error (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1184 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
1185 signal_error (Qgui_error, "Can't notify window manager of iconification", Qunbound);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1186 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1187
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1188 /* Raise frame F. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1189 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1190 gtk_raise_frame_1 (struct frame *f, int force)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1191 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1192 if (FRAME_VISIBLE_P (f) || force)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1193 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1194 GdkWindow *emacs_window = GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1195
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1196 gdk_window_raise (emacs_window);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1197 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1198 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1199
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1200 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1201 gtk_raise_frame (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1202 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1203 gtk_raise_frame_1 (f, 1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1204 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1205
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1206 /* Lower frame F. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1207 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1208 gtk_lower_frame (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1209 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1210 if (FRAME_VISIBLE_P (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1211 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1212 gdk_window_lower (GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f)));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1213 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1214 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1215
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1216 /* Change from withdrawn state to mapped state. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1217 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1218 gtk_make_frame_visible (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1219 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1220 gtk_widget_show_all (FRAME_GTK_SHELL_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1221 gtk_raise_frame_1 (f, 0);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1222 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1223
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1224 /* Change from mapped state to withdrawn state. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1225 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1226 gtk_make_frame_invisible (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1227 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1228 gtk_widget_hide (FRAME_GTK_SHELL_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1229 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1230
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1231 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1232 gtk_frame_visible_p (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1233 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1234 GtkWidget *w = FRAME_GTK_SHELL_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1235
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1236 f->visible = (GTK_OBJECT_FLAGS (w) & GTK_VISIBLE);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1237
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1238 return f->visible;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1239 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1240
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1241 static int
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1242 gtk_frame_totally_visible_p (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1243 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1244 return FRAME_GTK_TOTALLY_VISIBLE_P (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1245 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1246
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1247 /* Change window state from mapped to iconified. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1248 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1249 gtk_iconify_frame (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1250 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1251 GdkWindow *w = GET_GTK_WIDGET_WINDOW (FRAME_GTK_SHELL_WIDGET (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1252
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1253 /* There is no equivalent to XIconifyWindow in Gtk/Gdk. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1254 if (!XIconifyWindow (GDK_WINDOW_XDISPLAY (w),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1255 GDK_WINDOW_XWINDOW (w),
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1256 DefaultScreen (GDK_WINDOW_XDISPLAY (w))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1257 gtk_cant_notify_wm_error ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1258
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1259 f->iconified = 1;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1260 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1261
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1262 /* Sets the X focus to frame f. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1263 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1264 gtk_focus_on_frame (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1265 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1266 GtkWidget *shell_widget;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1267
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1268 assert (FRAME_GTK_P (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1269
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1270 shell_widget = FRAME_GTK_SHELL_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1271 if (!GET_GTK_WIDGET_WINDOW (shell_widget))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1272 return;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1273
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1274 gtk_widget_grab_focus (shell_widget);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1275 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1276
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1277 /* Destroy the window of frame S. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1278 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1279 gtk_delete_frame (struct frame *f)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1280 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1281 GtkWidget *w = FRAME_GTK_SHELL_WIDGET (f);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1282
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1283 gtk_widget_destroy (w);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1284
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1285 if (FRAME_GTK_GEOM_FREE_ME_PLEASE (f))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1286 xfree (FRAME_GTK_GEOM_FREE_ME_PLEASE (f));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1287 xfree (f->frame_data);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1288 f->frame_data = 0;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1289 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1290
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1291 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1292 gtk_recompute_cell_sizes (struct frame *frm)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1293 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1294 if (GTK_IS_WINDOW (FRAME_GTK_SHELL_WIDGET (frm)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1295 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1296 GtkWindow *w = GTK_WINDOW (FRAME_GTK_SHELL_WIDGET (frm));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1297 GdkGeometry geometry;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1298 GdkWindowHints geometry_mask;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1299 gint width_inc = 10;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1300 gint height_inc = 10;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1301
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1302 default_face_height_and_width (make_frame (frm), &height_inc, &width_inc);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1303 geometry_mask = GDK_HINT_RESIZE_INC;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1304 geometry.width_inc = width_inc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1305 geometry.height_inc = height_inc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1306
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1307 gtk_window_set_geometry_hints (w, FRAME_GTK_TEXT_WIDGET (frm), &geometry, geometry_mask);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1308 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1309 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1310
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1311 static void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1312 gtk_update_frame_external_traits (struct frame* frm, Lisp_Object name)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1313 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1314 Lisp_Object frame = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1315
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1316 XSETFRAME(frame, frm);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1317
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1318 if (EQ (name, Qforeground))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1319 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1320 Lisp_Object color = FACE_FOREGROUND (Vdefault_face, frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1321 GdkColor *fgc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1322
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1323 if (!EQ (color, Vthe_null_color_instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1324 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1325 fgc = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (color));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1326 /* #### BILL!!! The X code set the XtNforeground property of
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1327 the text widget here. Why did they bother? All that type
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1328 of thing is done down in the guts of the redisplay code,
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1329 not in the Emacs* widgets. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1330 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1331 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1332 else if (EQ (name, Qbackground))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1333 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1334 Lisp_Object color = FACE_BACKGROUND (Vdefault_face, frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1335 GdkColor *bgc;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1336
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1337 if (!EQ (color, Vthe_null_color_instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1338 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1339 bgc = COLOR_INSTANCE_GTK_COLOR (XCOLOR_INSTANCE (color));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1340 if (FRAME_GTK_SHELL_WIDGET (frm)->window)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1341 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1342 gdk_window_set_background (FRAME_GTK_SHELL_WIDGET (frm)->window, bgc);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1343 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1344 if (FRAME_GTK_TEXT_WIDGET (frm)->window)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1345 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1346 gdk_window_set_background (FRAME_GTK_TEXT_WIDGET (frm)->window, bgc);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1347 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1348 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1349
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1350 /* Really crappy way to force the modeline shadows to be
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1351 redrawn. But effective. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1352 MARK_FRAME_WINDOWS_STRUCTURE_CHANGED (frm);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1353 MARK_FRAME_CHANGED (frm);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1354 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1355 else if (EQ (name, Qfont))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1356 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1357 Lisp_Object font = FACE_FONT (Vdefault_face, frame, Vcharset_ascii);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1358
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1359 if (!EQ (font, Vthe_null_font_instance))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1360 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1361 /* #### BILL!!! The X code set the XtNfont property of the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1362 text widget here. Why did they bother? All that type of
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1363 thing is done down in the guts of the redisplay code, not
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1364 in the Emacs* widgets. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1365 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1366 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1367 else
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1368 abort ();
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1369
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1370 #ifdef HAVE_TOOLBARS
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1371 /* Setting the background clears the entire frame area
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1372 including the toolbar so we force an immediate redraw of
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1373 it. */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1374 if (EQ (name, Qbackground))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1375 MAYBE_DEVMETH (XDEVICE (frm->device), redraw_frame_toolbars, (frm));
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1376 #endif /* HAVE_TOOLBARS */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1377
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1378 /* Set window manager resize increment hints according to
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1379 the new character size */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1380 if (EQ (name, Qfont) && FRAME_GTK_TOP_LEVEL_FRAME_P (frm))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1381 gtk_recompute_cell_sizes (frm);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1382 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1383
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1384
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1385 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1386 /* initialization */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1387 /************************************************************************/
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1388
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1389 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1390 syms_of_frame_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1391 {
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
1392 DEFSYMBOL (Qwindow_id);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
1393 DEFSYMBOL (Qtext_widget);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
1394 DEFSYMBOL (Qcontainer_widget);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
1395 DEFSYMBOL (Qshell_widget);
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 462
diff changeset
1396 DEFSYMBOL (Qdetachable_menubar);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1397
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1398 #ifdef HAVE_DRAGNDROP
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1399 staticpro (&Vcurrent_drag_object);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1400 Vcurrent_drag_object = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1401 DEFSUBR (Fgtk_start_drag_internal);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1402 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1403 #ifdef STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1404 DEFSUBR (Fgtk_window_id);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1405 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1406 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1407
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1408 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1409 console_type_create_frame_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1410 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1411 /* frame methods */
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1412 CONSOLE_HAS_METHOD (gtk, init_frame_1);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1413 CONSOLE_HAS_METHOD (gtk, init_frame_2);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1414 CONSOLE_HAS_METHOD (gtk, init_frame_3);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1415 CONSOLE_HAS_METHOD (gtk, mark_frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1416 CONSOLE_HAS_METHOD (gtk, focus_on_frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1417 CONSOLE_HAS_METHOD (gtk, delete_frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1418 CONSOLE_HAS_METHOD (gtk, get_mouse_position);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1419 #ifdef STUPID_X_SPECIFIC_GTK_STUFF
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1420 CONSOLE_HAS_METHOD (gtk, set_mouse_position);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1421 #endif
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1422 CONSOLE_HAS_METHOD (gtk, raise_frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1423 CONSOLE_HAS_METHOD (gtk, lower_frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1424 CONSOLE_HAS_METHOD (gtk, make_frame_visible);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1425 CONSOLE_HAS_METHOD (gtk, make_frame_invisible);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1426 CONSOLE_HAS_METHOD (gtk, iconify_frame);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1427 CONSOLE_HAS_METHOD (gtk, set_frame_size);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1428 CONSOLE_HAS_METHOD (gtk, set_frame_position);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1429 CONSOLE_HAS_METHOD (gtk, frame_property);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1430 CONSOLE_HAS_METHOD (gtk, internal_frame_property_p);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1431 CONSOLE_HAS_METHOD (gtk, frame_properties);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1432 CONSOLE_HAS_METHOD (gtk, set_frame_properties);
665
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
1433 CONSOLE_HAS_METHOD (gtk, set_title_from_intbyte);
fdefd0186b75 [xemacs-hg @ 2001-09-20 06:28:42 by ben]
ben
parents: 563
diff changeset
1434 CONSOLE_HAS_METHOD (gtk, set_icon_name_from_intbyte);
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1435 CONSOLE_HAS_METHOD (gtk, frame_visible_p);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1436 CONSOLE_HAS_METHOD (gtk, frame_totally_visible_p);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1437 CONSOLE_HAS_METHOD (gtk, frame_iconified_p);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1438 CONSOLE_HAS_METHOD (gtk, set_frame_pointer);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1439 CONSOLE_HAS_METHOD (gtk, set_frame_icon);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1440 CONSOLE_HAS_METHOD (gtk, get_frame_parent);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1441 CONSOLE_HAS_METHOD (gtk, update_frame_external_traits);
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1442 }
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1443
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1444 void
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1445 vars_of_frame_gtk (void)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1446 {
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1447 DEFVAR_LISP ("default-gtk-frame-plist", &Vdefault_gtk_frame_plist /*
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1448 Plist of default frame-creation properties for Gtk frames.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1449 These override what is specified in the resource database and in
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1450 `default-frame-plist', but are overridden by the arguments to the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1451 particular call to `make-frame'.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1452
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1453 Note: In many cases, properties of a frame are available as specifiers
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1454 instead of through the frame-properties mechanism.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1455
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1456 Here is a list of recognized frame properties, other than those
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1457 documented in `set-frame-properties' (they can be queried and
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1458 set at any time, except as otherwise noted):
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1459
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1460 initially-unmapped If non-nil, the frame will not be visible
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1461 when it is created. In this case, you
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1462 need to call `make-frame-visible' to make
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1463 the frame appear.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1464 popup If non-nil, it should be a frame, and this
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1465 frame will be created as a "popup" frame
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1466 whose parent is the given frame. This
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1467 will make the window manager treat the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1468 frame as a dialog box, which may entail
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1469 doing different things (e.g. not asking
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1470 for positioning, and not iconifying
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1471 separate from its parent).
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1472 inter-line-space Not currently implemented.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1473 toolbar-shadow-thickness Thickness of toolbar shadows.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1474 background-toolbar-color Color of toolbar background.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1475 bottom-toolbar-shadow-color Color of bottom shadows on toolbars.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1476 (*Not* specific to the bottom-toolbar.)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1477 top-toolbar-shadow-color Color of top shadows on toolbars.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1478 (*Not* specific to the top-toolbar.)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1479 internal-border-width Width of internal border around text area.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1480 border-width Width of external border around text area.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1481 top Y position (in pixels) of the upper-left
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1482 outermost corner of the frame (i.e. the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1483 upper-left of the window-manager
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1484 decorations).
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1485 left X position (in pixels) of the upper-left
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1486 outermost corner of the frame (i.e. the
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1487 upper-left of the window-manager
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1488 decorations).
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1489 border-color Color of external border around text area.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1490 cursor-color Color of text cursor.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1491
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1492 See also `default-frame-plist', which specifies properties which apply
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1493 to all frames, not just Gtk frames.
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1494 */ );
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1495 Vdefault_gtk_frame_plist = Qnil;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1496
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1497 gtk_console_methods->device_specific_frame_props = &Vdefault_gtk_frame_plist;
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents:
diff changeset
1498 }