Implemented Sdl2GLControl
SDL2 still fails with "not an OpenGL window".
This commit is contained in:
parent
5bb23585b9
commit
b57e58dc47
31 changed files with 929 additions and 185 deletions
13
Dependencies/SDL2.COPYING.txt
vendored
Normal file
13
Dependencies/SDL2.COPYING.txt
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
|
||||||
|
Please distribute this file with the SDL runtime environment:
|
||||||
|
|
||||||
|
The Simple DirectMedia Layer (SDL for short) is a cross-platform library
|
||||||
|
designed to make it easy to write multi-media software, such as games and
|
||||||
|
emulators.
|
||||||
|
|
||||||
|
The Simple DirectMedia Layer library source code is available from:
|
||||||
|
http://www.libsdl.org/
|
||||||
|
|
||||||
|
This library is distributed under the terms of the zlib license:
|
||||||
|
http://www.zlib.net/zlib_license.html
|
||||||
|
|
484
Dependencies/openal.COPYING.txt
vendored
Normal file
484
Dependencies/openal.COPYING.txt
vendored
Normal file
|
@ -0,0 +1,484 @@
|
||||||
|
|
||||||
|
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
|
||||||
|
Copyright (C) 1991 Free Software Foundation, Inc.
|
||||||
|
675 Mass Ave, Cambridge, MA 02139, USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
[This is the first released version of the library GPL. It is
|
||||||
|
numbered 2 because it goes with version 2 of the ordinary GPL.]
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
Licenses are intended to guarantee your freedom to share and change
|
||||||
|
free software--to make sure the software is free for all its users.
|
||||||
|
|
||||||
|
This license, the Library General Public License, applies to some
|
||||||
|
specially designated Free Software Foundation software, and to any
|
||||||
|
other libraries whose authors decide to use it. You can use it for
|
||||||
|
your libraries, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
this service if you wish), that you receive source code or can get it
|
||||||
|
if you want it, that you can change the software or use pieces of it
|
||||||
|
in new free programs; and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if
|
||||||
|
you distribute copies of the library, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of the library, whether gratis
|
||||||
|
or for a fee, you must give the recipients all the rights that we gave
|
||||||
|
you. You must make sure that they, too, receive or can get the source
|
||||||
|
code. If you link a program with the library, you must provide
|
||||||
|
complete object files to the recipients so that they can relink them
|
||||||
|
with the library, after making changes to the library and recompiling
|
||||||
|
it. And you must show them these terms so they know their rights.
|
||||||
|
|
||||||
|
Our method of protecting your rights has two steps: (1) copyright
|
||||||
|
the library, and (2) offer you this license which gives you legal
|
||||||
|
permission to copy, distribute and/or modify the library.
|
||||||
|
|
||||||
|
Also, for each distributor's protection, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
library. If the library is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original
|
||||||
|
version, so that any problems introduced by others will not reflect on
|
||||||
|
the original authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that companies distributing free
|
||||||
|
software will individually obtain patent licenses, thus in effect
|
||||||
|
transforming the program into proprietary software. To prevent this,
|
||||||
|
we have made it clear that any patent must be licensed for everyone's
|
||||||
|
free use or not licensed at all.
|
||||||
|
|
||||||
|
Most GNU software, including some libraries, is covered by the ordinary
|
||||||
|
GNU General Public License, which was designed for utility programs. This
|
||||||
|
license, the GNU Library General Public License, applies to certain
|
||||||
|
designated libraries. This license is quite different from the ordinary
|
||||||
|
one; be sure to read it in full, and don't assume that anything in it is
|
||||||
|
the same as in the ordinary license.
|
||||||
|
|
||||||
|
The reason we have a separate public license for some libraries is that
|
||||||
|
they blur the distinction we usually make between modifying or adding to a
|
||||||
|
program and simply using it. Linking a program with a library, without
|
||||||
|
changing the library, is in some sense simply using the library, and is
|
||||||
|
analogous to running a utility program or application program. However, in
|
||||||
|
a textual and legal sense, the linked executable is a combined work, a
|
||||||
|
derivative of the original library, and the ordinary General Public License
|
||||||
|
treats it as such.
|
||||||
|
|
||||||
|
Because of this blurred distinction, using the ordinary General
|
||||||
|
Public License for libraries did not effectively promote software
|
||||||
|
sharing, because most developers did not use the libraries. We
|
||||||
|
concluded that weaker conditions might promote sharing better.
|
||||||
|
|
||||||
|
However, unrestricted linking of non-free programs would deprive the
|
||||||
|
users of those programs of all benefit from the free status of the
|
||||||
|
libraries themselves. This Library General Public License is intended to
|
||||||
|
permit developers of non-free programs to use free libraries, while
|
||||||
|
preserving your freedom as a user of such programs to change the free
|
||||||
|
libraries that are incorporated in them. (We have not seen how to achieve
|
||||||
|
this as regards changes in header files, but we have achieved it as regards
|
||||||
|
changes in the actual functions of the Library.) The hope is that this
|
||||||
|
will lead to faster development of free libraries.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow. Pay close attention to the difference between a
|
||||||
|
"work based on the library" and a "work that uses the library". The
|
||||||
|
former contains code derived from the library, while the latter only
|
||||||
|
works together with the library.
|
||||||
|
|
||||||
|
Note that it is possible for a library to be covered by the ordinary
|
||||||
|
General Public License rather than by this special one.
|
||||||
|
|
||||||
|
GNU LIBRARY GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License Agreement applies to any software library which
|
||||||
|
contains a notice placed by the copyright holder or other authorized
|
||||||
|
party saying it may be distributed under the terms of this Library
|
||||||
|
General Public License (also called "this License"). Each licensee is
|
||||||
|
addressed as "you".
|
||||||
|
|
||||||
|
A "library" means a collection of software functions and/or data
|
||||||
|
prepared so as to be conveniently linked with application programs
|
||||||
|
(which use some of those functions and data) to form executables.
|
||||||
|
|
||||||
|
The "Library", below, refers to any such software library or work
|
||||||
|
which has been distributed under these terms. A "work based on the
|
||||||
|
Library" means either the Library or any derivative work under
|
||||||
|
copyright law: that is to say, a work containing the Library or a
|
||||||
|
portion of it, either verbatim or with modifications and/or translated
|
||||||
|
straightforwardly into another language. (Hereinafter, translation is
|
||||||
|
included without limitation in the term "modification".)
|
||||||
|
|
||||||
|
"Source code" for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For a library, complete source code means
|
||||||
|
all the source code for all modules it contains, plus any associated
|
||||||
|
interface definition files, plus the scripts used to control compilation
|
||||||
|
and installation of the library.
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running a program using the Library is not restricted, and output from
|
||||||
|
such a program is covered only if its contents constitute a work based
|
||||||
|
on the Library (independent of the use of the Library in a tool for
|
||||||
|
writing it). Whether that is true depends on what the Library does
|
||||||
|
and what the program that uses the Library does.
|
||||||
|
|
||||||
|
1. You may copy and distribute verbatim copies of the Library's
|
||||||
|
complete source code as you receive it, in any medium, provided that
|
||||||
|
you conspicuously and appropriately publish on each copy an
|
||||||
|
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||||
|
all the notices that refer to this License and to the absence of any
|
||||||
|
warranty; and distribute a copy of this License along with the
|
||||||
|
Library.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy,
|
||||||
|
and you may at your option offer warranty protection in exchange for a
|
||||||
|
fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Library or any portion
|
||||||
|
of it, thus forming a work based on the Library, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The modified work must itself be a software library.
|
||||||
|
|
||||||
|
b) You must cause the files modified to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
c) You must cause the whole of the work to be licensed at no
|
||||||
|
charge to all third parties under the terms of this License.
|
||||||
|
|
||||||
|
d) If a facility in the modified Library refers to a function or a
|
||||||
|
table of data to be supplied by an application program that uses
|
||||||
|
the facility, other than as an argument passed when the facility
|
||||||
|
is invoked, then you must make a good faith effort to ensure that,
|
||||||
|
in the event an application does not supply such function or
|
||||||
|
table, the facility still operates, and performs whatever part of
|
||||||
|
its purpose remains meaningful.
|
||||||
|
|
||||||
|
(For example, a function in a library to compute square roots has
|
||||||
|
a purpose that is entirely well-defined independent of the
|
||||||
|
application. Therefore, Subsection 2d requires that any
|
||||||
|
application-supplied function or table used by this function must
|
||||||
|
be optional: if the application does not supply it, the square
|
||||||
|
root function must still compute square roots.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Library,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Library, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote
|
||||||
|
it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Library.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Library
|
||||||
|
with the Library (or with a work based on the Library) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||||
|
License instead of this License to a given copy of the Library. To do
|
||||||
|
this, you must alter all the notices that refer to this License, so
|
||||||
|
that they refer to the ordinary GNU General Public License, version 2,
|
||||||
|
instead of to this License. (If a newer version than version 2 of the
|
||||||
|
ordinary GNU General Public License has appeared, then you can specify
|
||||||
|
that version instead if you wish.) Do not make any other change in
|
||||||
|
these notices.
|
||||||
|
|
||||||
|
Once this change is made in a given copy, it is irreversible for
|
||||||
|
that copy, so the ordinary GNU General Public License applies to all
|
||||||
|
subsequent copies and derivative works made from that copy.
|
||||||
|
|
||||||
|
This option is useful when you wish to copy part of the code of
|
||||||
|
the Library into a program that is not a library.
|
||||||
|
|
||||||
|
4. You may copy and distribute the Library (or a portion or
|
||||||
|
derivative of it, under Section 2) in object code or executable form
|
||||||
|
under the terms of Sections 1 and 2 above provided that you accompany
|
||||||
|
it with the complete corresponding machine-readable source code, which
|
||||||
|
must be distributed under the terms of Sections 1 and 2 above on a
|
||||||
|
medium customarily used for software interchange.
|
||||||
|
|
||||||
|
If distribution of object code is made by offering access to copy
|
||||||
|
from a designated place, then offering equivalent access to copy the
|
||||||
|
source code from the same place satisfies the requirement to
|
||||||
|
distribute the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
5. A program that contains no derivative of any portion of the
|
||||||
|
Library, but is designed to work with the Library by being compiled or
|
||||||
|
linked with it, is called a "work that uses the Library". Such a
|
||||||
|
work, in isolation, is not a derivative work of the Library, and
|
||||||
|
therefore falls outside the scope of this License.
|
||||||
|
|
||||||
|
However, linking a "work that uses the Library" with the Library
|
||||||
|
creates an executable that is a derivative of the Library (because it
|
||||||
|
contains portions of the Library), rather than a "work that uses the
|
||||||
|
library". The executable is therefore covered by this License.
|
||||||
|
Section 6 states terms for distribution of such executables.
|
||||||
|
|
||||||
|
When a "work that uses the Library" uses material from a header file
|
||||||
|
that is part of the Library, the object code for the work may be a
|
||||||
|
derivative work of the Library even though the source code is not.
|
||||||
|
Whether this is true is especially significant if the work can be
|
||||||
|
linked without the Library, or if the work is itself a library. The
|
||||||
|
threshold for this to be true is not precisely defined by law.
|
||||||
|
|
||||||
|
If such an object file uses only numerical parameters, data
|
||||||
|
structure layouts and accessors, and small macros and small inline
|
||||||
|
functions (ten lines or less in length), then the use of the object
|
||||||
|
file is unrestricted, regardless of whether it is legally a derivative
|
||||||
|
work. (Executables containing this object code plus portions of the
|
||||||
|
Library will still fall under Section 6.)
|
||||||
|
|
||||||
|
Otherwise, if the work is a derivative of the Library, you may
|
||||||
|
distribute the object code for the work under the terms of Section 6.
|
||||||
|
Any executables containing that work also fall under Section 6,
|
||||||
|
whether or not they are linked directly with the Library itself.
|
||||||
|
|
||||||
|
6. As an exception to the Sections above, you may also compile or
|
||||||
|
link a "work that uses the Library" with the Library to produce a
|
||||||
|
work containing portions of the Library, and distribute that work
|
||||||
|
under terms of your choice, provided that the terms permit
|
||||||
|
modification of the work for the customer's own use and reverse
|
||||||
|
engineering for debugging such modifications.
|
||||||
|
|
||||||
|
You must give prominent notice with each copy of the work that the
|
||||||
|
Library is used in it and that the Library and its use are covered by
|
||||||
|
this License. You must supply a copy of this License. If the work
|
||||||
|
during execution displays copyright notices, you must include the
|
||||||
|
copyright notice for the Library among them, as well as a reference
|
||||||
|
directing the user to the copy of this License. Also, you must do one
|
||||||
|
of these things:
|
||||||
|
|
||||||
|
a) Accompany the work with the complete corresponding
|
||||||
|
machine-readable source code for the Library including whatever
|
||||||
|
changes were used in the work (which must be distributed under
|
||||||
|
Sections 1 and 2 above); and, if the work is an executable linked
|
||||||
|
with the Library, with the complete machine-readable "work that
|
||||||
|
uses the Library", as object code and/or source code, so that the
|
||||||
|
user can modify the Library and then relink to produce a modified
|
||||||
|
executable containing the modified Library. (It is understood
|
||||||
|
that the user who changes the contents of definitions files in the
|
||||||
|
Library will not necessarily be able to recompile the application
|
||||||
|
to use the modified definitions.)
|
||||||
|
|
||||||
|
b) Accompany the work with a written offer, valid for at
|
||||||
|
least three years, to give the same user the materials
|
||||||
|
specified in Subsection 6a, above, for a charge no more
|
||||||
|
than the cost of performing this distribution.
|
||||||
|
|
||||||
|
c) If distribution of the work is made by offering access to copy
|
||||||
|
from a designated place, offer equivalent access to copy the above
|
||||||
|
specified materials from the same place.
|
||||||
|
|
||||||
|
d) Verify that the user has already received a copy of these
|
||||||
|
materials or that you have already sent this user a copy.
|
||||||
|
|
||||||
|
For an executable, the required form of the "work that uses the
|
||||||
|
Library" must include any data and utility programs needed for
|
||||||
|
reproducing the executable from it. However, as a special exception,
|
||||||
|
the source code distributed need not include anything that is normally
|
||||||
|
distributed (in either source or binary form) with the major
|
||||||
|
components (compiler, kernel, and so on) of the operating system on
|
||||||
|
which the executable runs, unless that component itself accompanies
|
||||||
|
the executable.
|
||||||
|
|
||||||
|
It may happen that this requirement contradicts the license
|
||||||
|
restrictions of other proprietary libraries that do not normally
|
||||||
|
accompany the operating system. Such a contradiction means you cannot
|
||||||
|
use both them and the Library together in an executable that you
|
||||||
|
distribute.
|
||||||
|
|
||||||
|
7. You may place library facilities that are a work based on the
|
||||||
|
Library side-by-side in a single library together with other library
|
||||||
|
facilities not covered by this License, and distribute such a combined
|
||||||
|
library, provided that the separate distribution of the work based on
|
||||||
|
the Library and of the other library facilities is otherwise
|
||||||
|
permitted, and provided that you do these two things:
|
||||||
|
|
||||||
|
a) Accompany the combined library with a copy of the same work
|
||||||
|
based on the Library, uncombined with any other library
|
||||||
|
facilities. This must be distributed under the terms of the
|
||||||
|
Sections above.
|
||||||
|
|
||||||
|
b) Give prominent notice with the combined library of the fact
|
||||||
|
that part of it is a work based on the Library, and explaining
|
||||||
|
where to find the accompanying uncombined form of the same work.
|
||||||
|
|
||||||
|
8. You may not copy, modify, sublicense, link with, or distribute
|
||||||
|
the Library except as expressly provided under this License. Any
|
||||||
|
attempt otherwise to copy, modify, sublicense, link with, or
|
||||||
|
distribute the Library is void, and will automatically terminate your
|
||||||
|
rights under this License. However, parties who have received copies,
|
||||||
|
or rights, from you under this License will not have their licenses
|
||||||
|
terminated so long as such parties remain in full compliance.
|
||||||
|
|
||||||
|
9. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Library or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Library (or any work based on the
|
||||||
|
Library), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Library or works based on it.
|
||||||
|
|
||||||
|
10. Each time you redistribute the Library (or any work based on the
|
||||||
|
Library), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute, link with or modify the Library
|
||||||
|
subject to these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
11. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Library at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Library by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Library.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under any
|
||||||
|
particular circumstance, the balance of the section is intended to apply,
|
||||||
|
and the section as a whole is intended to apply in other circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
12. If the distribution and/or use of the Library is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Library under this License may add
|
||||||
|
an explicit geographical distribution limitation excluding those countries,
|
||||||
|
so that distribution is permitted only in or among countries not thus
|
||||||
|
excluded. In such case, this License incorporates the limitation as if
|
||||||
|
written in the body of this License.
|
||||||
|
|
||||||
|
13. The Free Software Foundation may publish revised and/or new
|
||||||
|
versions of the Library General Public License from time to time.
|
||||||
|
Such new versions will be similar in spirit to the present version,
|
||||||
|
but may differ in detail to address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the Library
|
||||||
|
specifies a version number of this License which applies to it and
|
||||||
|
"any later version", you have the option of following the terms and
|
||||||
|
conditions either of that version or of any later version published by
|
||||||
|
the Free Software Foundation. If the Library does not specify a
|
||||||
|
license version number, you may choose any version ever published by
|
||||||
|
the Free Software Foundation.
|
||||||
|
|
||||||
|
14. If you wish to incorporate parts of the Library into other free
|
||||||
|
programs whose distribution conditions are incompatible with these,
|
||||||
|
write to the author to ask for permission. For software which is
|
||||||
|
copyrighted by the Free Software Foundation, write to the Free
|
||||||
|
Software Foundation; we sometimes make exceptions for this. Our
|
||||||
|
decision will be guided by the two goals of preserving the free status
|
||||||
|
of all derivatives of our free software and of promoting the sharing
|
||||||
|
and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||||
|
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||||
|
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||||
|
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||||
|
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||||
|
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||||
|
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||||
|
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||||
|
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||||
|
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||||
|
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||||
|
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||||
|
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||||
|
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||||
|
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||||
|
DAMAGES.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
Appendix: How to Apply These Terms to Your New Libraries
|
||||||
|
|
||||||
|
If you develop a new library, and you want it to be of the greatest
|
||||||
|
possible use to the public, we recommend making it free software that
|
||||||
|
everyone can redistribute and change. You can do so by permitting
|
||||||
|
redistribution under these terms (or, alternatively, under the terms of the
|
||||||
|
ordinary General Public License).
|
||||||
|
|
||||||
|
To apply these terms, attach the following notices to the library. It is
|
||||||
|
safest to attach them to the start of each source file to most effectively
|
||||||
|
convey the exclusion of warranty; and each file should have at least the
|
||||||
|
"copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the library's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public
|
||||||
|
License as published by the Free Software Foundation; either
|
||||||
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
This library 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
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with this library; if not, write to the Free
|
||||||
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||||
|
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1990
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
That's all there is to it!
|
||||||
|
|
BIN
Dependencies/x86/SDL2.dll
vendored
Normal file
BIN
Dependencies/x86/SDL2.dll
vendored
Normal file
Binary file not shown.
BIN
Dependencies/x86/openal32.dll
vendored
Normal file
BIN
Dependencies/x86/openal32.dll
vendored
Normal file
Binary file not shown.
90
Source/Examples/DependencyLoader.cs
Normal file
90
Source/Examples/DependencyLoader.cs
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace Examples
|
||||||
|
{
|
||||||
|
class DependencyLoader : IDisposable
|
||||||
|
{
|
||||||
|
bool disposed;
|
||||||
|
readonly List<IntPtr> LoadedLibraries = new List<IntPtr>();
|
||||||
|
|
||||||
|
enum TargetCpu
|
||||||
|
{
|
||||||
|
x86,
|
||||||
|
x86_64,
|
||||||
|
}
|
||||||
|
|
||||||
|
static readonly TargetCpu Cpu = IntPtr.Size == 4 ? TargetCpu.x86 : TargetCpu.x86_64;
|
||||||
|
|
||||||
|
public void LoadDependencies()
|
||||||
|
{
|
||||||
|
string path = Path.Combine("Dependencies", Cpu == TargetCpu.x86 ? "x86" : "x64");
|
||||||
|
|
||||||
|
if (Directory.Exists(path))
|
||||||
|
{
|
||||||
|
if (Configuration.RunningOnWindows)
|
||||||
|
{
|
||||||
|
foreach (var file in Directory.GetFiles(path, "*.dll"))
|
||||||
|
{
|
||||||
|
IntPtr lib = NativeMethods.LoadLibrary(file);
|
||||||
|
if (lib == IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Debug.Print("Failed to load dependency {0} with {1}", file,
|
||||||
|
Marshal.GetLastWin32Error());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LoadedLibraries.Add(lib);
|
||||||
|
Debug.Print("Loaded dependency {0}", file);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static class NativeMethods
|
||||||
|
{
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
|
internal static extern IntPtr LoadLibrary(string dllName);
|
||||||
|
|
||||||
|
[DllImport("kernel32.dll", SetLastError = true)]
|
||||||
|
internal static extern int FreeLibrary(IntPtr dll);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IDisposable Members
|
||||||
|
|
||||||
|
void Dispose(bool manual)
|
||||||
|
{
|
||||||
|
if (!disposed)
|
||||||
|
{
|
||||||
|
if (manual)
|
||||||
|
{
|
||||||
|
foreach (var lib in LoadedLibraries)
|
||||||
|
{
|
||||||
|
NativeMethods.FreeLibrary(lib);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
disposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
~DependencyLoader()
|
||||||
|
{
|
||||||
|
Dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -41,7 +41,7 @@ namespace Examples
|
||||||
public static void Main()
|
public static void Main()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// This seems to be useful enough to leave in for a while.
|
// This seems to be useful enough to leave in for a while.
|
||||||
TextWriterTraceListener console = new TextWriterTraceListener(System.Console.Out);
|
TextWriterTraceListener console = new TextWriterTraceListener(System.Console.Out);
|
||||||
Trace.Listeners.Add (console);
|
Trace.Listeners.Add (console);
|
||||||
|
@ -49,11 +49,6 @@ namespace Examples
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetCompatibleTextRenderingDefault(false);
|
Application.SetCompatibleTextRenderingDefault(false);
|
||||||
|
|
||||||
// The ExampleBrowser works pretty poorly on some platforms, so you may want to start examples directly.
|
|
||||||
// for example: Examples.Tutorial.T12_GLSL_Parallax.Main ();
|
|
||||||
// Examples.Tutorial.T10_GLSL_Cube.Main ();
|
|
||||||
Examples.Tests.BasicMouseInput.Main ();
|
|
||||||
|
|
||||||
using (Form browser = new ExampleBrowser())
|
using (Form browser = new ExampleBrowser())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -142,6 +142,7 @@
|
||||||
<Compile Include="..\GlobalAssemblyInfo.cs">
|
<Compile Include="..\GlobalAssemblyInfo.cs">
|
||||||
<Link>Properties\GlobalAssemblyInfo.cs</Link>
|
<Link>Properties\GlobalAssemblyInfo.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="DependencyLoader.cs" />
|
||||||
<Compile Include="ExampleInfo.cs">
|
<Compile Include="ExampleInfo.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -611,6 +612,30 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\Game.ico" />
|
<None Include="Resources\Game.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="..\..\Dependencies\openal.COPYING.txt">
|
||||||
|
<Link>Dependencies\openal.COPYING.txt</Link>
|
||||||
|
</Content>
|
||||||
|
<Content Include="..\..\Dependencies\SDL2.COPYING.txt">
|
||||||
|
<Link>Dependencies\SDL2.COPYING.txt</Link>
|
||||||
|
</Content>
|
||||||
|
<Content Include="..\..\Dependencies\x64\openal32.dll">
|
||||||
|
<Link>Dependencies\x64\openal32.dll</Link>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="..\..\Dependencies\x64\SDL2.dll">
|
||||||
|
<Link>Dependencies\x64\SDL2.dll</Link>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="..\..\Dependencies\x86\openal32.dll">
|
||||||
|
<Link>Dependencies\x86\openal32.dll</Link>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="..\..\Dependencies\x86\SDL2.dll">
|
||||||
|
<Link>Dependencies\x86\SDL2.dll</Link>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>
|
<PreBuildEvent>
|
||||||
|
|
|
@ -42,8 +42,9 @@ namespace OpenTK
|
||||||
throw new ArgumentNullException("mode");
|
throw new ArgumentNullException("mode");
|
||||||
if (control == null)
|
if (control == null)
|
||||||
throw new ArgumentNullException("control");
|
throw new ArgumentNullException("control");
|
||||||
|
|
||||||
if (Configuration.RunningOnWindows) return new WinGLControl(mode, control);
|
if (Configuration.RunningOnSdl2) return new Sdl2GLControl(mode, control);
|
||||||
|
else if (Configuration.RunningOnWindows) return new WinGLControl(mode, control);
|
||||||
else if (Configuration.RunningOnMacOS) return new CarbonGLControl(mode, control);
|
else if (Configuration.RunningOnMacOS) return new CarbonGLControl(mode, control);
|
||||||
else if (Configuration.RunningOnX11) return new X11GLControl(mode, control);
|
else if (Configuration.RunningOnX11) return new X11GLControl(mode, control);
|
||||||
else throw new PlatformNotSupportedException();
|
else throw new PlatformNotSupportedException();
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProjectType>Local</ProjectType>
|
<ProjectType>Local</ProjectType>
|
||||||
|
@ -144,6 +144,7 @@
|
||||||
<Compile Include="GLControl.cs">
|
<Compile Include="GLControl.cs">
|
||||||
<SubType>UserControl</SubType>
|
<SubType>UserControl</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Sdl2GLControl.cs" />
|
||||||
<Compile Include="WinGLControl.cs">
|
<Compile Include="WinGLControl.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|
81
Source/GLControl/Sdl2GLControl.cs
Normal file
81
Source/GLControl/Sdl2GLControl.cs
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
#region License
|
||||||
|
//
|
||||||
|
// The Open Toolkit Library License
|
||||||
|
//
|
||||||
|
// Copyright (c) 2006 - 2013 Stefanos Apostolopoulos
|
||||||
|
//
|
||||||
|
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
// of this software and associated documentation files (the "Software"), to deal
|
||||||
|
// in the Software without restriction, including without limitation the rights to
|
||||||
|
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
// the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
// so, subject to the following conditions:
|
||||||
|
//
|
||||||
|
// The above copyright notice and this permission notice shall be included in all
|
||||||
|
// copies or substantial portions of the Software.
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||||
|
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||||
|
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||||
|
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
//
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using OpenTK.Platform;
|
||||||
|
|
||||||
|
namespace OpenTK
|
||||||
|
{
|
||||||
|
class Sdl2GLControl : IGLControl
|
||||||
|
{
|
||||||
|
IWindowInfo window_info;
|
||||||
|
GraphicsMode mode;
|
||||||
|
|
||||||
|
public Sdl2GLControl(GraphicsMode mode, Control control)
|
||||||
|
{
|
||||||
|
this.mode = mode;
|
||||||
|
window_info = Utilities.CreateSdl2WindowInfo(control.Handle);
|
||||||
|
|
||||||
|
// On windows, we must set the SDL_WINDOW_OPENGL flag
|
||||||
|
// otherwise context creation will fail.
|
||||||
|
if (Configuration.RunningOnWindows)
|
||||||
|
{
|
||||||
|
// Set SDL_WINDOW_OPENGL in the SDL_Window->flags field
|
||||||
|
int flags_offset = 52; // 2 * IntPtr.Size + 9 * sizeof(int);
|
||||||
|
uint flags = (uint)Marshal.ReadInt32(window_info.Handle, 20);
|
||||||
|
flags |= 2;
|
||||||
|
Marshal.WriteInt32(window_info.Handle, flags_offset, (int)flags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Graphics.IGraphicsContext CreateContext(int major, int minor, Graphics.GraphicsContextFlags flags)
|
||||||
|
{
|
||||||
|
return new GraphicsContext(mode, window_info, major, minor, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsIdle
|
||||||
|
{
|
||||||
|
get { return NativeMethods.SDL_HasEvents(0, 0xffff); }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Platform.IWindowInfo WindowInfo
|
||||||
|
{
|
||||||
|
get { return window_info; }
|
||||||
|
}
|
||||||
|
|
||||||
|
static class NativeMethods
|
||||||
|
{
|
||||||
|
[DllImport("SDL2.dll", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern bool SDL_HasEvents(int minType, int maxType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,7 +47,7 @@ namespace OpenTK
|
||||||
// Detects the underlying OS and runtime.
|
// Detects the underlying OS and runtime.
|
||||||
static Configuration()
|
static Configuration()
|
||||||
{
|
{
|
||||||
Toolkit.Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -79,6 +79,18 @@ namespace OpenTK
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region RunningOnSDL2
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a System.Boolean indicating whether OpenTK is running on the SDL2 backend.
|
||||||
|
/// </summary>
|
||||||
|
public static bool RunningOnSdl2
|
||||||
|
{
|
||||||
|
get { return Sdl2Supported; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region public static bool RunningOnLinux
|
#region public static bool RunningOnLinux
|
||||||
|
|
||||||
/// <summary>Gets a System.Boolean indicating whether OpenTK is running on an X11 platform.</summary>
|
/// <summary>Gets a System.Boolean indicating whether OpenTK is running on an X11 platform.</summary>
|
||||||
|
@ -162,15 +174,22 @@ namespace OpenTK
|
||||||
// Detect whether SDL2 is supported
|
// Detect whether SDL2 is supported
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var flags = OpenTK.Platform.SDL2.SDL.SDL_INIT_EVERYTHING;
|
if (OpenTK.Platform.SDL2.SDL.SDL_WasInit(0) == 0)
|
||||||
flags &= ~OpenTK.Platform.SDL2.SDL.SDL_INIT_AUDIO;
|
|
||||||
if (OpenTK.Platform.SDL2.SDL.SDL_Init((uint)flags) == 0)
|
|
||||||
{
|
{
|
||||||
supported = true;
|
var flags = OpenTK.Platform.SDL2.SDL.SDL_INIT_EVERYTHING;
|
||||||
|
flags &= ~OpenTK.Platform.SDL2.SDL.SDL_INIT_AUDIO;
|
||||||
|
if (OpenTK.Platform.SDL2.SDL.SDL_Init((uint)flags) == 0)
|
||||||
|
{
|
||||||
|
supported = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Print("SDL2 init failed with error: {0}", OpenTK.Platform.SDL2.SDL.SDL_GetError());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Print("SDL2 init failed with error: {0}", OpenTK.Platform.SDL2.SDL.SDL_GetError());
|
supported = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
@ -190,7 +209,13 @@ namespace OpenTK
|
||||||
|
|
||||||
#region Internal Methods
|
#region Internal Methods
|
||||||
|
|
||||||
internal static bool Sdl2Supported { get; private set; }
|
internal static bool Sdl2Supported
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return DetectSdl2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static void Init()
|
internal static void Init()
|
||||||
{
|
{
|
||||||
|
@ -255,8 +280,6 @@ namespace OpenTK
|
||||||
runningOnUnix ? "Unix" : RunningOnX11 ? "X11" : "Unknown Platform",
|
runningOnUnix ? "Unix" : RunningOnX11 ? "X11" : "Unknown Platform",
|
||||||
RunningOnMono ? "Mono" : ".Net");
|
RunningOnMono ? "Mono" : ".Net");
|
||||||
|
|
||||||
Sdl2Supported = DetectSdl2();
|
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,5 +13,10 @@ namespace OpenTK.Platform.Dummy
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public IntPtr Handle
|
||||||
|
{
|
||||||
|
get { return IntPtr.Zero; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace OpenTK.Platform.Egl
|
||||||
{
|
{
|
||||||
WinWindowInfo win_win = (WinWindowInfo)window;
|
WinWindowInfo win_win = (WinWindowInfo)window;
|
||||||
IntPtr egl_display = GetDisplay(win_win.DeviceContext);
|
IntPtr egl_display = GetDisplay(win_win.DeviceContext);
|
||||||
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.WindowHandle, egl_display);
|
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.Handle, egl_display);
|
||||||
return new EglContext(mode, egl_win, shareContext, major, minor, flags);
|
return new EglContext(mode, egl_win, shareContext, major, minor, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ namespace OpenTK.Platform.Egl
|
||||||
{
|
{
|
||||||
WinWindowInfo win_win = (WinWindowInfo)window;
|
WinWindowInfo win_win = (WinWindowInfo)window;
|
||||||
IntPtr egl_display = GetDisplay(win_win.DeviceContext);
|
IntPtr egl_display = GetDisplay(win_win.DeviceContext);
|
||||||
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.WindowHandle, egl_display);
|
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(win_win.Handle, egl_display);
|
||||||
return new EglContext(handle, egl_win, shareContext, major, minor, flags);
|
return new EglContext(handle, egl_win, shareContext, major, minor, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,14 +38,14 @@ namespace OpenTK.Platform.Egl
|
||||||
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
public override IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||||
{
|
{
|
||||||
X11WindowInfo x11_win = (X11WindowInfo)window;
|
X11WindowInfo x11_win = (X11WindowInfo)window;
|
||||||
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(x11_win.Display));
|
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.Handle, Egl.GetDisplay(x11_win.Display));
|
||||||
return new EglContext(mode, egl_win, shareContext, major, minor, flags);
|
return new EglContext(mode, egl_win, shareContext, major, minor, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
public override IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||||
{
|
{
|
||||||
X11WindowInfo x11_win = (X11WindowInfo)window;
|
X11WindowInfo x11_win = (X11WindowInfo)window;
|
||||||
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.WindowHandle, Egl.GetDisplay(x11_win.Display));
|
EglWindowInfo egl_win = new OpenTK.Platform.Egl.EglWindowInfo(x11_win.Handle, Egl.GetDisplay(x11_win.Display));
|
||||||
return new EglContext(handle, egl_win, shareContext, major, minor, flags);
|
return new EglContext(handle, egl_win, shareContext, major, minor, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,12 @@ using System.Text;
|
||||||
|
|
||||||
namespace OpenTK.Platform
|
namespace OpenTK.Platform
|
||||||
{
|
{
|
||||||
/// <summary>Descibes an OS window.</summary>
|
/// <summary>Describes an OS window.</summary>
|
||||||
public interface IWindowInfo : IDisposable
|
public interface IWindowInfo : IDisposable
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a platform-specific handle to this window.
|
||||||
|
/// </summary>
|
||||||
|
IntPtr Handle { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
private IntPtr GetQuartzDevice(CarbonWindowInfo carbonWindow)
|
private IntPtr GetQuartzDevice(CarbonWindowInfo carbonWindow)
|
||||||
{
|
{
|
||||||
IntPtr windowRef = carbonWindow.WindowRef;
|
IntPtr windowRef = carbonWindow.Handle;
|
||||||
|
|
||||||
if (CarbonGLNative.WindowRefMap.ContainsKey(windowRef) == false)
|
if (CarbonGLNative.WindowRefMap.ContainsKey(windowRef) == false)
|
||||||
return IntPtr.Zero;
|
return IntPtr.Zero;
|
||||||
|
@ -286,13 +286,13 @@ namespace OpenTK.Platform.MacOS
|
||||||
IntPtr windowPort;
|
IntPtr windowPort;
|
||||||
if (carbonWindow.IsControl)
|
if (carbonWindow.IsControl)
|
||||||
{
|
{
|
||||||
IntPtr controlOwner = API.GetControlOwner(carbonWindow.WindowRef);
|
IntPtr controlOwner = API.GetControlOwner(carbonWindow.Handle);
|
||||||
|
|
||||||
windowPort = API.GetWindowPort(controlOwner);
|
windowPort = API.GetWindowPort(controlOwner);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
windowPort = API.GetWindowPort(carbonWindow.WindowRef);
|
windowPort = API.GetWindowPort(carbonWindow.Handle);
|
||||||
|
|
||||||
return windowPort;
|
return windowPort;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +336,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
private CarbonGLNative GetCarbonWindow(CarbonWindowInfo carbonWindow)
|
private CarbonGLNative GetCarbonWindow(CarbonWindowInfo carbonWindow)
|
||||||
{
|
{
|
||||||
WeakReference r = CarbonGLNative.WindowRefMap[carbonWindow.WindowRef];
|
WeakReference r = CarbonGLNative.WindowRefMap[carbonWindow.Handle];
|
||||||
|
|
||||||
if (r.IsAlive)
|
if (r.IsAlive)
|
||||||
{
|
{
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
Debug.Print("Disposing of CarbonGLNative window.");
|
Debug.Print("Disposing of CarbonGLNative window.");
|
||||||
|
|
||||||
CursorVisible = true;
|
CursorVisible = true;
|
||||||
API.DisposeWindow(window.WindowRef);
|
API.DisposeWindow(window.Handle);
|
||||||
mIsDisposed = true;
|
mIsDisposed = true;
|
||||||
mExists = false;
|
mExists = false;
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
if (disposing)
|
if (disposing)
|
||||||
{
|
{
|
||||||
mWindows.Remove(window.WindowRef);
|
mWindows.Remove(window.Handle);
|
||||||
|
|
||||||
window.Dispose();
|
window.Dispose();
|
||||||
window = null;
|
window = null;
|
||||||
|
@ -202,7 +202,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
LoadSize();
|
LoadSize();
|
||||||
|
|
||||||
Rect titleSize = API.GetWindowBounds(window.WindowRef, WindowRegionCode.TitleBarRegion);
|
Rect titleSize = API.GetWindowBounds(window.Handle, WindowRegionCode.TitleBarRegion);
|
||||||
mTitlebarHeight = titleSize.Height;
|
mTitlebarHeight = titleSize.Height;
|
||||||
|
|
||||||
Debug.Print("Titlebar size: {0}", titleSize);
|
Debug.Print("Titlebar size: {0}", titleSize);
|
||||||
|
@ -241,29 +241,29 @@ namespace OpenTK.Platform.MacOS
|
||||||
MacOSEventHandler handler = EventHandler;
|
MacOSEventHandler handler = EventHandler;
|
||||||
uppHandler = API.NewEventHandlerUPP(handler);
|
uppHandler = API.NewEventHandlerUPP(handler);
|
||||||
|
|
||||||
API.InstallWindowEventHandler(window.WindowRef, uppHandler, eventTypes,
|
API.InstallWindowEventHandler(window.Handle, uppHandler, eventTypes,
|
||||||
window.WindowRef, IntPtr.Zero);
|
window.Handle, IntPtr.Zero);
|
||||||
|
|
||||||
Application.WindowEventHandler = this;
|
Application.WindowEventHandler = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Activate()
|
void Activate()
|
||||||
{
|
{
|
||||||
API.SelectWindow(window.WindowRef);
|
API.SelectWindow(window.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Show()
|
void Show()
|
||||||
{
|
{
|
||||||
IntPtr parent = IntPtr.Zero;
|
IntPtr parent = IntPtr.Zero;
|
||||||
|
|
||||||
API.ShowWindow(window.WindowRef);
|
API.ShowWindow(window.Handle);
|
||||||
API.RepositionWindow(window.WindowRef, parent, WindowPositionMethod);
|
API.RepositionWindow(window.Handle, parent, WindowPositionMethod);
|
||||||
API.SelectWindow(window.WindowRef);
|
API.SelectWindow(window.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hide()
|
void Hide()
|
||||||
{
|
{
|
||||||
API.HideWindow(window.WindowRef);
|
API.HideWindow(window.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void SetFullscreen(AglContext context)
|
internal void SetFullscreen(AglContext context)
|
||||||
|
@ -565,7 +565,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
if (window == null)
|
if (window == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bool thisIn = eventWindowRef == window.WindowRef;
|
bool thisIn = eventWindowRef == window.Handle;
|
||||||
|
|
||||||
if (pt.Y < 0)
|
if (pt.Y < 0)
|
||||||
thisIn = false;
|
thisIn = false;
|
||||||
|
@ -635,7 +635,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
Rect GetRegion()
|
Rect GetRegion()
|
||||||
{
|
{
|
||||||
Rect retval = API.GetWindowBounds(window.WindowRef, WindowRegionCode.ContentRegion);
|
Rect retval = API.GetWindowBounds(window.Handle, WindowRegionCode.ContentRegion);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -645,7 +645,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
if (windowState == WindowState.Fullscreen)
|
if (windowState == WindowState.Fullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
API.MoveWindow(window.WindowRef, x, y, false);
|
API.MoveWindow(window.Handle, x, y, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSize(short width, short height)
|
void SetSize(short width, short height)
|
||||||
|
@ -659,7 +659,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
width -= (short)(bounds.Width - clientRectangle.Width);
|
width -= (short)(bounds.Width - clientRectangle.Width);
|
||||||
height -= (short)(bounds.Height - clientRectangle.Height);
|
height -= (short)(bounds.Height - clientRectangle.Height);
|
||||||
|
|
||||||
API.SizeWindow(window.WindowRef, width, height, true);
|
API.SizeWindow(window.Handle, width, height, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetClientSize(short width, short height)
|
void SetClientSize(short width, short height)
|
||||||
|
@ -667,7 +667,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
if (WindowState == WindowState.Fullscreen)
|
if (WindowState == WindowState.Fullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
API.SizeWindow(window.WindowRef, width, height, true);
|
API.SizeWindow(window.Handle, width, height, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadSize()
|
private void LoadSize()
|
||||||
|
@ -675,10 +675,10 @@ namespace OpenTK.Platform.MacOS
|
||||||
if (WindowState == WindowState.Fullscreen)
|
if (WindowState == WindowState.Fullscreen)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Rect r = API.GetWindowBounds(window.WindowRef, WindowRegionCode.StructureRegion);
|
Rect r = API.GetWindowBounds(window.Handle, WindowRegionCode.StructureRegion);
|
||||||
bounds = new Rectangle(r.X, r.Y, r.Width, r.Height);
|
bounds = new Rectangle(r.X, r.Y, r.Width, r.Height);
|
||||||
|
|
||||||
r = API.GetWindowBounds(window.WindowRef, WindowRegionCode.GlobalPortRegion);
|
r = API.GetWindowBounds(window.Handle, WindowRegionCode.GlobalPortRegion);
|
||||||
clientRectangle = new Rectangle(0, 0, r.Width, r.Height);
|
clientRectangle = new Rectangle(0, 0, r.Width, r.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,13 +693,13 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
public Point PointToClient(Point point)
|
public Point PointToClient(Point point)
|
||||||
{
|
{
|
||||||
Rect r = Carbon.API.GetWindowBounds(window.WindowRef, WindowRegionCode.ContentRegion);
|
Rect r = Carbon.API.GetWindowBounds(window.Handle, WindowRegionCode.ContentRegion);
|
||||||
return new Point(point.X - r.X, point.Y - r.Y);
|
return new Point(point.X - r.X, point.Y - r.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Point PointToScreen(Point point)
|
public Point PointToScreen(Point point)
|
||||||
{
|
{
|
||||||
Rect r = Carbon.API.GetWindowBounds(window.WindowRef, WindowRegionCode.ContentRegion);
|
Rect r = Carbon.API.GetWindowBounds(window.Handle, WindowRegionCode.ContentRegion);
|
||||||
return new Point(point.X + r.X, point.Y + r.Y);
|
return new Point(point.X + r.X, point.Y + r.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,7 +802,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
{
|
{
|
||||||
if (value != Title)
|
if (value != Title)
|
||||||
{
|
{
|
||||||
API.SetWindowTitle(window.WindowRef, value);
|
API.SetWindowTitle(window.Handle, value);
|
||||||
title = value;
|
title = value;
|
||||||
TitleChanged(this, EventArgs.Empty);
|
TitleChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
@ -811,7 +811,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
public bool Visible
|
public bool Visible
|
||||||
{
|
{
|
||||||
get { return API.IsWindowVisible(window.WindowRef); }
|
get { return API.IsWindowVisible(window.Handle); }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value != Visible)
|
if (value != Visible)
|
||||||
|
@ -891,7 +891,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
get { return clientRectangle.Size; }
|
get { return clientRectangle.Size; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
API.SizeWindow(window.WindowRef, (short)value.Width, (short)value.Height, true);
|
API.SizeWindow(window.Handle, (short)value.Width, (short)value.Height, true);
|
||||||
LoadSize();
|
LoadSize();
|
||||||
Resize(this, EventArgs.Empty);
|
Resize(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
@ -936,10 +936,10 @@ namespace OpenTK.Platform.MacOS
|
||||||
if (windowState == WindowState.Fullscreen)
|
if (windowState == WindowState.Fullscreen)
|
||||||
return WindowState.Fullscreen;
|
return WindowState.Fullscreen;
|
||||||
|
|
||||||
if (Carbon.API.IsWindowCollapsed(window.WindowRef))
|
if (Carbon.API.IsWindowCollapsed(window.Handle))
|
||||||
return WindowState.Minimized;
|
return WindowState.Minimized;
|
||||||
|
|
||||||
if (Carbon.API.IsWindowInStandardState(window.WindowRef))
|
if (Carbon.API.IsWindowInStandardState(window.Handle))
|
||||||
{
|
{
|
||||||
return WindowState.Maximized;
|
return WindowState.Maximized;
|
||||||
}
|
}
|
||||||
|
@ -967,7 +967,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
if (oldState == WindowState.Minimized)
|
if (oldState == WindowState.Minimized)
|
||||||
{
|
{
|
||||||
API.CollapseWindow(window.WindowRef, false);
|
API.CollapseWindow(window.Handle, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCarbonWindowState();
|
SetCarbonWindowState();
|
||||||
|
@ -990,20 +990,20 @@ namespace OpenTK.Platform.MacOS
|
||||||
// meaning they are maximized up to their reported ideal size. So we report a
|
// meaning they are maximized up to their reported ideal size. So we report a
|
||||||
// large ideal size.
|
// large ideal size.
|
||||||
idealSize = new CarbonPoint(9000, 9000);
|
idealSize = new CarbonPoint(9000, 9000);
|
||||||
API.ZoomWindowIdeal(window.WindowRef, WindowPartCode.inZoomOut, ref idealSize);
|
API.ZoomWindowIdeal(window.Handle, WindowPartCode.inZoomOut, ref idealSize);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WindowState.Normal:
|
case WindowState.Normal:
|
||||||
if (WindowState == WindowState.Maximized)
|
if (WindowState == WindowState.Maximized)
|
||||||
{
|
{
|
||||||
idealSize = new CarbonPoint();
|
idealSize = new CarbonPoint();
|
||||||
API.ZoomWindowIdeal(window.WindowRef, WindowPartCode.inZoomIn, ref idealSize);
|
API.ZoomWindowIdeal(window.Handle, WindowPartCode.inZoomIn, ref idealSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WindowState.Minimized:
|
case WindowState.Minimized:
|
||||||
API.CollapseWindow(window.WindowRef, true);
|
API.CollapseWindow(window.Handle, true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1026,12 +1026,12 @@ namespace OpenTK.Platform.MacOS
|
||||||
|
|
||||||
if (windowBorder == WindowBorder.Resizable)
|
if (windowBorder == WindowBorder.Resizable)
|
||||||
{
|
{
|
||||||
API.ChangeWindowAttributes(window.WindowRef, WindowAttributes.Resizable | WindowAttributes.FullZoom, WindowAttributes.NoAttributes);
|
API.ChangeWindowAttributes(window.Handle, WindowAttributes.Resizable | WindowAttributes.FullZoom, WindowAttributes.NoAttributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (windowBorder == WindowBorder.Fixed)
|
else if (windowBorder == WindowBorder.Fixed)
|
||||||
{
|
{
|
||||||
API.ChangeWindowAttributes(window.WindowRef, WindowAttributes.NoAttributes, WindowAttributes.Resizable | WindowAttributes.FullZoom);
|
API.ChangeWindowAttributes(window.Handle, WindowAttributes.NoAttributes, WindowAttributes.Resizable | WindowAttributes.FullZoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
WindowBorderChanged(this, EventArgs.Empty);
|
WindowBorderChanged(this, EventArgs.Empty);
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the window reference for this instance.
|
/// Gets the window reference for this instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal IntPtr WindowRef
|
public IntPtr Handle
|
||||||
{
|
{
|
||||||
get { return this.windowRef; }
|
get { return this.windowRef; }
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ namespace OpenTK.Platform.MacOS
|
||||||
/// <returns>A System.String that represents the current window.</returns>
|
/// <returns>A System.String that represents the current window.</returns>
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format("MacOS.CarbonWindowInfo: Handle {0}", this.WindowRef);
|
return String.Format("MacOS.CarbonWindowInfo: Handle {0}", this.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace OpenTK.Platform.SDL2
|
||||||
|
|
||||||
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||||
{
|
{
|
||||||
return new Sdl2GraphicsContext(mode, (Sdl2WindowInfo)window, shareContext, major, minor, flags);
|
return new Sdl2GraphicsContext(mode, window, shareContext, major, minor, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
public IGraphicsContext CreateGLContext(ContextHandle handle, IWindowInfo window, IGraphicsContext shareContext, bool directRendering, int major, int minor, GraphicsContextFlags flags)
|
||||||
|
|
|
@ -34,22 +34,35 @@ namespace OpenTK.Platform.SDL2
|
||||||
{
|
{
|
||||||
class Sdl2GraphicsContext : DesktopGraphicsContext
|
class Sdl2GraphicsContext : DesktopGraphicsContext
|
||||||
{
|
{
|
||||||
Sdl2WindowInfo Window { get; set; }
|
IWindowInfo Window { get; set; }
|
||||||
ContextHandle SdlContext { get; set; }
|
ContextHandle SdlContext { get; set; }
|
||||||
|
|
||||||
public Sdl2GraphicsContext(Sdl2WindowInfo window)
|
public Sdl2GraphicsContext(IWindowInfo window)
|
||||||
{
|
{
|
||||||
Window = window;
|
// It is possible to create a GraphicsContext on a window
|
||||||
|
// that is not owned by SDL (e.g. a GLControl). In that case,
|
||||||
|
// we need to use SDL_CreateWindowFrom in order to
|
||||||
|
// convert the foreign window to a SDL window.
|
||||||
|
if (window is Sdl2WindowInfo)
|
||||||
|
{
|
||||||
|
Window = window;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Window = new Sdl2WindowInfo(
|
||||||
|
SDL.SDL_CreateWindowFrom(window.Handle),
|
||||||
|
null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Sdl2GraphicsContext(GraphicsMode mode,
|
public Sdl2GraphicsContext(GraphicsMode mode,
|
||||||
Sdl2WindowInfo window, IGraphicsContext shareContext,
|
IWindowInfo win, IGraphicsContext shareContext,
|
||||||
int major, int minor,
|
int major, int minor,
|
||||||
OpenTK.Graphics.GraphicsContextFlags flags)
|
OpenTK.Graphics.GraphicsContextFlags flags)
|
||||||
: this(window)
|
: this(win)
|
||||||
{
|
{
|
||||||
SetGLAttributes(mode, shareContext, major, minor, flags);
|
SetGLAttributes(mode, shareContext, major, minor, flags);
|
||||||
SdlContext = new ContextHandle(SDL.SDL_GL_CreateContext(window.Handle));
|
SdlContext = new ContextHandle(SDL.SDL_GL_CreateContext(Window.Handle));
|
||||||
if (SdlContext == ContextHandle.Zero)
|
if (SdlContext == ContextHandle.Zero)
|
||||||
{
|
{
|
||||||
Debug.Print("SDL2 failed to create OpenGL context: {0}", SDL.SDL_GetError());
|
Debug.Print("SDL2 failed to create OpenGL context: {0}", SDL.SDL_GetError());
|
||||||
|
|
|
@ -210,7 +210,7 @@ namespace OpenTK.Platform
|
||||||
Platform.X11.X11WindowInfo window = new OpenTK.Platform.X11.X11WindowInfo();
|
Platform.X11.X11WindowInfo window = new OpenTK.Platform.X11.X11WindowInfo();
|
||||||
window.Display = display;
|
window.Display = display;
|
||||||
window.Screen = screen;
|
window.Screen = screen;
|
||||||
window.WindowHandle = windowHandle;
|
window.Handle = windowHandle;
|
||||||
window.RootWindow = rootWindow;
|
window.RootWindow = rootWindow;
|
||||||
window.VisualInfo = (X11.XVisualInfo)Marshal.PtrToStructure(visualInfo, typeof(X11.XVisualInfo));
|
window.VisualInfo = (X11.XVisualInfo)Marshal.PtrToStructure(visualInfo, typeof(X11.XVisualInfo));
|
||||||
|
|
||||||
|
@ -262,8 +262,21 @@ namespace OpenTK.Platform
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region CreateSdl2WindowInfo
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an IWindowInfo instance for the windows platform.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="windowHandle">The handle of the window.</param>
|
||||||
|
/// <returns>A new IWindowInfo instance.</returns>
|
||||||
|
public static IWindowInfo CreateSdl2WindowInfo(IntPtr windowHandle)
|
||||||
|
{
|
||||||
|
return new OpenTK.Platform.SDL2.Sdl2WindowInfo(
|
||||||
|
SDL2.SDL.SDL_CreateWindowFrom(windowHandle), null);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,14 +53,14 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
if (window == null)
|
if (window == null)
|
||||||
throw new ArgumentNullException("window", "Must point to a valid window.");
|
throw new ArgumentNullException("window", "Must point to a valid window.");
|
||||||
if (window.WindowHandle == IntPtr.Zero)
|
if (window.Handle == IntPtr.Zero)
|
||||||
throw new ArgumentException("window", "Must be a valid window.");
|
throw new ArgumentException("window", "Must be a valid window.");
|
||||||
|
|
||||||
Mode = format;
|
Mode = format;
|
||||||
|
|
||||||
Debug.Print("OpenGL will be bound to window:{0} on thread:{1}", window.WindowHandle,
|
Debug.Print("OpenGL will be bound to window:{0} on thread:{1}", window.Handle,
|
||||||
System.Threading.Thread.CurrentThread.ManagedThreadId);
|
System.Threading.Thread.CurrentThread.ManagedThreadId);
|
||||||
this.SetGraphicsModePFD(format, (WinWindowInfo)window);
|
SetGraphicsModePFD(format, (WinWindowInfo)window);
|
||||||
|
|
||||||
lock (LoadLock)
|
lock (LoadLock)
|
||||||
{
|
{
|
||||||
|
@ -176,7 +176,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
if (window != null)
|
if (window != null)
|
||||||
{
|
{
|
||||||
if (((WinWindowInfo)window).WindowHandle == IntPtr.Zero)
|
if (((WinWindowInfo)window).Handle == IntPtr.Zero)
|
||||||
throw new ArgumentException("window", "Must point to a valid window.");
|
throw new ArgumentException("window", "Must point to a valid window.");
|
||||||
|
|
||||||
success = Wgl.Imports.MakeCurrent(((WinWindowInfo)window).DeviceContext, Handle.Handle);
|
success = Wgl.Imports.MakeCurrent(((WinWindowInfo)window).DeviceContext, Handle.Handle);
|
||||||
|
@ -269,12 +269,12 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Private Methods
|
#region Internal Methods
|
||||||
|
|
||||||
#region SetGraphicsModePFD
|
#region SetGraphicsModePFD
|
||||||
|
|
||||||
// Note: there is no relevant ARB function.
|
// Note: there is no relevant ARB function.
|
||||||
void SetGraphicsModePFD(GraphicsMode mode, WinWindowInfo window)
|
internal static void SetGraphicsModePFD(GraphicsMode mode, WinWindowInfo window)
|
||||||
{
|
{
|
||||||
Debug.Write("Setting pixel format... ");
|
Debug.Write("Setting pixel format... ");
|
||||||
|
|
||||||
|
@ -294,10 +294,6 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Internal Methods
|
|
||||||
|
|
||||||
#region internal IntPtr DeviceContext
|
#region internal IntPtr DeviceContext
|
||||||
|
|
||||||
internal IntPtr DeviceContext
|
internal IntPtr DeviceContext
|
||||||
|
|
|
@ -128,7 +128,7 @@ namespace OpenTK.Platform.Windows
|
||||||
window = new WinWindowInfo(
|
window = new WinWindowInfo(
|
||||||
CreateWindow(x, y, width, height, title, options, device, IntPtr.Zero), null);
|
CreateWindow(x, y, width, height, title, options, device, IntPtr.Zero), null);
|
||||||
child_window = new WinWindowInfo(
|
child_window = new WinWindowInfo(
|
||||||
CreateWindow(0, 0, ClientSize.Width, ClientSize.Height, title, options, device, window.WindowHandle), window);
|
CreateWindow(0, 0, ClientSize.Width, ClientSize.Height, title, options, device, window.Handle), window);
|
||||||
|
|
||||||
exists = true;
|
exists = true;
|
||||||
|
|
||||||
|
@ -193,7 +193,7 @@ namespace OpenTK.Platform.Windows
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
WindowPosition* pos = (WindowPosition*)lParam;
|
WindowPosition* pos = (WindowPosition*)lParam;
|
||||||
if (window != null && pos->hwnd == window.WindowHandle)
|
if (window != null && pos->hwnd == window.Handle)
|
||||||
{
|
{
|
||||||
Point new_location = new Point(pos->x, pos->y);
|
Point new_location = new Point(pos->x, pos->y);
|
||||||
if (Location != new_location)
|
if (Location != new_location)
|
||||||
|
@ -212,7 +212,7 @@ namespace OpenTK.Platform.Windows
|
||||||
Functions.GetClientRect(handle, out rect);
|
Functions.GetClientRect(handle, out rect);
|
||||||
client_rectangle = rect.ToRectangle();
|
client_rectangle = rect.ToRectangle();
|
||||||
|
|
||||||
Functions.SetWindowPos(child_window.WindowHandle, IntPtr.Zero, 0, 0, ClientRectangle.Width, ClientRectangle.Height,
|
Functions.SetWindowPos(child_window.Handle, IntPtr.Zero, 0, 0, ClientRectangle.Width, ClientRectangle.Height,
|
||||||
SetWindowPosFlags.NOZORDER | SetWindowPosFlags.NOOWNERZORDER |
|
SetWindowPosFlags.NOZORDER | SetWindowPosFlags.NOOWNERZORDER |
|
||||||
SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSENDCHANGING);
|
SetWindowPosFlags.NOACTIVATE | SetWindowPosFlags.NOSENDCHANGING);
|
||||||
|
|
||||||
|
@ -317,22 +317,22 @@ namespace OpenTK.Platform.Windows
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WindowMessage.LBUTTONDOWN:
|
case WindowMessage.LBUTTONDOWN:
|
||||||
Functions.SetCapture(window.WindowHandle);
|
Functions.SetCapture(window.Handle);
|
||||||
mouse[MouseButton.Left] = true;
|
mouse[MouseButton.Left] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WindowMessage.MBUTTONDOWN:
|
case WindowMessage.MBUTTONDOWN:
|
||||||
Functions.SetCapture(window.WindowHandle);
|
Functions.SetCapture(window.Handle);
|
||||||
mouse[MouseButton.Middle] = true;
|
mouse[MouseButton.Middle] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WindowMessage.RBUTTONDOWN:
|
case WindowMessage.RBUTTONDOWN:
|
||||||
Functions.SetCapture(window.WindowHandle);
|
Functions.SetCapture(window.Handle);
|
||||||
mouse[MouseButton.Right] = true;
|
mouse[MouseButton.Right] = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WindowMessage.XBUTTONDOWN:
|
case WindowMessage.XBUTTONDOWN:
|
||||||
Functions.SetCapture(window.WindowHandle);
|
Functions.SetCapture(window.Handle);
|
||||||
mouse[((wParam.ToInt32() & 0xFFFF0000) >> 16) !=
|
mouse[((wParam.ToInt32() & 0xFFFF0000) >> 16) !=
|
||||||
(int)MouseKeys.XButton1 ? MouseButton.Button1 : MouseButton.Button2] = true;
|
(int)MouseKeys.XButton1 ? MouseButton.Button1 : MouseButton.Button2] = true;
|
||||||
break;
|
break;
|
||||||
|
@ -497,7 +497,7 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
TrackMouseEventStructure me = new TrackMouseEventStructure();
|
TrackMouseEventStructure me = new TrackMouseEventStructure();
|
||||||
me.Size = TrackMouseEventStructure.SizeInBytes;
|
me.Size = TrackMouseEventStructure.SizeInBytes;
|
||||||
me.TrackWindowHandle = child_window.WindowHandle;
|
me.TrackWindowHandle = child_window.Handle;
|
||||||
me.Flags = TrackMouseEventFlags.LEAVE;
|
me.Flags = TrackMouseEventFlags.LEAVE;
|
||||||
|
|
||||||
if (!Functions.TrackMouseEvent(ref me))
|
if (!Functions.TrackMouseEvent(ref me))
|
||||||
|
@ -536,7 +536,7 @@ namespace OpenTK.Platform.Windows
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
MSG message = new MSG();
|
MSG message = new MSG();
|
||||||
return !Functions.PeekMessage(ref message, window.WindowHandle, 0, 0, 0);
|
return !Functions.PeekMessage(ref message, window.Handle, 0, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,7 +615,7 @@ namespace OpenTK.Platform.Windows
|
||||||
if (Exists)
|
if (Exists)
|
||||||
{
|
{
|
||||||
Debug.Print("Destroying window: {0}", window.ToString());
|
Debug.Print("Destroying window: {0}", window.ToString());
|
||||||
Functions.DestroyWindow(window.WindowHandle);
|
Functions.DestroyWindow(window.Handle);
|
||||||
exists = false;
|
exists = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,7 +682,7 @@ namespace OpenTK.Platform.Windows
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// Note: the bounds variable is updated when the resize/move message arrives.
|
// Note: the bounds variable is updated when the resize/move message arrives.
|
||||||
Functions.SetWindowPos(window.WindowHandle, IntPtr.Zero, value.X, value.Y, value.Width, value.Height, 0);
|
Functions.SetWindowPos(window.Handle, IntPtr.Zero, value.X, value.Y, value.Width, value.Height, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ namespace OpenTK.Platform.Windows
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// Note: the bounds variable is updated when the resize/move message arrives.
|
// Note: the bounds variable is updated when the resize/move message arrives.
|
||||||
Functions.SetWindowPos(window.WindowHandle, IntPtr.Zero, value.X, value.Y, 0, 0, SetWindowPosFlags.NOSIZE);
|
Functions.SetWindowPos(window.Handle, IntPtr.Zero, value.X, value.Y, 0, 0, SetWindowPosFlags.NOSIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,7 +710,7 @@ namespace OpenTK.Platform.Windows
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
// Note: the bounds variable is updated when the resize/move message arrives.
|
// Note: the bounds variable is updated when the resize/move message arrives.
|
||||||
Functions.SetWindowPos(window.WindowHandle, IntPtr.Zero, 0, 0, value.Width, value.Height, SetWindowPosFlags.NOMOVE);
|
Functions.SetWindowPos(window.Handle, IntPtr.Zero, 0, 0, value.Width, value.Height, SetWindowPosFlags.NOMOVE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +730,7 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
WindowStyle style = (WindowStyle)Functions.GetWindowLong(window.WindowHandle, GetWindowLongOffsets.STYLE);
|
WindowStyle style = (WindowStyle)Functions.GetWindowLong(window.Handle, GetWindowLongOffsets.STYLE);
|
||||||
Win32Rectangle rect = Win32Rectangle.From(value);
|
Win32Rectangle rect = Win32Rectangle.From(value);
|
||||||
Functions.AdjustWindowRect(ref rect, style, false);
|
Functions.AdjustWindowRect(ref rect, style, false);
|
||||||
Location = new Point(rect.left, rect.top);
|
Location = new Point(rect.left, rect.top);
|
||||||
|
@ -750,7 +750,7 @@ namespace OpenTK.Platform.Windows
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
WindowStyle style = (WindowStyle)Functions.GetWindowLong(window.WindowHandle, GetWindowLongOffsets.STYLE);
|
WindowStyle style = (WindowStyle)Functions.GetWindowLong(window.Handle, GetWindowLongOffsets.STYLE);
|
||||||
Win32Rectangle rect = Win32Rectangle.From(value);
|
Win32Rectangle rect = Win32Rectangle.From(value);
|
||||||
Functions.AdjustWindowRect(ref rect, style, false);
|
Functions.AdjustWindowRect(ref rect, style, false);
|
||||||
Size = new Size(rect.Width, rect.Height);
|
Size = new Size(rect.Width, rect.Height);
|
||||||
|
@ -812,10 +812,10 @@ namespace OpenTK.Platform.Windows
|
||||||
if (value != icon)
|
if (value != icon)
|
||||||
{
|
{
|
||||||
icon = value;
|
icon = value;
|
||||||
if (window.WindowHandle != IntPtr.Zero)
|
if (window.Handle != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
Functions.SendMessage(window.WindowHandle, WindowMessage.SETICON, (IntPtr)0, icon == null ? IntPtr.Zero : value.Handle);
|
Functions.SendMessage(window.Handle, WindowMessage.SETICON, (IntPtr)0, icon == null ? IntPtr.Zero : value.Handle);
|
||||||
Functions.SendMessage(window.WindowHandle, WindowMessage.SETICON, (IntPtr)1, icon == null ? IntPtr.Zero : value.Handle);
|
Functions.SendMessage(window.Handle, WindowMessage.SETICON, (IntPtr)1, icon == null ? IntPtr.Zero : value.Handle);
|
||||||
}
|
}
|
||||||
IconChanged(this, EventArgs.Empty);
|
IconChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
@ -841,16 +841,16 @@ namespace OpenTK.Platform.Windows
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
sb_title.Remove(0, sb_title.Length);
|
sb_title.Remove(0, sb_title.Length);
|
||||||
if (Functions.GetWindowText(window.WindowHandle, sb_title, sb_title.Capacity) == 0)
|
if (Functions.GetWindowText(window.Handle, sb_title, sb_title.Capacity) == 0)
|
||||||
Debug.Print("Failed to retrieve window title (window:{0}, reason:{1}).", window.WindowHandle, Marshal.GetLastWin32Error());
|
Debug.Print("Failed to retrieve window title (window:{0}, reason:{1}).", window.Handle, Marshal.GetLastWin32Error());
|
||||||
return sb_title.ToString();
|
return sb_title.ToString();
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (Title != value)
|
if (Title != value)
|
||||||
{
|
{
|
||||||
if (!Functions.SetWindowText(window.WindowHandle, value))
|
if (!Functions.SetWindowText(window.Handle, value))
|
||||||
Debug.Print("Failed to change window title (window:{0}, new title:{1}, reason:{2}).", window.WindowHandle, value, Marshal.GetLastWin32Error());
|
Debug.Print("Failed to change window title (window:{0}, new title:{1}, reason:{2}).", window.Handle, value, Marshal.GetLastWin32Error());
|
||||||
TitleChanged(this, EventArgs.Empty);
|
TitleChanged(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -864,7 +864,7 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Functions.IsWindowVisible(window.WindowHandle);
|
return Functions.IsWindowVisible(window.Handle);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
@ -872,16 +872,16 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
Functions.ShowWindow(window.WindowHandle, ShowWindowCommand.SHOW);
|
Functions.ShowWindow(window.Handle, ShowWindowCommand.SHOW);
|
||||||
if (invisible_since_creation)
|
if (invisible_since_creation)
|
||||||
{
|
{
|
||||||
Functions.BringWindowToTop(window.WindowHandle);
|
Functions.BringWindowToTop(window.Handle);
|
||||||
Functions.SetForegroundWindow(window.WindowHandle);
|
Functions.SetForegroundWindow(window.Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!value)
|
else if (!value)
|
||||||
{
|
{
|
||||||
Functions.ShowWindow(window.WindowHandle, ShowWindowCommand.HIDE);
|
Functions.ShowWindow(window.Handle, ShowWindowCommand.HIDE);
|
||||||
}
|
}
|
||||||
|
|
||||||
VisibleChanged(this, EventArgs.Empty);
|
VisibleChanged(this, EventArgs.Empty);
|
||||||
|
@ -933,7 +933,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public void Close()
|
public void Close()
|
||||||
{
|
{
|
||||||
Functions.PostMessage(window.WindowHandle, WindowMessage.CLOSE, IntPtr.Zero, IntPtr.Zero);
|
Functions.PostMessage(window.Handle, WindowMessage.CLOSE, IntPtr.Zero, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -975,7 +975,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
if (WindowBorder == WindowBorder.Hidden)
|
if (WindowBorder == WindowBorder.Hidden)
|
||||||
{
|
{
|
||||||
IntPtr current_monitor = Functions.MonitorFromWindow(window.WindowHandle, MonitorFrom.Nearest);
|
IntPtr current_monitor = Functions.MonitorFromWindow(window.Handle, MonitorFrom.Nearest);
|
||||||
MonitorInfo info = new MonitorInfo();
|
MonitorInfo info = new MonitorInfo();
|
||||||
info.Size = MonitorInfo.SizeInBytes;
|
info.Size = MonitorInfo.SizeInBytes;
|
||||||
Functions.GetMonitorInfo(current_monitor, ref info);
|
Functions.GetMonitorInfo(current_monitor, ref info);
|
||||||
|
@ -1007,13 +1007,13 @@ namespace OpenTK.Platform.Windows
|
||||||
HideBorder();
|
HideBorder();
|
||||||
command = ShowWindowCommand.MAXIMIZE;
|
command = ShowWindowCommand.MAXIMIZE;
|
||||||
|
|
||||||
Functions.SetForegroundWindow(window.WindowHandle);
|
Functions.SetForegroundWindow(window.Handle);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (command != 0)
|
if (command != 0)
|
||||||
Functions.ShowWindow(window.WindowHandle, command);
|
Functions.ShowWindow(window.Handle, command);
|
||||||
|
|
||||||
// Restore previous window border or apply pending border change when leaving fullscreen mode.
|
// Restore previous window border or apply pending border change when leaving fullscreen mode.
|
||||||
if (exiting_fullscreen)
|
if (exiting_fullscreen)
|
||||||
|
@ -1090,8 +1090,8 @@ namespace OpenTK.Platform.Windows
|
||||||
if (was_visible)
|
if (was_visible)
|
||||||
Visible = false;
|
Visible = false;
|
||||||
|
|
||||||
Functions.SetWindowLong(window.WindowHandle, GetWindowLongOffsets.STYLE, (IntPtr)(int)style);
|
Functions.SetWindowLong(window.Handle, GetWindowLongOffsets.STYLE, (IntPtr)(int)style);
|
||||||
Functions.SetWindowPos(window.WindowHandle, IntPtr.Zero, 0, 0, rect.Width, rect.Height,
|
Functions.SetWindowPos(window.Handle, IntPtr.Zero, 0, 0, rect.Width, rect.Height,
|
||||||
SetWindowPosFlags.NOMOVE | SetWindowPosFlags.NOZORDER |
|
SetWindowPosFlags.NOMOVE | SetWindowPosFlags.NOZORDER |
|
||||||
SetWindowPosFlags.FRAMECHANGED);
|
SetWindowPosFlags.FRAMECHANGED);
|
||||||
|
|
||||||
|
@ -1113,7 +1113,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public Point PointToClient(Point point)
|
public Point PointToClient(Point point)
|
||||||
{
|
{
|
||||||
if (!Functions.ScreenToClient(window.WindowHandle, ref point))
|
if (!Functions.ScreenToClient(window.Handle, ref point))
|
||||||
throw new InvalidOperationException(String.Format(
|
throw new InvalidOperationException(String.Format(
|
||||||
"Could not convert point {0} from screen to client coordinates. Windows error: {1}",
|
"Could not convert point {0} from screen to client coordinates. Windows error: {1}",
|
||||||
point.ToString(), Marshal.GetLastWin32Error()));
|
point.ToString(), Marshal.GetLastWin32Error()));
|
||||||
|
@ -1127,7 +1127,7 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
public Point PointToScreen(Point point)
|
public Point PointToScreen(Point point)
|
||||||
{
|
{
|
||||||
if (!Functions.ClientToScreen(window.WindowHandle, ref point))
|
if (!Functions.ClientToScreen(window.Handle, ref point))
|
||||||
throw new InvalidOperationException(String.Format(
|
throw new InvalidOperationException(String.Format(
|
||||||
"Could not convert point {0} from screen to client coordinates. Windows error: {1}",
|
"Could not convert point {0} from screen to client coordinates. Windows error: {1}",
|
||||||
point.ToString(), Marshal.GetLastWin32Error()));
|
point.ToString(), Marshal.GetLastWin32Error()));
|
||||||
|
@ -1170,7 +1170,7 @@ namespace OpenTK.Platform.Windows
|
||||||
{
|
{
|
||||||
while (!IsIdle)
|
while (!IsIdle)
|
||||||
{
|
{
|
||||||
ret = Functions.GetMessage(ref msg, window.WindowHandle, 0, 0);
|
ret = Functions.GetMessage(ref msg, window.Handle, 0, 0);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
throw new PlatformException(String.Format(
|
throw new PlatformException(String.Format(
|
||||||
|
|
|
@ -79,7 +79,7 @@ namespace OpenTK.Platform.Windows
|
||||||
INativeWindow native = new NativeWindow();
|
INativeWindow native = new NativeWindow();
|
||||||
native.ProcessEvents();
|
native.ProcessEvents();
|
||||||
WinWindowInfo parent = native.WindowInfo as WinWindowInfo;
|
WinWindowInfo parent = native.WindowInfo as WinWindowInfo;
|
||||||
Functions.SetParent(parent.WindowHandle, Constants.MESSAGE_ONLY);
|
Functions.SetParent(parent.Handle, Constants.MESSAGE_ONLY);
|
||||||
native.ProcessEvents();
|
native.ProcessEvents();
|
||||||
|
|
||||||
Debug.Unindent();
|
Debug.Unindent();
|
||||||
|
@ -97,7 +97,7 @@ namespace OpenTK.Platform.Windows
|
||||||
CreateDrivers();
|
CreateDrivers();
|
||||||
|
|
||||||
// Subclass the window to retrieve the events we are interested in.
|
// Subclass the window to retrieve the events we are interested in.
|
||||||
OldWndProc = Functions.SetWindowLong(Parent.WindowHandle, WndProc);
|
OldWndProc = Functions.SetWindowLong(Parent.Handle, WndProc);
|
||||||
Debug.Print("Input window attached to {0}", Parent);
|
Debug.Print("Input window attached to {0}", Parent);
|
||||||
|
|
||||||
InputReady.Set();
|
InputReady.Set();
|
||||||
|
@ -105,7 +105,7 @@ namespace OpenTK.Platform.Windows
|
||||||
MSG msg = new MSG();
|
MSG msg = new MSG();
|
||||||
while (Native.Exists)
|
while (Native.Exists)
|
||||||
{
|
{
|
||||||
int ret = Functions.GetMessage(ref msg, Parent.WindowHandle, 0, 0);
|
int ret = Functions.GetMessage(ref msg, Parent.Handle, 0, 0);
|
||||||
if (ret == -1)
|
if (ret == -1)
|
||||||
{
|
{
|
||||||
throw new PlatformException(String.Format(
|
throw new PlatformException(String.Format(
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace OpenTK.Platform.Windows
|
||||||
bdi.ClassGuid = DeviceInterfaceHid;
|
bdi.ClassGuid = DeviceInterfaceHid;
|
||||||
unsafe
|
unsafe
|
||||||
{
|
{
|
||||||
dev_notify_handle = Functions.RegisterDeviceNotification(parent.WindowHandle,
|
dev_notify_handle = Functions.RegisterDeviceNotification(parent.Handle,
|
||||||
new IntPtr((void*)&bdi), DeviceNotification.WINDOW_HANDLE);
|
new IntPtr((void*)&bdi), DeviceNotification.WINDOW_HANDLE);
|
||||||
}
|
}
|
||||||
if (dev_notify_handle == IntPtr.Zero)
|
if (dev_notify_handle == IntPtr.Zero)
|
||||||
|
@ -135,8 +135,8 @@ namespace OpenTK.Platform.Windows
|
||||||
|
|
||||||
protected override void CreateDrivers()
|
protected override void CreateDrivers()
|
||||||
{
|
{
|
||||||
keyboard_driver = new WinRawKeyboard(Parent.WindowHandle);
|
keyboard_driver = new WinRawKeyboard(Parent.Handle);
|
||||||
mouse_driver = new WinRawMouse(Parent.WindowHandle);
|
mouse_driver = new WinRawMouse(Parent.Handle);
|
||||||
joystick_driver = new WinMMJoystick();
|
joystick_driver = new WinMMJoystick();
|
||||||
|
|
||||||
DevNotifyHandle = RegisterForDeviceNotifications(Parent);
|
DevNotifyHandle = RegisterForDeviceNotifications(Parent);
|
||||||
|
|
|
@ -68,7 +68,7 @@ namespace OpenTK.Platform.Windows
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the handle of the window.
|
/// Gets or sets the handle of the window.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr WindowHandle { get { return handle; } set { handle = value; } }
|
public IntPtr Handle { get { return handle; } set { handle = value; } }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the Parent of the window (may be null).
|
/// Gets or sets the Parent of the window (may be null).
|
||||||
|
@ -83,8 +83,8 @@ namespace OpenTK.Platform.Windows
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (dc == IntPtr.Zero)
|
if (dc == IntPtr.Zero)
|
||||||
dc = Functions.GetDC(this.WindowHandle);
|
dc = Functions.GetDC(this.Handle);
|
||||||
//dc = Functions.GetWindowDC(this.WindowHandle);
|
//dc = Functions.GetWindowDC(this.Handle);
|
||||||
return dc;
|
return dc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ namespace OpenTK.Platform.Windows
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format("Windows.WindowInfo: Handle {0}, Parent ({1})",
|
return String.Format("Windows.WindowInfo: Handle {0}, Parent ({1})",
|
||||||
this.WindowHandle, this.Parent != null ? this.Parent.ToString() : "null");
|
this.Handle, this.Parent != null ? this.Parent.ToString() : "null");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Checks if <c>this</c> and <c>obj</c> reference the same win32 window.</summary>
|
/// <summary>Checks if <c>this</c> and <c>obj</c> reference the same win32 window.</summary>
|
||||||
|
|
|
@ -548,7 +548,7 @@ namespace OpenTK.Platform.X11
|
||||||
xev = new XEvent();
|
xev = new XEvent();
|
||||||
xev.ClientMessageEvent.type = XEventName.ClientMessage;
|
xev.ClientMessageEvent.type = XEventName.ClientMessage;
|
||||||
xev.ClientMessageEvent.send_event = true;
|
xev.ClientMessageEvent.send_event = true;
|
||||||
xev.ClientMessageEvent.window = window.WindowHandle;
|
xev.ClientMessageEvent.window = window.Handle;
|
||||||
xev.ClientMessageEvent.message_type = message_type;
|
xev.ClientMessageEvent.message_type = message_type;
|
||||||
xev.ClientMessageEvent.format = 32;
|
xev.ClientMessageEvent.format = 32;
|
||||||
xev.ClientMessageEvent.ptr1 = l0;
|
xev.ClientMessageEvent.ptr1 = l0;
|
||||||
|
@ -568,14 +568,14 @@ namespace OpenTK.Platform.X11
|
||||||
xev = new XEvent();
|
xev = new XEvent();
|
||||||
xev.ClientMessageEvent.type = XEventName.ClientMessage;
|
xev.ClientMessageEvent.type = XEventName.ClientMessage;
|
||||||
xev.ClientMessageEvent.send_event = true;
|
xev.ClientMessageEvent.send_event = true;
|
||||||
xev.ClientMessageEvent.window = window.WindowHandle;
|
xev.ClientMessageEvent.window = window.Handle;
|
||||||
xev.ClientMessageEvent.message_type = message_type;
|
xev.ClientMessageEvent.message_type = message_type;
|
||||||
xev.ClientMessageEvent.format = 32;
|
xev.ClientMessageEvent.format = 32;
|
||||||
xev.ClientMessageEvent.ptr1 = l0;
|
xev.ClientMessageEvent.ptr1 = l0;
|
||||||
xev.ClientMessageEvent.ptr2 = l1;
|
xev.ClientMessageEvent.ptr2 = l1;
|
||||||
xev.ClientMessageEvent.ptr3 = l2;
|
xev.ClientMessageEvent.ptr3 = l2;
|
||||||
|
|
||||||
XSendEvent(window.Display, window.WindowHandle, false, new IntPtr((int)EventMask.NoEventMask), ref xev);
|
XSendEvent(window.Display, window.Handle, false, new IntPtr((int)EventMask.NoEventMask), ref xev);
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||||
|
|
|
@ -265,12 +265,12 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
public override void SwapBuffers()
|
public override void SwapBuffers()
|
||||||
{
|
{
|
||||||
if (Display == IntPtr.Zero || currentWindow.WindowHandle == IntPtr.Zero)
|
if (Display == IntPtr.Zero || currentWindow.Handle == IntPtr.Zero)
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
String.Format("Window is invalid. Display ({0}), Handle ({1}).", Display, currentWindow.WindowHandle));
|
String.Format("Window is invalid. Display ({0}), Handle ({1}).", Display, currentWindow.Handle));
|
||||||
using (new XLock(Display))
|
using (new XLock(Display))
|
||||||
{
|
{
|
||||||
Glx.SwapBuffers(Display, currentWindow.WindowHandle);
|
Glx.SwapBuffers(Display, currentWindow.Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,14 +308,14 @@ namespace OpenTK.Platform.X11
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
Debug.Write(String.Format("Making context {0} current on thread {1} (Display: {2}, Screen: {3}, Window: {4})... ",
|
Debug.Write(String.Format("Making context {0} current on thread {1} (Display: {2}, Screen: {3}, Window: {4})... ",
|
||||||
Handle, System.Threading.Thread.CurrentThread.ManagedThreadId, Display, w.Screen, w.WindowHandle));
|
Handle, System.Threading.Thread.CurrentThread.ManagedThreadId, Display, w.Screen, w.Handle));
|
||||||
|
|
||||||
if (Display == IntPtr.Zero || w.WindowHandle == IntPtr.Zero || Handle == ContextHandle.Zero)
|
if (Display == IntPtr.Zero || w.Handle == IntPtr.Zero || Handle == ContextHandle.Zero)
|
||||||
throw new InvalidOperationException("Invalid display, window or context.");
|
throw new InvalidOperationException("Invalid display, window or context.");
|
||||||
|
|
||||||
using (new XLock(Display))
|
using (new XLock(Display))
|
||||||
{
|
{
|
||||||
result = Glx.MakeCurrent(Display, w.WindowHandle, Handle);
|
result = Glx.MakeCurrent(Display, w.Handle, Handle);
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
currentWindow = w;
|
currentWindow = w;
|
||||||
|
|
|
@ -169,15 +169,15 @@ namespace OpenTK.Platform.X11
|
||||||
uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask |
|
uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask |
|
||||||
(uint)SetWindowValuemask.BackPixel | (uint)SetWindowValuemask.BorderPixel;
|
(uint)SetWindowValuemask.BackPixel | (uint)SetWindowValuemask.BorderPixel;
|
||||||
|
|
||||||
window.WindowHandle = Functions.XCreateWindow(window.Display, window.RootWindow,
|
window.Handle = Functions.XCreateWindow(window.Display, window.RootWindow,
|
||||||
x, y, width, height, 0, window.VisualInfo.Depth/*(int)CreateWindowArgs.CopyFromParent*/,
|
x, y, width, height, 0, window.VisualInfo.Depth/*(int)CreateWindowArgs.CopyFromParent*/,
|
||||||
(int)CreateWindowArgs.InputOutput, window.VisualInfo.Visual, (UIntPtr)mask, ref attributes);
|
(int)CreateWindowArgs.InputOutput, window.VisualInfo.Visual, (UIntPtr)mask, ref attributes);
|
||||||
|
|
||||||
if (window.WindowHandle == IntPtr.Zero)
|
if (window.Handle == IntPtr.Zero)
|
||||||
throw new ApplicationException("XCreateWindow call failed (returned 0).");
|
throw new ApplicationException("XCreateWindow call failed (returned 0).");
|
||||||
|
|
||||||
if (title != null)
|
if (title != null)
|
||||||
Functions.XStoreName(window.Display, window.WindowHandle, title);
|
Functions.XStoreName(window.Display, window.Handle, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the window hints
|
// Set the window hints
|
||||||
|
@ -189,10 +189,10 @@ namespace OpenTK.Platform.X11
|
||||||
hints.flags = (IntPtr)(XSizeHintsFlags.PSize | XSizeHintsFlags.PPosition);
|
hints.flags = (IntPtr)(XSizeHintsFlags.PSize | XSizeHintsFlags.PPosition);
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XSetWMNormalHints(window.Display, window.WindowHandle, ref hints);
|
Functions.XSetWMNormalHints(window.Display, window.Handle, ref hints);
|
||||||
|
|
||||||
// Register for window destroy notification
|
// Register for window destroy notification
|
||||||
Functions.XSetWMProtocols(window.Display, window.WindowHandle, new IntPtr[] { _atom_wm_destroy }, 1);
|
Functions.XSetWMProtocols(window.Display, window.Handle, new IntPtr[] { _atom_wm_destroy }, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the initial window size to ensure X, Y, Width, Height and the rest
|
// Set the initial window size to ensure X, Y, Width, Height and the rest
|
||||||
|
@ -314,7 +314,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XGetWMNormalHints(window.Display, window.WindowHandle, ref hints, out dummy);
|
Functions.XGetWMNormalHints(window.Display, window.Handle, ref hints, out dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min_width > 0 || min_height > 0)
|
if (min_width > 0 || min_height > 0)
|
||||||
|
@ -342,7 +342,7 @@ namespace OpenTK.Platform.X11
|
||||||
// http://bugzilla.ximian.com/show_bug.cgi?id=80021
|
// http://bugzilla.ximian.com/show_bug.cgi?id=80021
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XSetWMNormalHints(window.Display, window.WindowHandle, ref hints);
|
Functions.XSetWMNormalHints(window.Display, window.Handle, ref hints);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,7 +365,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XGetWindowProperty(window.Display, window.WindowHandle,
|
Functions.XGetWindowProperty(window.Display, window.Handle,
|
||||||
_atom_net_wm_allowed_actions, IntPtr.Zero, new IntPtr(256), false,
|
_atom_net_wm_allowed_actions, IntPtr.Zero, new IntPtr(256), false,
|
||||||
IntPtr.Zero, out actual_atom, out actual_format, out nitems,
|
IntPtr.Zero, out actual_atom, out actual_format, out nitems,
|
||||||
out bytes_after, ref prop);
|
out bytes_after, ref prop);
|
||||||
|
@ -417,7 +417,7 @@ namespace OpenTK.Platform.X11
|
||||||
// should obey the Motif hint). Anyway, if this hint is set, we say the decorations have been remove
|
// should obey the Motif hint). Anyway, if this hint is set, we say the decorations have been remove
|
||||||
// although there is a slight chance this is not the case.
|
// although there is a slight chance this is not the case.
|
||||||
IntPtr transient_for_parent;
|
IntPtr transient_for_parent;
|
||||||
Functions.XGetTransientForHint(window.Display, window.WindowHandle, out transient_for_parent);
|
Functions.XGetTransientForHint(window.Display, window.Handle, out transient_for_parent);
|
||||||
if (transient_for_parent != IntPtr.Zero)
|
if (transient_for_parent != IntPtr.Zero)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -463,7 +463,7 @@ namespace OpenTK.Platform.X11
|
||||||
IntPtr atom = Functions.XInternAtom(this.window.Display, MOTIF_WM_ATOM, true);
|
IntPtr atom = Functions.XInternAtom(this.window.Display, MOTIF_WM_ATOM, true);
|
||||||
if (atom != IntPtr.Zero)
|
if (atom != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
//Functions.XGetWindowProperty(window.Display, window.WindowHandle, atom, IntPtr.Zero, IntPtr.Zero, false,
|
//Functions.XGetWindowProperty(window.Display, window.Handle, atom, IntPtr.Zero, IntPtr.Zero, false,
|
||||||
|
|
||||||
MotifWmHints hints = new MotifWmHints();
|
MotifWmHints hints = new MotifWmHints();
|
||||||
hints.flags = (IntPtr)MotifFlags.Decorations;
|
hints.flags = (IntPtr)MotifFlags.Decorations;
|
||||||
|
@ -619,7 +619,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XGetWindowProperty(window.Display, window.WindowHandle,
|
Functions.XGetWindowProperty(window.Display, window.Handle,
|
||||||
_atom_net_frame_extents, IntPtr.Zero, new IntPtr(16), false,
|
_atom_net_frame_extents, IntPtr.Zero, new IntPtr(16), false,
|
||||||
(IntPtr)Atom.XA_CARDINAL, out atom, out format, out nitems, out bytes_after, ref prop);
|
(IntPtr)Atom.XA_CARDINAL, out atom, out format, out nitems, out bytes_after, ref prop);
|
||||||
}
|
}
|
||||||
|
@ -695,7 +695,7 @@ namespace OpenTK.Platform.X11
|
||||||
IntPtr cmap = Functions.XDefaultColormap(window.Display, window.Screen);
|
IntPtr cmap = Functions.XDefaultColormap(window.Display, window.Screen);
|
||||||
Functions.XAllocNamedColor(window.Display, cmap, "black", out black, out dummy);
|
Functions.XAllocNamedColor(window.Display, cmap, "black", out black, out dummy);
|
||||||
IntPtr bmp_empty = Functions.XCreateBitmapFromData(window.Display,
|
IntPtr bmp_empty = Functions.XCreateBitmapFromData(window.Display,
|
||||||
window.WindowHandle, new byte[,] { { 0 } });
|
window.Handle, new byte[,] { { 0 } });
|
||||||
cursor = Functions.XCreatePixmapCursor(window.Display,
|
cursor = Functions.XCreatePixmapCursor(window.Display,
|
||||||
bmp_empty, bmp_empty, ref black, ref black, 0, 0);
|
bmp_empty, bmp_empty, ref black, ref black, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -726,8 +726,8 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
if (!Functions.XCheckWindowEvent(window.Display, window.WindowHandle, window.EventMask, ref e) &&
|
if (!Functions.XCheckWindowEvent(window.Display, window.Handle, window.EventMask, ref e) &&
|
||||||
!Functions.XCheckTypedWindowEvent(window.Display, window.WindowHandle, XEventName.ClientMessage, ref e))
|
!Functions.XCheckTypedWindowEvent(window.Display, window.Handle, XEventName.ClientMessage, ref e))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,7 +770,7 @@ namespace OpenTK.Platform.X11
|
||||||
Debug.WriteLine("Destroying window.");
|
Debug.WriteLine("Destroying window.");
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XDestroyWindow(window.Display, window.WindowHandle);
|
Functions.XDestroyWindow(window.Display, window.Handle);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -927,7 +927,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XMoveResizeWindow(window.Display, window.WindowHandle,
|
Functions.XMoveResizeWindow(window.Display, window.Handle,
|
||||||
value.X,
|
value.X,
|
||||||
value.Y,
|
value.Y,
|
||||||
value.Width - border_left - border_right,
|
value.Width - border_left - border_right,
|
||||||
|
@ -948,7 +948,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XMoveWindow(window.Display, window.WindowHandle, value.X, value.Y);
|
Functions.XMoveWindow(window.Display, window.Handle, value.X, value.Y);
|
||||||
}
|
}
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
}
|
}
|
||||||
|
@ -970,7 +970,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XResizeWindow(window.Display, window.WindowHandle, width, height);
|
Functions.XResizeWindow(window.Display, window.Handle, width, height);
|
||||||
}
|
}
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
}
|
}
|
||||||
|
@ -994,9 +994,9 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XMoveWindow(window.Display, window.WindowHandle,
|
Functions.XMoveWindow(window.Display, window.Handle,
|
||||||
value.X, value.Y);
|
value.X, value.Y);
|
||||||
Functions.XResizeWindow(window.Display, window.WindowHandle,
|
Functions.XResizeWindow(window.Display, window.Handle,
|
||||||
value.Width, value.Height);
|
value.Width, value.Height);
|
||||||
}
|
}
|
||||||
ProcessEvents();
|
ProcessEvents();
|
||||||
|
@ -1080,8 +1080,8 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XDeleteProperty(window.Display, window.WindowHandle, _atom_net_wm_icon);
|
Functions.XDeleteProperty(window.Display, window.Handle, _atom_net_wm_icon);
|
||||||
DeleteIconPixmaps(window.Display, window.WindowHandle);
|
DeleteIconPixmaps(window.Display, window.Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1101,16 +1101,16 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XChangeProperty(window.Display, window.WindowHandle,
|
Functions.XChangeProperty(window.Display, window.Handle,
|
||||||
_atom_net_wm_icon, _atom_xa_cardinal, 32,
|
_atom_net_wm_icon, _atom_xa_cardinal, 32,
|
||||||
PropertyMode.Replace, data, size);
|
PropertyMode.Replace, data, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set XWMHints
|
// Set XWMHints
|
||||||
DeleteIconPixmaps(window.Display, window.WindowHandle);
|
DeleteIconPixmaps(window.Display, window.Handle);
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
IntPtr wmHints_ptr = Functions.XGetWMHints(window.Display, window.WindowHandle);
|
IntPtr wmHints_ptr = Functions.XGetWMHints(window.Display, window.Handle);
|
||||||
|
|
||||||
if (wmHints_ptr == IntPtr.Zero)
|
if (wmHints_ptr == IntPtr.Zero)
|
||||||
wmHints_ptr = Functions.XAllocWMHints();
|
wmHints_ptr = Functions.XAllocWMHints();
|
||||||
|
@ -1121,7 +1121,7 @@ namespace OpenTK.Platform.X11
|
||||||
wmHints.icon_pixmap = Functions.CreatePixmapFromImage(window.Display, bitmap);
|
wmHints.icon_pixmap = Functions.CreatePixmapFromImage(window.Display, bitmap);
|
||||||
wmHints.icon_mask = Functions.CreateMaskFromImage(window.Display, bitmap);
|
wmHints.icon_mask = Functions.CreateMaskFromImage(window.Display, bitmap);
|
||||||
|
|
||||||
Functions.XSetWMHints(window.Display, window.WindowHandle, ref wmHints);
|
Functions.XSetWMHints(window.Display, window.Handle, ref wmHints);
|
||||||
Functions.XFree (wmHints_ptr);
|
Functions.XFree (wmHints_ptr);
|
||||||
|
|
||||||
Functions.XSync(window.Display, false);
|
Functions.XSync(window.Display, false);
|
||||||
|
@ -1166,7 +1166,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XGetWindowProperty(window.Display, window.WindowHandle,
|
Functions.XGetWindowProperty(window.Display, window.Handle,
|
||||||
_atom_net_wm_state, IntPtr.Zero, new IntPtr(256), false,
|
_atom_net_wm_state, IntPtr.Zero, new IntPtr(256), false,
|
||||||
new IntPtr(4) /*XA_ATOM*/, out actual_atom, out actual_format,
|
new IntPtr(4) /*XA_ATOM*/, out actual_atom, out actual_format,
|
||||||
out nitems, out bytes_after, ref prop);
|
out nitems, out bytes_after, ref prop);
|
||||||
|
@ -1200,7 +1200,7 @@ namespace OpenTK.Platform.X11
|
||||||
return OpenTK.WindowState.Fullscreen;
|
return OpenTK.WindowState.Fullscreen;
|
||||||
/*
|
/*
|
||||||
attributes = new XWindowAttributes();
|
attributes = new XWindowAttributes();
|
||||||
Functions.XGetWindowAttributes(window.Display, window.WindowHandle, ref attributes);
|
Functions.XGetWindowAttributes(window.Display, window.Handle, ref attributes);
|
||||||
if (attributes.map_state == MapState.IsUnmapped)
|
if (attributes.map_state == MapState.IsUnmapped)
|
||||||
return (OpenTK.WindowState)(-1);
|
return (OpenTK.WindowState)(-1);
|
||||||
*/
|
*/
|
||||||
|
@ -1213,14 +1213,14 @@ namespace OpenTK.Platform.X11
|
||||||
if (current_state == value)
|
if (current_state == value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Debug.Print("GameWindow {0} changing WindowState from {1} to {2}.", window.WindowHandle.ToString(),
|
Debug.Print("GameWindow {0} changing WindowState from {1} to {2}.", window.Handle.ToString(),
|
||||||
current_state.ToString(), value.ToString());
|
current_state.ToString(), value.ToString());
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
// Reset the current window state
|
// Reset the current window state
|
||||||
if (current_state == OpenTK.WindowState.Minimized)
|
if (current_state == OpenTK.WindowState.Minimized)
|
||||||
Functions.XMapWindow(window.Display, window.WindowHandle);
|
Functions.XMapWindow(window.Display, window.Handle);
|
||||||
else if (current_state == OpenTK.WindowState.Fullscreen)
|
else if (current_state == OpenTK.WindowState.Fullscreen)
|
||||||
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_remove,
|
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_remove,
|
||||||
_atom_net_wm_state_fullscreen,
|
_atom_net_wm_state_fullscreen,
|
||||||
|
@ -1246,7 +1246,7 @@ namespace OpenTK.Platform.X11
|
||||||
switch (value)
|
switch (value)
|
||||||
{
|
{
|
||||||
case OpenTK.WindowState.Normal:
|
case OpenTK.WindowState.Normal:
|
||||||
Functions.XRaiseWindow(window.Display, window.WindowHandle);
|
Functions.XRaiseWindow(window.Display, window.Handle);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1254,13 +1254,13 @@ namespace OpenTK.Platform.X11
|
||||||
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_add,
|
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_add,
|
||||||
_atom_net_wm_state_maximized_horizontal,
|
_atom_net_wm_state_maximized_horizontal,
|
||||||
_atom_net_wm_state_maximized_vertical);
|
_atom_net_wm_state_maximized_vertical);
|
||||||
Functions.XRaiseWindow(window.Display, window.WindowHandle);
|
Functions.XRaiseWindow(window.Display, window.Handle);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OpenTK.WindowState.Minimized:
|
case OpenTK.WindowState.Minimized:
|
||||||
// Todo: multiscreen support
|
// Todo: multiscreen support
|
||||||
Functions.XIconifyWindow(window.Display, window.WindowHandle, window.Screen);
|
Functions.XIconifyWindow(window.Display, window.Handle, window.Screen);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1269,7 +1269,7 @@ namespace OpenTK.Platform.X11
|
||||||
//this.WindowBorder = WindowBorder.Hidden;
|
//this.WindowBorder = WindowBorder.Hidden;
|
||||||
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_add,
|
Functions.SendNetWMMessage(window, _atom_net_wm_state, _atom_add,
|
||||||
_atom_net_wm_state_fullscreen, IntPtr.Zero);
|
_atom_net_wm_state_fullscreen, IntPtr.Zero);
|
||||||
Functions.XRaiseWindow(window.Display, window.WindowHandle);
|
Functions.XRaiseWindow(window.Display, window.Handle);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1363,7 +1363,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XUndefineCursor(window.Display, window.WindowHandle);
|
Functions.XUndefineCursor(window.Display, window.Handle);
|
||||||
cursor_visible = true;
|
cursor_visible = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1371,7 +1371,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XDefineCursor(window.Display, window.WindowHandle, EmptyCursor);
|
Functions.XDefineCursor(window.Display, window.Handle, EmptyCursor);
|
||||||
cursor_visible = false;
|
cursor_visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1422,7 +1422,7 @@ namespace OpenTK.Platform.X11
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr Handle
|
public IntPtr Handle
|
||||||
{
|
{
|
||||||
get { return this.window.WindowHandle; }
|
get { return this.window.Handle; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1440,7 +1440,7 @@ namespace OpenTK.Platform.X11
|
||||||
IntPtr name = IntPtr.Zero;
|
IntPtr name = IntPtr.Zero;
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XFetchName(window.Display, window.WindowHandle, ref name);
|
Functions.XFetchName(window.Display, window.Handle, ref name);
|
||||||
}
|
}
|
||||||
if (name != IntPtr.Zero)
|
if (name != IntPtr.Zero)
|
||||||
return Marshal.PtrToStringAnsi(name);
|
return Marshal.PtrToStringAnsi(name);
|
||||||
|
@ -1453,7 +1453,7 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XStoreName(window.Display, window.WindowHandle, value);
|
Functions.XStoreName(window.Display, window.Handle, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1477,14 +1477,14 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XMapWindow(window.Display, window.WindowHandle);
|
Functions.XMapWindow(window.Display, window.Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!value && visible)
|
else if (!value && visible)
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XUnmapWindow(window.Display, window.WindowHandle);
|
Functions.XUnmapWindow(window.Display, window.Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1511,11 +1511,11 @@ namespace OpenTK.Platform.X11
|
||||||
ev.type = XEventName.ClientMessage;
|
ev.type = XEventName.ClientMessage;
|
||||||
ev.ClientMessageEvent.format = 32;
|
ev.ClientMessageEvent.format = 32;
|
||||||
ev.ClientMessageEvent.display = window.Display;
|
ev.ClientMessageEvent.display = window.Display;
|
||||||
ev.ClientMessageEvent.window = window.WindowHandle;
|
ev.ClientMessageEvent.window = window.Handle;
|
||||||
ev.ClientMessageEvent.ptr1 = _atom_wm_destroy;
|
ev.ClientMessageEvent.ptr1 = _atom_wm_destroy;
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XSendEvent(window.Display, window.WindowHandle, false,
|
Functions.XSendEvent(window.Display, window.Handle, false,
|
||||||
EventMask.NoEventMask, ref ev);
|
EventMask.NoEventMask, ref ev);
|
||||||
Functions.XFlush(window.Display);
|
Functions.XFlush(window.Display);
|
||||||
}
|
}
|
||||||
|
@ -1530,7 +1530,7 @@ namespace OpenTK.Platform.X11
|
||||||
Debug.WriteLine("X11GLNative shutdown sequence initiated.");
|
Debug.WriteLine("X11GLNative shutdown sequence initiated.");
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XDestroyWindow(window.Display, window.WindowHandle);
|
Functions.XDestroyWindow(window.Display, window.Handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1545,7 +1545,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XTranslateCoordinates(window.Display, window.RootWindow, window.WindowHandle, point.X, point.Y, out ox, out oy, out child);
|
Functions.XTranslateCoordinates(window.Display, window.RootWindow, window.Handle, point.X, point.Y, out ox, out oy, out child);
|
||||||
}
|
}
|
||||||
|
|
||||||
point.X = ox;
|
point.X = ox;
|
||||||
|
@ -1565,7 +1565,7 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XTranslateCoordinates(window.Display, window.WindowHandle, window.RootWindow, point.X, point.Y, out ox, out oy, out child);
|
Functions.XTranslateCoordinates(window.Display, window.Handle, window.RootWindow, point.X, point.Y, out ox, out oy, out child);
|
||||||
}
|
}
|
||||||
|
|
||||||
point.X = ox;
|
point.X = ox;
|
||||||
|
@ -1592,14 +1592,14 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
if (manuallyCalled)
|
if (manuallyCalled)
|
||||||
{
|
{
|
||||||
if (window != null && window.WindowHandle != IntPtr.Zero)
|
if (window != null && window.Handle != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
if (Exists)
|
if (Exists)
|
||||||
{
|
{
|
||||||
using (new XLock(window.Display))
|
using (new XLock(window.Display))
|
||||||
{
|
{
|
||||||
Functions.XFreeCursor(window.Display, EmptyCursor);
|
Functions.XFreeCursor(window.Display, EmptyCursor);
|
||||||
Functions.XDestroyWindow(window.Display, window.WindowHandle);
|
Functions.XDestroyWindow(window.Display, window.Handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (Exists)
|
while (Exists)
|
||||||
|
|
|
@ -77,7 +77,7 @@ namespace OpenTK.Platform.X11
|
||||||
#region --- Public Methods ---
|
#region --- Public Methods ---
|
||||||
|
|
||||||
/// <summary>Gets or sets the handle of the window.</summary>
|
/// <summary>Gets or sets the handle of the window.</summary>
|
||||||
public IntPtr WindowHandle { get { return handle; } set { handle = value; } }
|
public IntPtr Handle { get { return handle; } set { handle = value; } }
|
||||||
/// <summary>Gets or sets the parent of the window.</summary>
|
/// <summary>Gets or sets the parent of the window.</summary>
|
||||||
public X11WindowInfo Parent { get { return parent; } set { parent = value; } }
|
public X11WindowInfo Parent { get { return parent; } set { parent = value; } }
|
||||||
/// <summary>Gets or sets the X11 root window.</summary>
|
/// <summary>Gets or sets the X11 root window.</summary>
|
||||||
|
@ -113,7 +113,7 @@ namespace OpenTK.Platform.X11
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
return String.Format("X11.WindowInfo: Display {0}, Screen {1}, Handle {2}, Parent: ({3})",
|
return String.Format("X11.WindowInfo: Display {0}, Screen {1}, Handle {2}, Parent: ({3})",
|
||||||
this.Display, this.Screen, this.WindowHandle, this.Parent != null ? this.Parent.ToString() : "null");
|
this.Display, this.Screen, this.Handle, this.Parent != null ? this.Parent.ToString() : "null");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
@ -65,7 +65,7 @@ namespace OpenTK.Platform.X11
|
||||||
window.Display = API.DefaultDisplay;
|
window.Display = API.DefaultDisplay;
|
||||||
window.Screen = Functions.XDefaultScreen(window.Display);
|
window.Screen = Functions.XDefaultScreen(window.Display);
|
||||||
window.RootWindow = Functions.XRootWindow(window.Display, window.Screen);
|
window.RootWindow = Functions.XRootWindow(window.Display, window.Screen);
|
||||||
window.WindowHandle = window.RootWindow;
|
window.Handle = window.RootWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IsSupported(window.Display))
|
if (!IsSupported(window.Display))
|
||||||
|
@ -74,7 +74,7 @@ namespace OpenTK.Platform.X11
|
||||||
using (XIEventMask mask = new XIEventMask(1, XIEventMasks.RawButtonPressMask |
|
using (XIEventMask mask = new XIEventMask(1, XIEventMasks.RawButtonPressMask |
|
||||||
XIEventMasks.RawButtonReleaseMask | XIEventMasks.RawMotionMask))
|
XIEventMasks.RawButtonReleaseMask | XIEventMasks.RawMotionMask))
|
||||||
{
|
{
|
||||||
Functions.XISelectEvents(window.Display, window.WindowHandle, mask);
|
Functions.XISelectEvents(window.Display, window.Handle, mask);
|
||||||
Functions.XISelectEvents(window.Display, window.RootWindow, mask);
|
Functions.XISelectEvents(window.Display, window.RootWindow, mask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue