Commit Graph

312 Commits

Author SHA1 Message Date
Vadim Zeitlin
c7ad052c71 Use wxLocaleIdent in Unix wxLocale and wxUILocale code
No real changes, just prefer using wxLocaleIdent to strings in a few
places.
2021-09-05 01:00:04 +02:00
Vadim Zeitlin
45ffc40fc2 Use nl_langinfo() in wxUILocaleImplUnix::GetInfo()
This function can be used for all GetInfo() items, so using it is
simpler than the code in the Unix version of wxLocale::GetInfo() which
uses either it or localeconv(), and there should be no real drawbacks to
using it nowadays as it should be available everywhere.

No real changes yet.
2021-09-01 18:11:40 +02:00
Vadim Zeitlin
37a23e1ab1 Move platform-specific parts of wxLocale::Init() to wxUILocale
This is tidier than using #ifdefs in the same common file and also
ensures that initializing wxLocale affects wxUILocale too, which will be
important for compatibility when the code elsewhere is modified to use
wxUILocale::GetInfo() instead of wxLocale::GetInfo() in the upcoming
commits.

This commit is best viewed with --color-moved git option.
2021-08-20 23:37:28 +02:00
Scott Talbert
7cd12a2bd6 Add EGL-based backend for wxGLCanvas
Among other things, this enables wxGLCanvas to be used natively on
Wayland.

Closes https://github.com/wxWidgets/wxWidgets/pull/2038

Closes #17702.
2020-09-01 15:03:30 +02:00
Arrigo Marchiori
c86bcf962d Use wxASCII_STR() on string literals
Fix the build with wxNO_IMPLICIT_WXSTRING_ENCODING.
2020-07-17 17:52:16 +02:00
Daniel Kulp
6d12e746e1 Fix regression with making sockets non-blocking under Unix
The refactoring in the commit 51ea713826 (Extend and rename
wxSocketImpl::UnblockAndRegisterWithEventLoop(), 2019-11-20)
accidentally inverted the test for wxSOCKET_BLOCK, restore the correct
logic to make non-blocking sockets work again.

Closes #18834.
2020-07-16 11:51:51 +02:00
Paul Cornett
896512c732 Change fractional point size from float to double
There doesn't seem to be any compelling reason to use float. Using double
is simpler, and avoids otherwise unnecessary float<->double conversions.
2020-04-21 09:00:04 -07:00
Vadim Zeitlin
00d113c341 Fix wxSocketImplUnix compilation under OpenVMS
Don't pass "const void*" pointer to ioctl(), it seems to be declared as
taking "void*" on this platform and so doesn't accept it.
2019-12-19 18:36:22 +01:00
Vadim Zeitlin
73f0c9dff8 Fix crash with blocking accepting sockets in threads under Unix
Sockets returned by wxSocket::Accept() are non-blocking by default and
the only way to use them safely in worker threads is by switching them
to the blocking mode by calling SetFlags(wxSOCKET_BLOCK).

However this didn't work correctly since at least 2.8 days, as turning
wxSOCKET_BLOCK on didn't unregister the socket from the event loop, with
which it had been registered on creation. Fix this by doing this now,
which ensures that the main thread doesn't get any notifications about
the socket if it's used, in a blocking way, in a worker thread.

Note that making the new socket blocking after accpeting is still pretty
inefficient and pre-creating the socket as blocking and using
AcceptWith() is still preferable, but at least it does work now.

Closes #12886.
2019-11-20 20:21:25 +01:00
Vadim Zeitlin
51ea713826 Extend and rename wxSocketImpl::UnblockAndRegisterWithEventLoop()
In addition to unblocking and registering the socket, also support using
this function to make the socket blocking and unregistering it from the
event loop, if its flags include wxSOCKET_BLOCK.

This was already half-done by wxMSW, which took wxSOCKET_BLOCK presence
into account in its implementation, but not by the Unix implementation.
Now do it under all platforms, as this will be useful for switching a
previously non-blocking socket to blocking mode.

Finally, rename the function to better reflect what it really does.

See #12886.
2019-11-20 18:59:51 +01:00
Vadim Zeitlin
e0102c2396 Allow disabling events for blocking sockets in Unix version
It should still be possible to use DoEnableEvents() to disable events
for blocking sockets and this can be useful if a previously non-blocking
socket became blocking due to a SetFlags(wxSOCKET_BLOCK) call, so adjust
the fix of e18c8fd29a (see #17031) to
avoid calling EnableEvents() for blocking sockets instead of ignoring
them in DoEnableEvents() itself.

Also add an assert checking that we never try enabling events for
blocking sockets as this still doesn't make sense and so shouldn't
happen.

No real changes yet, but this is necessary for the upcoming commits.

See #12886.
2019-11-20 18:47:09 +01:00
Paul Cornett
df450566dd Avoid including X11 headers from <wx/glcanvas.h>
It's generally wxWidgets policy not to include platform-specific headers from our own
to avoid namespace pollution issues, in this case with names like "None" and "Window".
2019-08-28 09:37:49 -07:00
Jan Knepper
a4f2303361 Use closesocket() for closing sockets under MSW
If accepting a socket connection failed, wxSocketImpl::Accept() used
close() to close the socket even under MSW, but it can be only used for
the file descriptors there and closesocket() must be used instead for
the sockets.

Add new (private) wxCloseSocket define and use it both here, to fix the
bug, and elsewhere to make the code more clear.

Closes #18407.
2019-06-03 22:31:37 +02:00
Vadim Zeitlin
5488a1438f Globally replace vadim@wxwindows.org with vadim@wxwidgets.org
The old email address is invalid since many years and shouldn't be used
any longer.

No real changes.
2019-04-22 14:12:05 +02:00
Vadim Zeitlin
5d770e5cbe Use "m_" prefix for wxExecuteData members
No real changes, just rename the members to use the standard prefix
which is more consistent with the rest of wxWidgets and also allows to
avoid both the hacks with "foo_" names for the arguments of some
functions that were used to avoid the conflicts with member "foo" and
at least one remaining shadowing warning for "exitcode".
2019-04-22 14:09:28 +02:00
Vadim Zeitlin
b0c025e9fd Build fix for wxUSE_CONSOLE_EVENTLOOP==0 under Unix
Don't declare GetEventLoopSourcesManager() in Unix wxAppTraits if
console event loops are not used.

See https://github.com/wxWidgets/wxWidgets/pull/953
2018-10-10 19:07:28 +02:00
Vadim Zeitlin
e9ecc6728f Always include X11 headers from the private X11 display header
Commit 28ab24cd55 excluded too much in
wxUSE_DISPLAY==0 case, we still need X11 headers when not using
wxUSE_DISPLAY.
2018-10-10 14:14:48 +02:00
Vadim Zeitlin
28ab24cd55 Add missing wxUSE_DISPLAY check to X11 display header
Don't define functions dealing with video modes etc when
wxUSE_DISPLAY==0.
2018-10-09 15:28:28 +02:00
Vadim Zeitlin
e0ba727dec Extract X11 functions used by wxGTK in a separate header
This makes src/unix/displayx11.cpp almost readable as it's not littered
by "#ifndef __WXGTK20__" checks everywhere any more -- instead this file
is just not compiled as part of wxGTK2 at all any longer (it is still
included in wxGTK1 as well as wxX11 itself and wxMotif).

wxGTK code also can just include the new wx/unix/private/displayx11.h
instead of having to declare all the X11 functions it uses manually.

There should be no changes in behaviour, this is just a clean up.
2018-10-04 17:07:11 +02:00
Vadim Zeitlin
90dd87ee65 Fix wxGTK1 build after wxFont API changes
Implement the new {Get,Set}{FractionalPointSize,NumericWeight} methods.

Also change wxLoadQueryFont() to use wxNativeFontInfo methods as a side
effect, to reduce code duplication and reuse the existing support for
numeric weights and fractional point sizes in wxNativeFontInfo.
2018-09-17 15:24:42 +02:00
Vadim Zeitlin
3ffa651a34 Move wxAdv library contents into wxCore
This basically removes the "adv" library, even though it's still
preserved for compatibility with user make/project files referring to
it.

It is done because the distinction between "adv" and "core" was never
really clear (e.g. why wxTreeCtrl was in core but wxTreeListCtrl in
adv?) and it prevented some core classes from using adv ones.
2018-08-27 21:13:04 +02:00
Vadim Zeitlin
b97ea90f4f Add default value for MakeConfigFileName() 2nd argument
Make it possible to call wxStandardPaths::MakeConfigFileName() without
explicitly specifying the convention to use, to make it conform to the
documentation (previously this only worked when calling the
wxStandardPathsBase version of the method).

Closes #18106.
2018-03-17 17:17:05 +01:00
Vadim Zeitlin
04209e3a3e Remove GetStandardCmdLineOptions() from wxGTK
Unfortunately there is no reasonable way to implement this function for all
glibc versions as the information we need is stored in the private
_GOptionGroup struct whose layout has already changed once (in 2.44) and could
change again, so we can't rely on it.

We really need a g_option_group_get_entries() in glib itself, but the request
to add it at http://bugzilla.gnome.org/show_bug.cgi?id=431021 hasn't been
touched since 10 years, so it seems unlikely to happen.

See 99367a1530 (commitcomment-25789514)
2017-11-22 22:02:36 +01:00
Paul Cornett
65cc4c1624 Avoid ifdef-ed override specification
Instead, add the base class functions so the derived class always
overrides. If/when wxX11 and wxMotif are removed there won't be an
ifdef that no one ever notices isn't needed anymore.
2017-11-12 09:33:37 -08:00
Scott Furry
3653b753d3 Fix clang -Winconsistent-missing-override in wxGLApp
Use "override" for wxGLApp::GetXVisualInfo(), but only for wxGTK2 where
it really overrides it, unlike in wxX11.

Closes #17995.
2017-11-12 17:02:43 +01:00
Vadim Zeitlin
0975228809 Fix build problem with "override" on wxApp::GetXVisualInfo()
This method doesn't override any virtual method in the base class, so
wxOVERRIDE can't be used here.

In fact, this method doesn't seem to be used at all, but keep it for
compatibility and in case we want to use it later, as wxGTK does.
2017-04-26 14:42:38 +02:00
Vadim Zeitlin
5cf9fcbb1a Add wxStandardPaths::ConfigFileConv enum for clarity and safety
Use an enum instead of type-unsafe "int" for the second parameter of the
recently added wxStandardPaths::MakeConfigFileName().

This also avoids unnatural dependency of wxStandardPaths on
wxCONFIG_USE_SUBDIR constant defined in a higher level wxFileConfig class.

No real changes, but just make things a bit more robust and hopefully more
clear.
2017-03-09 17:53:14 +01:00
Martin Koegler
8d5d00db9d Implement MakeConfigFileName 2017-03-08 22:29:55 +01:00
Maarten Bent
87308746be Resolve -Wsuggest-override warnings. 2017-02-24 23:37:44 +01:00
ARATA Mizuki
8cfc74491a Replace wxEXPLICIT with the 'explicit' keyword
See #17655.
2016-09-14 18:45:12 +09:00
Paul Cornett
0bf38e11a3 Cleanup of ad84d9f (r77846)
Remove the unnecessary 'CodePair' struct from a header, make the huge
keySymTab array const, and don't compile it for platforms that don't
use it, it's only used by wxX11
2016-09-07 22:02:05 -07:00
Vadim Zeitlin
4dfde501df Add support for returning item location to wxGTK wxMimeTypesManager.
This is a squash merge of gtk_mimetype branch from
https://github.com/Hanmac/wxWidgets.git with some extra minor cleanup.

Closes https://github.com/wxWidgets/wxWidgets/pull/293
2016-06-07 14:29:52 +02:00
Vadim Zeitlin
4a0938d2b7 Allow "moving" wxX11Display objects
This is not a real move-ctor but std::auto_ptr<>-like "stealing" ctor. It
still allows to pass Display ownership to another function which is all that
is needed for our purposes.
2016-05-23 03:00:49 +02:00
Vadim Zeitlin
e82c619402 Only define wxUSE_XTEST in Unix-specific headers
This symbol is not needed and doesn't make sense in wxMSW.
2016-05-23 03:00:48 +02:00
Troels Knakkergaard
cda7209101 Add wxFileType::GetExpandedCommand()
This new method allows to get the command expanded with the given file name
for commands other than "Open" and "Print".

Closes #17367.
2016-03-05 03:09:59 +01:00
Tobias Taschner
c17202c696 Remove extra handling of wxAppTraits::GetStandardPaths() on OS X.
Since the removal of carbon in 5ba67c67e4 there is no longer any special handling required.
2016-03-04 15:34:51 +01:00
Dimitri Schoolwerth
1e78bf639e Add micro version to toolkit version functions
Support micro versions in wxAppTraits::GetToolkitVersion and
wxPlatformInfo functions related to toolkit versions.
2016-02-29 10:05:43 +01:00
Manuel Martin
bdc95f5766 Improve wxGLCanvas to be more type safe and better support modern OpenGL
Add wxGLAttribsBase, wxGLAttributes and wxGLContextAttrs replacing the old
untyped "int attributes[]".

Don't use global object for creating OpenGL > 3.0 contexts.

Closes #16909.
2016-02-23 00:32:54 +01:00
Hartwig
74a1ec3ead Addition of missing overrides to apptrait.h 2015-11-22 09:28:33 +01:00
Tobias Taschner
a0fb808087 Add wxStandardPaths::GetUserDir() to get Desktop, Download etc
All major supported platforms have well defined per-user directories to store
Downloads, Music, Pictures, Videos and the Desktop files. The new method
wxStandardPaths::GetUserDir() allows for a unified way to access these on MSW,
OS X and Unix (if XDG user dirs specification is implemented for the latter).

See https://github.com/wxWidgets/wxWidgets/pull/89
2015-10-04 01:05:23 +02:00
Paul Cornett
27a8d28029 more use of wxOVERRIDE 2015-09-06 17:20:42 -07:00
Dimitri Schoolwerth
8f8d58d193 Use wx-prefixed macros throughout the repository.
Change {DECLARE,IMPLEMENT}_*CLASS and {DECLARE,BEGIN,END}_EVENT_TABLE
occurrences to use the wx-prefixed version of the macros.
2015-04-23 22:00:35 +04:00
Vadim Zeitlin
ad84d9f97d make wxKeyEvent could get unicode key under x11, add a x11 keysym--unicode char map tab
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77846 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-09-23 17:43:37 +00:00
Vadim Zeitlin
df13791078 Merge wxQT branch into the trunk.
This merges in the latest sources from GSoC 2014 wxQt project with just a few
minor corrections, mostly undoing wrong changes to common files in that branch
(results of a previous bad merge?) and getting rid of whitespace-only changes.
Also remove debug logging from wxGrid.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77455 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-08-24 01:50:11 +00:00
Vadim Zeitlin
a4606fbb44 Refactor Unix OpenGL code to avoid using static attributes array.
Put the context attributes in wxGLCanvasX11 itself instead.

See #16402.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77073 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-08-15 12:14:11 +00:00
Vadim Zeitlin
fb99672f62 Hopefully finish removing the old wxCocoa port.
Get rid of the rest of __WXCOCOA__ tests in the sources.

Drop configure option for using it.

Also remove the documentation for this port.

This should have also been part of r76735.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76815 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-07-03 22:03:21 +00:00
Vadim Zeitlin
2594929d9f Move include/wx/unix/execute.h to include/wx/unix/private.
This header is private and is not supposed to be used from the outside the
library.

See #16325.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76683 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-06-11 14:55:08 +00:00
Paul Cornett
c1d1a5ad5e build fix for wxUSE_THREADS==0
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76309 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-04-11 04:48:12 +00:00
Paul Cornett
8b4ae731d3 use wxOVERRIDE
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76220 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-03-30 00:02:23 +00:00
Vadim Zeitlin
f740cc3881 Refactor YieldFor() to avoid code duplication among the ports.
Don't repeat the same code in all the ports, move it to the common base class
and add a new virtual DoYieldFor() for the really port-specific code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76061 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2014-03-02 18:58:00 +00:00